mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-04 08:07:15 -04:00
added exceptions, offline support, fixes, and lots of code cleanup
This commit is contained in:
@@ -1,14 +1,7 @@
|
|||||||
# rpass
|
# rpass
|
||||||
A very simple password manager with rsync (and soon libsecret) integration - alternative to GNU pass
|
A very simple password manager with rsync integration - alternative to GNU pass
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
rpass will likely be renamed due to the mass quantity of other terminal-based password managers named the same thing.
|
|
||||||
|
|
||||||
The new name may be 'rpazz', 'sspass', or something else.
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
Arch Linux (x86_64, aarch64)
|
Arch Linux (x86_64, aarch64)
|
||||||
|
|
||||||
rpass releases are available in the Arch User Repository as 'rpass'.
|
rpass releases are available in the Arch User Repository as 'rpass'.
|
||||||
@@ -24,7 +17,6 @@ makepkg -si
|
|||||||
Packaging for other distributions coming soon.
|
Packaging for other distributions coming soon.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Upon initial installation, be sure to run:
|
Upon initial installation, be sure to run:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -40,10 +32,8 @@ rpass --help
|
|||||||
```
|
```
|
||||||
|
|
||||||
# Roadmap
|
# Roadmap
|
||||||
|
|
||||||
Short-term Goals:
|
Short-term Goals:
|
||||||
|
|
||||||
- overhaul error messages
|
|
||||||
- create new file list w/color and w/o file extensions
|
- create new file list w/color and w/o file extensions
|
||||||
- create a man page
|
- create a man page
|
||||||
- allow for multi-line notes
|
- allow for multi-line notes
|
||||||
|
|||||||
+284
-116
@@ -15,7 +15,7 @@ import string
|
|||||||
|
|
||||||
|
|
||||||
def clear():
|
def clear():
|
||||||
print("\n" * 100)
|
print('\n' * 100)
|
||||||
|
|
||||||
|
|
||||||
def term(cmd):
|
def term(cmd):
|
||||||
@@ -51,35 +51,18 @@ def encryptfolder():
|
|||||||
rmtree('/dev/shm/' + shmfolder)
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
|
||||||
|
|
||||||
# argument - filter the argument to usable text - some replacements are only done once to prevent interference
|
# argument - filter the argument to usable text
|
||||||
|
|
||||||
argument = str(argv).replace('[', '', 1).replace(']', '', 1).replace(',', '').replace("'", '') \
|
argument = str(argv).replace('[', '', 1).replace(']', '', 1).replace(',', '').replace("'", '') \
|
||||||
.replace(' ', '', 1).replace('/usr/bin/', '', 1).replace('rpass', '', 1)
|
.replace(' ', '', 1).replace('/usr/bin/', '', 1).replace('rpass', '', 1)
|
||||||
|
|
||||||
# startup help
|
|
||||||
|
|
||||||
if argument == '':
|
|
||||||
clear()
|
|
||||||
print("use 'help', '--help', or '-h' to see a list of commands")
|
|
||||||
print()
|
|
||||||
print('<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>')
|
|
||||||
print("If you are receiving errors, run 'rpass config' and go through the guided setup wizard.")
|
|
||||||
print('This MUST be done before rpass will function!!')
|
|
||||||
print('<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>')
|
|
||||||
print()
|
|
||||||
print('rpass is currently early software with very little polish')
|
|
||||||
print()
|
|
||||||
|
|
||||||
# help
|
# help
|
||||||
|
|
||||||
if argument == 'help' or argument == '--help' or argument == '-h':
|
if argument == 'help' or argument == '--help' or argument == '-h':
|
||||||
print()
|
print('\nrpass Copyright (C) 2021 Randall Winkhart')
|
||||||
print('rpass Copyright (C) 2021 Randall Winkhart')
|
print("This program comes with ABSOLUTELY NO WARRANTY; for details type `rpass show w'.\nThis is free software, "
|
||||||
print("This program comes with ABSOLUTELY NO WARRANTY; for details type `rpass show w'. This is free software, "
|
|
||||||
"and you are welcome to redistribute it under certain conditions; type `rpass show c' for details.")
|
"and you are welcome to redistribute it under certain conditions; type `rpass show c' for details.")
|
||||||
print()
|
print('\nUSAGE: rpass [/<entry name>] [OPTION] [FLAG]\n')
|
||||||
print('USAGE: rpass [/<entry name>] [OPTION] [FLAG]')
|
|
||||||
print()
|
|
||||||
print('Options: ')
|
print('Options: ')
|
||||||
print('help/--help/-h bring up this menu')
|
print('help/--help/-h bring up this menu')
|
||||||
print('version/-v display rpass version info')
|
print('version/-v display rpass version info')
|
||||||
@@ -89,8 +72,7 @@ if argument == 'help' or argument == '--help' or argument == '-h':
|
|||||||
print('edit edit an existing entry')
|
print('edit edit an existing entry')
|
||||||
print('copy copy details of an entry to your clipboard')
|
print('copy copy details of an entry to your clipboard')
|
||||||
print('remove/-rm delete an existing entry')
|
print('remove/-rm delete an existing entry')
|
||||||
print('sync/-s manually sync the entry directory via rsync')
|
print('sync/-s manually sync the entry directory via rsync\n')
|
||||||
print()
|
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('add:')
|
print('add:')
|
||||||
print(' password/-p add a password entry')
|
print(' password/-p add a password entry')
|
||||||
@@ -108,25 +90,21 @@ if argument == 'help' or argument == '--help' or argument == '-h':
|
|||||||
print(' url/-l copy the URL of an entry to your clipboard')
|
print(' url/-l copy the URL of an entry to your clipboard')
|
||||||
print(' note/-n copy the note of an entry to your clipboard')
|
print(' note/-n copy the note of an entry to your clipboard')
|
||||||
print('gen:')
|
print('gen:')
|
||||||
print(' update/-u generate a password for an existing entry')
|
print(' update/-u generate a password for an existing entry\n')
|
||||||
print()
|
|
||||||
print("Tip: You can quickly read an entry with 'rpass /<entry name>'!")
|
print("Tip: You can quickly read an entry with 'rpass /<entry name>'!")
|
||||||
print("When specifying entry names, do not include the file extension! '.gpg' is assumed!")
|
print("When specifying entry names, do not include the file extension! '.gpg' is assumed!\n")
|
||||||
print()
|
|
||||||
|
|
||||||
# version info
|
# version info
|
||||||
|
|
||||||
if argument == 'version' or argument == '-v':
|
if argument == 'version' or argument == '-v':
|
||||||
print()
|
print('\n////////////////////////////////////////////////////////')
|
||||||
print('////////////////////////////////////////////////////////')
|
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ rpass Copyright (C) 2021 Randall Winkhart /')
|
print('/ rpass Copyright (C) 2021 Randall Winkhart /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ Version 2021.09.12.pr4 /')
|
print('/ Version 2021.09.15.pr4 /')
|
||||||
print('/ The Housekeeping Update (Pt. 1) /')
|
print('/ The Housekeeping Update (Pt. 1) /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('////////////////////////////////////////////////////////')
|
print('////////////////////////////////////////////////////////\n')
|
||||||
print()
|
|
||||||
|
|
||||||
# licensing info
|
# licensing info
|
||||||
|
|
||||||
@@ -135,114 +113,131 @@ if argument == 'show w':
|
|||||||
print('This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;')
|
print('This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;')
|
||||||
print('without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.')
|
print('without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.')
|
||||||
print('See the GNU General Public License for more details.')
|
print('See the GNU General Public License for more details.')
|
||||||
print()
|
print('\nhttps://opensource.org/licenses/GPL-3.0\n')
|
||||||
print('https://opensource.org/licenses/GPL-3.0')
|
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'show c':
|
if argument == 'show c':
|
||||||
clear()
|
clear()
|
||||||
print('This program is free software: you can redistribute it and/or modify it under the terms of the GNU General')
|
print('This program is free software: you can redistribute it and/or modify it under the terms of the GNU General')
|
||||||
print('Public License as published by the Free Software Foundation, either version 3 of the License,')
|
print('Public License as published by the Free Software Foundation, either version 3 of the License,')
|
||||||
print('or (at your option) any later version.')
|
print('or (at your option) any later version.\n')
|
||||||
print()
|
|
||||||
|
|
||||||
# config
|
# config
|
||||||
|
|
||||||
if argument == 'config':
|
if argument == 'config':
|
||||||
|
try:
|
||||||
print()
|
print()
|
||||||
directorychoice = str(input('Would you like to use the default entry directory (~/.rpass-store/)? (Y/n) '))
|
directorychoice = str(input('Would you like to use the default entry directory (~/.rpass-store/)? (Y/n) '))
|
||||||
if directorychoice != 'n':
|
if directorychoice == 'n' or directorychoice == 'N':
|
||||||
with open("/var/lib/rpass/rpassdir", 'w') as f:
|
print('\nFormat: /this/path/ends/with/a/slash/\n')
|
||||||
f.write('/home/' + environ.get('USER') + '/.rpass-store/' + '\n')
|
|
||||||
if directorychoice == 'n':
|
|
||||||
print()
|
|
||||||
print('Format: /this/path/ends/with/a/slash/')
|
|
||||||
print()
|
|
||||||
directory = str(input('Please input a custom directory: '))
|
directory = str(input('Please input a custom directory: '))
|
||||||
with open("/var/lib/rpass/rpassdir", 'w') as f:
|
with open("/var/lib/rpass/rpass-dir", 'w') as f:
|
||||||
f.write(directory + '\n')
|
f.write(directory + '\n')
|
||||||
|
else:
|
||||||
|
with open("/var/lib/rpass/rpass-dir", 'w') as f:
|
||||||
|
f.write('/home/' + environ.get('USER') + '/.rpass-store/' + '\n')
|
||||||
print()
|
print()
|
||||||
devicetype = str(input('Will this be a client or a server device? (c/S) '))
|
devicetype = str(input('Will this be a client, server, or offline device? (C/s/o) '))
|
||||||
if devicetype != 'c':
|
if devicetype == 's' or devicetype == 'S':
|
||||||
|
with open("/var/lib/rpass/rpass-ssh", 'w') as f:
|
||||||
|
f.write('\n\n\n\n' + devicetype)
|
||||||
|
print('\nMake sure the ssh service is running and properly configured.\n')
|
||||||
|
print('Configuration complete!\n')
|
||||||
|
if devicetype == 'o' or devicetype == 'O' or devicetype == 'c' or devicetype == 'C':
|
||||||
print()
|
print()
|
||||||
print('Make sure the ssh service is running and properly configured.')
|
gpgpresent = str(input(
|
||||||
print()
|
'rpass requires the use of a unique gpg key. Do you already have one you are willing to use? (y/N) '))
|
||||||
if devicetype == 'c':
|
|
||||||
print()
|
|
||||||
gpgpresent = str(input('rpass requires the use of a unique gpg key. Do you already have one you are willing to '
|
|
||||||
'use? (y/N) '))
|
|
||||||
if gpgpresent == 'y' or gpgpresent == 'Y':
|
if gpgpresent == 'y' or gpgpresent == 'Y':
|
||||||
print()
|
print()
|
||||||
gpgid = str(input('Please input the ID of your gpg key: '))
|
gpgid = str(input('Please input the ID of your gpg key: '))
|
||||||
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
with open("/var/lib/rpass/rpass-gpg", 'w') as f:
|
||||||
f.write(gpgid + '\n')
|
f.write(gpgid + '\n')
|
||||||
if gpgpresent != 'y':
|
else:
|
||||||
print()
|
print()
|
||||||
gpggen = str(
|
gpggen = str(
|
||||||
input('Would you like to generate one now? Note that if you choose not to do this, you will have '
|
input('Would you like to generate one now? Note that if you choose not to do this, you will have '
|
||||||
'to re-run "rpass config" to specify a gpg key when you acquire one (Y/n) '))
|
'to re-run "rpass config" to specify a gpg key when you acquire one (Y/n) '))
|
||||||
if gpggen != 'n':
|
if gpggen == 'n' or gpggen == 'N':
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
term('gpg --full-generate-key')
|
term('gpg --full-generate-key')
|
||||||
print()
|
print()
|
||||||
gpgid = str(input('Please input the ID of your gpg key: '))
|
gpgid = str(input('Please input the ID of your gpg key: '))
|
||||||
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
with open("/var/lib/rpass/rpass-gpg", 'w') as f:
|
||||||
f.write(gpgid + '\n')
|
f.write(gpgid + '\n')
|
||||||
if gpggen == 'n' or gpggen == 'N':
|
if devicetype == 'o' or devicetype == 'O':
|
||||||
exit()
|
with open("/var/lib/rpass/rpass-ssh", 'w') as f:
|
||||||
print()
|
f.write('\n\n\n\n' + devicetype)
|
||||||
print('Make sure the ssh service on the remote server is running and properly configured.')
|
print('\nConfiguration complete!\n')
|
||||||
print()
|
elif devicetype != 's' and devicetype != 'S':
|
||||||
|
print('\nMake sure the ssh service on the remote server is running and properly configured.\n')
|
||||||
sshgen = str(input('rsync support requires a unique ssh key. Would you like to have this '
|
sshgen = str(input('rsync support requires a unique ssh key. Would you like to have this '
|
||||||
'automatically generated? (Y/n) '))
|
'automatically generated? (Y/n) '))
|
||||||
if sshgen != 'n':
|
if sshgen != 'n' and sshgen != 'N':
|
||||||
term('ssh-keygen -f ~/.ssh/rpass')
|
term('ssh-keygen -f ~/.ssh/rpass')
|
||||||
print()
|
print('\nExample input: 10.10.10.10:9999\n')
|
||||||
print('Example input: 10.10.10.10:9999')
|
|
||||||
print()
|
|
||||||
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
||||||
print()
|
print()
|
||||||
ip, sep, port = ip_port.partition(':')
|
ip, sep, port = ip_port.partition(':')
|
||||||
usernamessh = str(input('What is the username of the remote server? '))
|
usernamessh = str(input('What is the username of the remote server? '))
|
||||||
print()
|
print('\nDefault directory: ' + '/home/' + usernamessh + '/.rpass-store/\n')
|
||||||
print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/')
|
|
||||||
print()
|
|
||||||
directoryssh = str(input('Is the remote server using the default password directory? (Y/n) '))
|
directoryssh = str(input('Is the remote server using the default password directory? (Y/n) '))
|
||||||
if directoryssh != 'n':
|
|
||||||
directoryssh = ('/home/' + usernamessh + '/.rpass-store/')
|
|
||||||
if directoryssh == 'n' or directoryssh == 'N':
|
if directoryssh == 'n' or directoryssh == 'N':
|
||||||
print()
|
print('\nFormat: /this/path/ends/with/a/slash/\n')
|
||||||
print('Format: /this/path/ends/with/a/slash/')
|
|
||||||
print()
|
|
||||||
directoryssh = str(input('What directory is the server using?: '))
|
directoryssh = str(input('What directory is the server using?: '))
|
||||||
|
else:
|
||||||
|
directoryssh = ('/home/' + usernamessh + '/.rpass-store/')
|
||||||
with open("/var/lib/rpass/rpass-ssh", 'w') as f:
|
with open("/var/lib/rpass/rpass-ssh", 'w') as f:
|
||||||
f.write(usernamessh + '\n' + ip + '\n' + port + '\n' + directoryssh)
|
f.write(usernamessh + '\n' + ip + '\n' + port + '\n' + directoryssh + '\n' + devicetype)
|
||||||
print()
|
print('\nConfiguration complete!\n')
|
||||||
print('Configuration complete!')
|
except KeyboardInterrupt:
|
||||||
print()
|
print('\n\nConfiguration cancelled.\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
# startup help
|
||||||
|
|
||||||
|
if argument == '':
|
||||||
|
clear()
|
||||||
|
print("Use 'help', '--help', or '-h' to see a list of commands.\n")
|
||||||
|
print('rpass is currently early software with very little polish\n')
|
||||||
|
|
||||||
# import userdata
|
# import userdata
|
||||||
|
|
||||||
|
try:
|
||||||
sshinfo = open("/var/lib/rpass/rpass-ssh").readlines()
|
sshinfo = open("/var/lib/rpass/rpass-ssh").readlines()
|
||||||
usernamessh = sshinfo[0].replace('\n', '')
|
usernamessh = sshinfo[0].replace('\n', '')
|
||||||
ip = sshinfo[1].replace('\n', '')
|
ip = (sshinfo[1].replace('\n', ''))
|
||||||
port = sshinfo[2].replace('\n', '')
|
port = (sshinfo[2].replace('\n', ''))
|
||||||
directoryssh = sshinfo[3].replace('\n', '')
|
directoryssh = (sshinfo[3].replace('\n', ''))
|
||||||
with open("/var/lib/rpass/rpassgpg") as f:
|
devicetype = (sshinfo[4].replace('\n', ''))
|
||||||
|
except (FileNotFoundError, IndexError):
|
||||||
|
usernamessh, ip, port, directoryssh, devicetype = (0, 0, 0, 0, 0)
|
||||||
|
try:
|
||||||
|
with open("/var/lib/rpass/rpass-gpg") as f:
|
||||||
gpgid = f.read().strip()
|
gpgid = f.read().strip()
|
||||||
with open("/var/lib/rpass/rpassdir") as f:
|
with open("/var/lib/rpass/rpass-dir") as f:
|
||||||
directory = f.read().strip()
|
directory = f.read().strip()
|
||||||
term('mkdir -p ' + directory)
|
term('mkdir -p ' + directory)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print("Not all necessary configuration files are present. Please run 'rpass config'!")
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
# no argument
|
# no argument
|
||||||
|
|
||||||
if argument == '':
|
if argument == '':
|
||||||
|
try:
|
||||||
print()
|
print()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
readentry = str(input('Entry to read: '))
|
readentry = str(input('Entry to read: '))
|
||||||
clear()
|
clear()
|
||||||
term('gpg -d ' + directory + "'" + readentry.replace('/', '', 1) + "'" + '.gpg')
|
term('gpg -d ' + directory + "'" + readentry.replace('/', '', 1) + "'" + '.gpg')
|
||||||
print()
|
print()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n\nSelection cancelled.\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
# read shortcut
|
# read shortcut
|
||||||
|
|
||||||
@@ -256,20 +251,24 @@ if argument.startswith('/'):
|
|||||||
# add
|
# add
|
||||||
|
|
||||||
if argument == 'add':
|
if argument == 'add':
|
||||||
print()
|
print('\nUSAGE: rpass add [FLAG]')
|
||||||
print('USAGE: rpass add [FLAG]')
|
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('add:')
|
print('add:')
|
||||||
print(' password/-p add a password entry')
|
print(' password/-p add a password entry')
|
||||||
print(' note/-n add a note entry')
|
print(' note/-n add a note entry')
|
||||||
print(' folder/-f add a new folder for entries')
|
print(' folder/-f add a new folder for entries\n')
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'add note' or argument == 'add -n':
|
if argument == 'add note' or argument == 'add -n':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
entryname = str(input('Name of note: '))
|
entryname = str(input('Name of note: '))
|
||||||
notes = str(input('Contents of note: '))
|
notes = str(input('Contents of note: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, notes = (0, 0)
|
||||||
|
print('\n\nEntry add cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -287,15 +286,27 @@ if argument == 'add note' or argument == 'add -n':
|
|||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
f.writelines('\n\n\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The folder you requested to access does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'add password' or argument == 'add -p':
|
if argument == 'add password' or argument == 'add -p':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
entryname = str(input('Name of service: '))
|
entryname = str(input('Name of service: '))
|
||||||
username = str(input('Username: '))
|
username = str(input('Username: '))
|
||||||
password = str(input('Password: '))
|
password = str(input('Password: '))
|
||||||
url = str(input('URL: '))
|
url = str(input('URL: '))
|
||||||
notes = str(input('Additional notes: '))
|
notes = str(input('Additional notes: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, username, password, url, notes = (0, 0, 0, 0, 0)
|
||||||
|
print('\n\nEntry add cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -313,6 +324,12 @@ if argument == 'add password' or argument == 'add -p':
|
|||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The folder you requested to access does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'add folder' or argument == 'add -f':
|
if argument == 'add folder' or argument == 'add -f':
|
||||||
newfolder = str(input('Name of new folder: '))
|
newfolder = str(input('Name of new folder: '))
|
||||||
@@ -321,20 +338,19 @@ if argument == 'add folder' or argument == 'add -f':
|
|||||||
# edit
|
# edit
|
||||||
|
|
||||||
if argument == 'edit':
|
if argument == 'edit':
|
||||||
print()
|
print('\nUSAGE: rpass edit [FLAG]')
|
||||||
print('USAGE: rpass edit [FLAG]')
|
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('edit:')
|
print('edit:')
|
||||||
print(' rename/relocate/-r rename or relocate an entry')
|
print(' rename/relocate/-r rename or relocate an entry')
|
||||||
print(' username/-u change the username of an entry')
|
print(' username/-u change the username of an entry')
|
||||||
print(' password/-p change the password of an entry')
|
print(' password/-p change the password of an entry')
|
||||||
print(' url/-l change the url attached to an entry')
|
print(' url/-l change the url attached to an entry')
|
||||||
print(' note/-n change the note attached to an entry')
|
print(' note/-n change the note attached to an entry\n')
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit -r':
|
if argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit -r':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('What file would you like to edit? '))
|
entryname = str(input('What file would you like to edit? '))
|
||||||
newname = str(input('New Name: '))
|
newname = str(input('New Name: '))
|
||||||
@@ -343,17 +359,32 @@ if argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit
|
|||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
move(directory + folder + '/' + folderentry + '.gpg', directory + '/' + newname + '.gpg')
|
move(directory + folder + '/' + folderentry + '.gpg', directory + '/' + newname + '.gpg')
|
||||||
else:
|
else:
|
||||||
move(directory + entryname.replace('/', '', 1) + '.gpg', directory + newname.replace('/', '', 1) + '.gpg')
|
move(directory + entryname.replace('/', '', 1) + '.gpg',
|
||||||
|
directory + newname.replace('/', '', 1) + '.gpg')
|
||||||
else:
|
else:
|
||||||
move(directory + entryname + '.gpg', directory + newname + '.gpg')
|
move(directory + entryname + '.gpg', directory + newname + '.gpg')
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'edit username' or argument == 'edit -u':
|
if argument == 'edit username' or argument == 'edit -u':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('What file would you like to edit? '))
|
entryname = str(input('What file would you like to edit? '))
|
||||||
username = str(input('New Username: '))
|
username = str(input('New Username: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, username = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -376,14 +407,26 @@ if argument == 'edit username' or argument == 'edit -u':
|
|||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'edit password' or argument == 'edit -p':
|
if argument == 'edit password' or argument == 'edit -p':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('What file would you like to edit? '))
|
entryname = str(input('What file would you like to edit? '))
|
||||||
password = str(input('New Password: '))
|
password = str(input('New Password: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, password = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -406,14 +449,26 @@ if argument == 'edit password' or argument == 'edit -p':
|
|||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'edit url' or argument == 'edit -l':
|
if argument == 'edit url' or argument == 'edit -l':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('What file would you like to edit? '))
|
entryname = str(input('What file would you like to edit? '))
|
||||||
url = str(input('New URL: '))
|
url = str(input('New URL: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, url = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -436,14 +491,26 @@ if argument == 'edit url' or argument == 'edit -l':
|
|||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'edit note' or argument == 'edit -n':
|
if argument == 'edit note' or argument == 'edit -n':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('What file would you like to edit? '))
|
entryname = str(input('What file would you like to edit? '))
|
||||||
notes = str(input('New Note: '))
|
notes = str(input('New Note: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, notes = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -466,26 +533,36 @@ if argument == 'edit note' or argument == 'edit -n':
|
|||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
|
|
||||||
if argument == 'copy':
|
if argument == 'copy':
|
||||||
print()
|
print('\nUSAGE: rpass copy [FLAG]')
|
||||||
print('USAGE: rpass copy [FLAG]')
|
|
||||||
print('Flags:')
|
print('Flags:')
|
||||||
print('copy:')
|
print('copy:')
|
||||||
print(' username/-u copy the username of an entry to your clipboard')
|
print(' username/-u copy the username of an entry to your clipboard')
|
||||||
print(' password/-p copy the password of an entry to your clipboard')
|
print(' password/-p copy the password of an entry to your clipboard')
|
||||||
print(' url/-l copy the URL of an entry to your clipboard')
|
print(' url/-l copy the URL of an entry to your clipboard')
|
||||||
print(' note/-n copy the note of an entry to your clipboard')
|
print(' note/-n copy the note of an entry to your clipboard\n')
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'copy username' or argument == 'copy -u':
|
if argument == 'copy username' or argument == 'copy -u':
|
||||||
|
try:
|
||||||
print()
|
print()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
readentry = str(input('Entry to copy: '))
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
@@ -493,13 +570,25 @@ if argument == 'copy username' or argument == 'copy -u':
|
|||||||
else:
|
else:
|
||||||
term('echo -n ' + "'" + copyline[0].replace('\n', '') + "'" + ' | xclip -sel c')
|
term('echo -n ' + "'" + copyline[0].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
rmtree('/dev/shm/' + shmfolder)
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'copy password' or argument == 'copy -p':
|
if argument == 'copy password' or argument == 'copy -p':
|
||||||
|
try:
|
||||||
print()
|
print()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
readentry = str(input('Entry to copy: '))
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
@@ -507,13 +596,25 @@ if argument == 'copy password' or argument == 'copy -p':
|
|||||||
else:
|
else:
|
||||||
term('echo -n ' + "'" + copyline[1].replace('\n', '') + "'" + ' | xclip -sel c')
|
term('echo -n ' + "'" + copyline[1].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
rmtree('/dev/shm/' + shmfolder)
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'copy url' or argument == 'copy -l':
|
if argument == 'copy url' or argument == 'copy -l':
|
||||||
|
try:
|
||||||
print()
|
print()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
readentry = str(input('Entry to copy: '))
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
@@ -521,13 +622,25 @@ if argument == 'copy url' or argument == 'copy -l':
|
|||||||
else:
|
else:
|
||||||
term('echo -n ' + "'" + copyline[2].replace('\n', '') + "'" + ' | xclip -sel c')
|
term('echo -n ' + "'" + copyline[2].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
rmtree('/dev/shm/' + shmfolder)
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'copy note' or argument == 'copy -n':
|
if argument == 'copy note' or argument == 'copy -n':
|
||||||
|
try:
|
||||||
print()
|
print()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
readentry = str(input('Entry to copy: '))
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
@@ -535,10 +648,17 @@ if argument == 'copy note' or argument == 'copy -n':
|
|||||||
else:
|
else:
|
||||||
term('echo -n ' + "'" + copyline[3].replace('\n', '') + "'" + ' | xclip -sel c')
|
term('echo -n ' + "'" + copyline[3].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
rmtree('/dev/shm/' + shmfolder)
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
# gen
|
# gen
|
||||||
|
|
||||||
if argument == 'gen':
|
if argument == 'gen':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
entryname = str(input('Name of service: '))
|
entryname = str(input('Name of service: '))
|
||||||
username = str(input('Username: '))
|
username = str(input('Username: '))
|
||||||
@@ -551,7 +671,12 @@ if argument == 'gen':
|
|||||||
passgen = ''.join(random.SystemRandom().choice(passtype) for _ in range(passlength))
|
passgen = ''.join(random.SystemRandom().choice(passtype) for _ in range(passlength))
|
||||||
url = str(input('URL: '))
|
url = str(input('URL: '))
|
||||||
notes = str(input('Additional notes: '))
|
notes = str(input('Additional notes: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, username, passgen, url, notes = (0, 0, 0, 0, 0)
|
||||||
|
print('\n\nEntry generation cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
@@ -569,15 +694,27 @@ if argument == 'gen':
|
|||||||
f.writelines(username + '\n' + passgen + '\n' + url + '\n' + notes + '\n\n')
|
f.writelines(username + '\n' + passgen + '\n' + url + '\n' + notes + '\n\n')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The folder you requested to access does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
if argument == 'gen update' or argument == 'gen -u':
|
if argument == 'gen update' or argument == 'gen -u':
|
||||||
|
try:
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
entryname = str(input('Which password would you like to re-generate? '))
|
entryname = str(input('Which password would you like to re-generate? '))
|
||||||
passlength = int(input('How many characters should be in the password? '))
|
passlength = int(input('How many characters should be in the password? '))
|
||||||
passtype = str(input('Should the password be simple (for compatibility) or complex (for security)? (s/C) '))
|
passtype = str(input('Should the password be simple (for compatibility) or complex (for security)? (s/C) '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, passlength, passtype = (0, 0, 0)
|
||||||
|
print('\n\nEntry generation cancelled.\n')
|
||||||
|
exit()
|
||||||
shmfolder, shmentry = shmgen()
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
if passtype != 's':
|
if passtype != 's':
|
||||||
passtype = string.ascii_letters + string.digits + string.punctuation
|
passtype = string.ascii_letters + string.digits + string.punctuation
|
||||||
if passtype == 's':
|
if passtype == 's':
|
||||||
@@ -605,27 +742,57 @@ if argument == 'gen update' or argument == 'gen -u':
|
|||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
encrypt()
|
encrypt()
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to edit does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
exit()
|
||||||
|
|
||||||
# remove
|
# remove
|
||||||
|
|
||||||
if argument == 'remove' or argument == '-rm':
|
if argument == 'remove' or argument == '-rm':
|
||||||
clear()
|
clear()
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
term('cd ' + directory + '; ls -1 *')
|
||||||
print()
|
print()
|
||||||
|
try:
|
||||||
entryname = str(input('What would you like to delete? '))
|
entryname = str(input('What would you like to delete? '))
|
||||||
if entryname.startswith('/'):
|
if entryname.startswith('/'):
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname
|
if devicetype == 'c' or devicetype == 'C':
|
||||||
.replace('/', '', 1) + '.gpg')
|
term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
else:
|
else:
|
||||||
term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname
|
if devicetype == 'c' or devicetype == 'C':
|
||||||
.replace('/', '', 1))
|
term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" +
|
||||||
|
entryname.replace('/', '', 1))
|
||||||
rmtree(directory + entryname.replace('/', '', 1))
|
rmtree(directory + entryname.replace('/', '', 1))
|
||||||
else:
|
else:
|
||||||
term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname +
|
if devicetype == 'c' or devicetype == 'C':
|
||||||
'.gpg')
|
term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" +
|
||||||
|
entryname + '.gpg')
|
||||||
remove(directory + entryname + '.gpg')
|
remove(directory + entryname + '.gpg')
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n\nDeletion cancelled.\n')
|
||||||
|
exit()
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print('The file you requested to delete does not exist!')
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if argument.__contains__('add') or argument.__contains__('-rm') or argument.__contains__('remove') or argument.\
|
||||||
|
__contains__('edit') or argument.__contains__('gen') or argument.__contains__('version') or argument.\
|
||||||
|
__contains__('-v') or argument.__contains__('config') or argument.__contains__('copy') or argument.\
|
||||||
|
__contains__('show') or argument.__contains__('/') or argument == 'sync' or argument == '-s' or argument == '' \
|
||||||
|
or argument == 'help' or argument == '--help' or argument == '-h':
|
||||||
|
null = 'null'
|
||||||
|
else:
|
||||||
|
print('\n!!!!!!!!!!!!!!!')
|
||||||
|
print('Argument error!')
|
||||||
|
print('!!!!!!!!!!!!!!!')
|
||||||
|
print("\nUse 'help', '--help', or '-h' to see a list of commands.\n")
|
||||||
|
|
||||||
# permissions - applied pre-sync to ensure permissions are correct before upload
|
# permissions - applied pre-sync to ensure permissions are correct before upload
|
||||||
|
|
||||||
@@ -633,9 +800,10 @@ term('find ' + directory + ' -type d -exec chmod -R 700 {} +')
|
|||||||
term('find ' + directory + ' -type f -exec chmod -R 600 {} +')
|
term('find ' + directory + ' -type f -exec chmod -R 600 {} +')
|
||||||
|
|
||||||
# rsync - ran at end of program to ensure all files are properly synced
|
# rsync - ran at end of program to ensure all files are properly synced
|
||||||
|
if devicetype == 'c' or devicetype == 'C':
|
||||||
if argument.__contains__('add') or argument.__contains__('-rm') or argument.__contains__('remove') or argument. \
|
if argument.__contains__('add') or argument.__contains__('-rm') or argument.__contains__('remove') or argument. \
|
||||||
__contains__('edit') or argument.__contains__('gen') or argument == 'sync' or argument == '-s':
|
__contains__('edit') or argument.__contains__('gen') or argument == 'sync' or argument == '-s':
|
||||||
|
print('Syncing entries with other device(s)...\n')
|
||||||
term('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + directory + ' ' + usernamessh
|
term('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + directory + ' ' + usernamessh
|
||||||
+ '@' + ip + ':' + directoryssh)
|
+ '@' + ip + ':' + directoryssh)
|
||||||
term('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + usernamessh
|
term('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + usernamessh
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
rpass-2021.09.14.pr4
|
rpass-2021.09.15.pr4
|
||||||
|
|
||||||
The Housekeeping Update (Pt. 1) - Fourth public release of rpass
|
The Housekeeping Update (Pt. 1) - Fourth public release of rpass
|
||||||
|
|
||||||
@@ -10,36 +10,36 @@ making any major changes in the future.
|
|||||||
New features:
|
New features:
|
||||||
|
|
||||||
- added clipboard support for copying entry information
|
- added clipboard support for copying entry information
|
||||||
**overhaul error messages using exceptions
|
- many common errors are now handled with proper exceptions
|
||||||
**add exceptions for unknown arguments
|
- offline support (sync no longer needs to be configured for rpass to function)
|
||||||
**make clean, colorful file list by exporting to document and removing extensions
|
|
||||||
**make a manpage
|
|
||||||
**multi-line notes?
|
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
- fixed gpg decryption warnings
|
- fixed gpg decryption warnings
|
||||||
- added version info argument
|
- added version info argument
|
||||||
- re-ordered config wizard for better rsync support
|
- re-ordered config wizard to make more sense
|
||||||
- optimized code for random string generation in /dev/shm
|
|
||||||
- entry deletion can now be done client-side
|
- entry deletion can now be done client-side
|
||||||
- removed rsyncup/rsyncdown/username/ip/port/directoryssh files,
|
- removed rsyncup/rsyncdown/username/ip/port/directoryssh files,
|
||||||
^ replaced with one file that holds usernamessh, ip, port, and directoryssh
|
^ replaced with one file that holds usernamessh, ip, port, directoryssh, and devcetype
|
||||||
**optimize code for when there is no folder but there is a slash)
|
- files should no longer be left in /dev/shm when an error is encountered
|
||||||
**properly comment the code
|
- fixed issues relating to using a non-default entry directory
|
||||||
**validate for Python 3.10
|
- lots of optimizations have been made to reduce the size of rpass
|
||||||
**do a better job at clearing /dev/shm
|
|
||||||
|
|
||||||
Planned for next update (The Secret Update):
|
Planned for next update (The Housekeeping Update Pt. 2):
|
||||||
|
|
||||||
- allow to function as alternative to gnome keyring (libsecret integration)
|
- a clean, colorful entry list w/o file extensions
|
||||||
|
- manpage
|
||||||
|
- multi-line notes
|
||||||
|
- commented the code
|
||||||
|
- ability to pass entries as arguments for more functions
|
||||||
|
- improve exceptions for unknown arguments
|
||||||
|
|
||||||
Planned, no timeline:
|
Planned, no timeline:
|
||||||
|
|
||||||
- create separate gui frontend targetting mobile devices (first linux phones, maybe android at a later date - official iOS client not likely)
|
- possible libsecret integration
|
||||||
|
- create separate gui frontend targetting mobile devices (first Linux phones, maybe Android at a later date - official iOS client not likely)
|
||||||
^ the gui will also function on desktop linux
|
^ the gui will also function on desktop linux
|
||||||
- make platform agnostic (add windows support and package for more Linux distributions)
|
- make platform agnostic (add Windows support and package for more Linux distributions)
|
||||||
- ability to pass entries as arguments for more functions
|
|
||||||
- auto-completion on tab (currently unsure of best way to make this work)
|
- auto-completion on tab (currently unsure of best way to make this work)
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|||||||
Reference in New Issue
Block a user