mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 08:37:14 -04:00
Compare commits
65
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8611ab9fd | ||
|
|
9a2986ab21 | ||
|
|
a81f892c4c | ||
|
|
aa9dd11793 | ||
|
|
c1da61bee5 | ||
|
|
c34898b325 | ||
|
|
621db67d34 | ||
|
|
3045a97f4c | ||
|
|
844c751957 | ||
|
|
be9d621c62 | ||
|
|
850aa60ba5 | ||
|
|
da4e229208 | ||
|
|
55b07eb8f6 | ||
|
|
96161e870d | ||
|
|
8c557ee290 | ||
|
|
59be7d7602 | ||
|
|
b60efd86d6 | ||
|
|
18b27c9dce | ||
|
|
6cdc158074 | ||
|
|
2911087b40 | ||
|
|
f7c0e81f02 | ||
|
|
02059d367c | ||
|
|
91dcd4585a | ||
|
|
4cefccf4c6 | ||
|
|
ea117c2cb5 | ||
|
|
0a74d36845 | ||
|
|
2bf1859bc7 | ||
|
|
e1e7254fc1 | ||
|
|
338af44841 | ||
|
|
5aa22c82fc | ||
|
|
9e8c580bb7 | ||
|
|
864caffbca | ||
|
|
f82f3c78a0 | ||
|
|
17812d5ca4 | ||
|
|
5df1ae30a4 | ||
|
|
366c76d683 | ||
|
|
2f3807294a | ||
|
|
c455a9a7fb | ||
|
|
691aaab634 | ||
|
|
0365c17a34 | ||
|
|
87502ceb22 | ||
|
|
330fa5f89e | ||
|
|
11550f114e | ||
|
|
e8412405e6 | ||
|
|
0340848447 | ||
|
|
1bdef1382f | ||
|
|
e9bbc48c14 | ||
|
|
6be6d75000 | ||
|
|
254aca0839 | ||
|
|
3da92ff20b | ||
|
|
ca0cf57ffe | ||
|
|
72f36c5046 | ||
|
|
c253c5e2b7 | ||
|
|
5c457e4ec0 | ||
|
|
f06684798d | ||
|
|
04dbd0624f | ||
|
|
9e2aa21ab2 | ||
|
|
865841f1cd | ||
|
|
98b6d40c19 | ||
|
|
ae6726bb3c | ||
|
|
5a78902700 | ||
|
|
ab815a1b77 | ||
|
|
4c625bb978 | ||
|
|
9f824ab72d | ||
|
|
61026d0c28 |
@@ -1,15 +0,0 @@
|
|||||||
pkgbase = rpass
|
|
||||||
pkgdesc = An rsync-based password manager and alternative to GNU pass
|
|
||||||
pkgver = 2021.09.07.pr3.1
|
|
||||||
pkgrel = 1
|
|
||||||
arch = x86_64
|
|
||||||
arch = aarch64
|
|
||||||
license = GPL3
|
|
||||||
depends = python
|
|
||||||
depends = gnupg
|
|
||||||
depends = openssh
|
|
||||||
depends = rsync
|
|
||||||
source = https://cloud.watergateserver.xyz/api/public/dl/6b0Wqz-J
|
|
||||||
sha512sums = f59cd1cd3c981b9424fba85bfd5e7b33e26a482d48b9b47a77be6f8e7cecbf078ec956a46b37db488d5173cd0a439f572ff06fc7d35cc3e9b0a7666e49cadeee
|
|
||||||
|
|
||||||
pkgname = rpass
|
|
||||||
@@ -1,21 +1,22 @@
|
|||||||
# Maintainer: Randall Winkhart (Cuan) <idgr at tutanota dot com>
|
# Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
||||||
|
|
||||||
pkgname=rpass
|
pkgname=sshyp
|
||||||
pkgver=2021.09.07.pr3.1
|
pkgver=2021.11.05.fr1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="An rsync-based password manager and alternative to GNU pass"
|
pkgdesc='A self-hosted, synchronized password manager'
|
||||||
|
url='https://github.com/rwinkhart/sshyp'
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
depends=( python gnupg openssh rsync )
|
depends=( python gnupg openssh nano xclip wl-clipboard)
|
||||||
|
|
||||||
source=('https://cloud.watergateserver.xyz/api/public/dl/6b0Wqz-J')
|
source_x86_64=('https://github.com/rwinkhart/sshyp/releases/download/v2021.11.05.fr1/sshyp-2021.11.05.fr1.tar.xz')
|
||||||
sha512sums=('f59cd1cd3c981b9424fba85bfd5e7b33e26a482d48b9b47a77be6f8e7cecbf078ec956a46b37db488d5173cd0a439f572ff06fc7d35cc3e9b0a7666e49cadeee')
|
source_aarch64=('https://github.com/rwinkhart/sshyp/releases/download/v2021.11.05.fr1/sshyp-2021.11.05.fr1.tar.xz')
|
||||||
|
sha512sums_x86_64=('dcc2fe2e751120ffed86cad5f170bdf6ba4ef96df4c4cc784496289c7fda1ccef5ded030ce20f4ea6571a0def5bc185037b39f0958958a1aadb1ead63291b879')
|
||||||
|
sha512sums_aarch64=('dcc2fe2e751120ffed86cad5f170bdf6ba4ef96df4c4cc784496289c7fda1ccef5ded030ce20f4ea6571a0def5bc185037b39f0958958a1aadb1ead63291b879')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
|
||||||
mv 6b0Wqz-J rpass-2021.09.07.pr3.1.tar.xz
|
tar xf sshyp-"$pkgver".tar.xz -C "${pkgdir}"
|
||||||
tar xf rpass-2021.09.07.pr3.1.tar.xz -C "${pkgdir}"
|
chown -R "$USER" ${pkgdir}/var/lib/sshyp
|
||||||
chown -R "$USER" ${pkgdir}/var/lib/rpass
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,82 @@
|
|||||||
# rpass
|
# sshyp
|
||||||
A password manager with rsync integration - alternative to GNU pass
|
A very simple self-hosted, synchronized password manager. Alternative to GNU pass.
|
||||||
|
|
||||||
|
"sshyp" stands for "sshync passwords", or "ssh sync passwords".
|
||||||
|
"sshync" is the custom syncing backend (based on sftp) used by "sshyp".
|
||||||
|
|
||||||
|
# WARNING
|
||||||
|
It is your responsibility to assess the security and stability of "sshyp" before using it and ensure it meets your needs.
|
||||||
|
I am not responsible for any data loss or breaches of your information resulting from the use of "sshyp".
|
||||||
|
"sshyp" is a new project that is constantly being updated, and though safety and security are priorities, they cannot be guaranteed.
|
||||||
|
|
||||||
|
# Mission Statement
|
||||||
|
sshyp aims to make it as simple as possible to manage passwords and notes via CLI across multiple devices in a secure, self-hosted fashion.
|
||||||
|
|
||||||
|
What sshyp can do:
|
||||||
|
|
||||||
|
- securely manage a collection of encrypted passwords and notes via CLI
|
||||||
|
- generate new, secure passwords to the user's choice in length and complexity
|
||||||
|
- securely sync said passwords and notes seamlessly between multiple POSIX compliant Unix devices
|
||||||
|
|
||||||
|
What sshyp will do:
|
||||||
|
|
||||||
|
- everything it already does, but also in a GUI for Linux/Android
|
||||||
|
- have a distinct retro theme
|
||||||
|
- receive many usability enhancements
|
||||||
|
|
||||||
|
What sshyp definitely won't do:
|
||||||
|
|
||||||
|
- 2FA/MFA (for security purposes, this should not be handled by your password manager)
|
||||||
|
- Windows support (I don't use Windows and I have no interest in developing for it)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
Arch Linux (x86_64, aarch64)
|
Arch Linux (x86_64, aarch64)
|
||||||
|
|
||||||
rpass is available in the Arch User Repository as 'rpass'.
|
Note: currently unavailable in the AUR (the older version, "rpass", will remain available until sshyp is stable)
|
||||||
|
|
||||||
|
sshyp releases will be available in the Arch User Repository as 'sshyp'.
|
||||||
|
|
||||||
Install with your preferred AUR helper or use:
|
Install with your preferred AUR helper or use:
|
||||||
|
|
||||||
git clone https://aur.archlinux.org/rpass.git
|
```
|
||||||
cd rpass
|
git clone https://aur.archlinux.org/sshyp.git
|
||||||
|
cd sshyp
|
||||||
makepkg -si
|
makepkg -si
|
||||||
|
```
|
||||||
|
|
||||||
|
Packaging for other distributions coming soon.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
Upon initial installation, be sure to run:
|
||||||
|
|
||||||
|
```
|
||||||
|
sshyp config
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will allow you to configure the settings necessary for sshyp to function.
|
||||||
|
As of right now, sshyp is rapidly changing, and as such, it is a good idea to run "sshyp config" after each update.
|
||||||
|
|
||||||
|
All available options can be found with:
|
||||||
|
|
||||||
|
```
|
||||||
|
sshyp --help
|
||||||
|
```
|
||||||
|
|
||||||
|
# Roadmap
|
||||||
|
Short-term Goals:
|
||||||
|
|
||||||
|
- re-write bad, leftover "rpass" code
|
||||||
|
- create new file list w/color and w/o file extensions
|
||||||
|
- create a man page
|
||||||
|
- overhaul argument system
|
||||||
|
- fix lots of bugs!
|
||||||
|
- make lots of optimizations!
|
||||||
|
|
||||||
|
Medium-term Goals:
|
||||||
|
|
||||||
|
- create minimal GUI apps (Linux x86_64, Linux aarch64, Android aarch64)
|
||||||
|
- auto-completion on tab for CLI version
|
||||||
|
|
||||||
|
Long-term Goals:
|
||||||
|
|
||||||
|
- seize the thrones, shear the humans
|
||||||
|
|||||||
Executable
+216
@@ -0,0 +1,216 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# Main Targets:
|
||||||
|
# TODO Make it so that when a new folder is created in sshyp, it is automatically created on the remote server
|
||||||
|
# TODO Replace references to sshyp directory with a changeable variable
|
||||||
|
# TODO Clean everything up and move sshync to a separate package
|
||||||
|
# TODO Add dry run support
|
||||||
|
# TODO use partition command instead of split for separating paths
|
||||||
|
# TODO use classes!
|
||||||
|
|
||||||
|
# sshync 2021.11.05.unreleased5
|
||||||
|
# sshync was created to solve a problem with rpass/sshyp, and as such, sshync will be bundled with sshyp until it is
|
||||||
|
# polished enough for a standalone release
|
||||||
|
|
||||||
|
# sshync is a wrapper around sftp that allows easy remote directory synchronization via Python
|
||||||
|
# openssh (on POSIX compliant Unix) is required
|
||||||
|
|
||||||
|
# sshync will always overwrite the older files with the newer files, regardless of all other conditions
|
||||||
|
# ^the age is determined by the date and time of the last modification to the files
|
||||||
|
|
||||||
|
# syncing via sshync is always done recursively
|
||||||
|
|
||||||
|
# external modules
|
||||||
|
|
||||||
|
from os import walk
|
||||||
|
from os import system as term
|
||||||
|
from os.path import getmtime
|
||||||
|
from os.path import join as path_join
|
||||||
|
|
||||||
|
|
||||||
|
# internal modules
|
||||||
|
|
||||||
|
|
||||||
|
# recursively scans a local directory for all files and saves file paths and mod times to lists
|
||||||
|
def get_file_paths_mod(directory, name_database, time_database):
|
||||||
|
file_paths = []
|
||||||
|
temp_mod_times = []
|
||||||
|
mod_times = []
|
||||||
|
for root, directories, files in walk(directory):
|
||||||
|
for filename in files:
|
||||||
|
filepath = path_join(root, filename)
|
||||||
|
file_paths.append(filepath)
|
||||||
|
temp_mod_times.append(str(getmtime(filepath)))
|
||||||
|
for time in temp_mod_times:
|
||||||
|
mod_times.append(round(float(time), 2))
|
||||||
|
open(name_database, 'w').write(str(file_paths))
|
||||||
|
open(time_database, 'w').write(str(mod_times))
|
||||||
|
return file_paths, mod_times
|
||||||
|
|
||||||
|
|
||||||
|
# recursively scans a remote directory for all files and saves file paths and mod times to lists
|
||||||
|
def get_file_paths_mod_remote(profile_dir):
|
||||||
|
# import profile data
|
||||||
|
profile_data = get_profile(profile_dir)
|
||||||
|
user = profile_data[0].replace('\n', '')
|
||||||
|
ip = profile_data[1].replace('\n', '')
|
||||||
|
port = profile_data[2].replace('\n', '')
|
||||||
|
remote_dir = profile_data[4].replace('\n', '')
|
||||||
|
identity = profile_data[5].replace('\n', '')
|
||||||
|
term("ssh -i " + "'" + identity + "'" + " -p " + port + " " + user + "@" + ip + " \"python -c \'import sshync; "
|
||||||
|
"sshync.get_file_paths_mod(" +
|
||||||
|
"\"'\"" + remote_dir + "/\"'\", " + "\"'\"/var/lib/sshyp/sshyncdatabase_names\"'\", " +
|
||||||
|
"\"'\"/var/lib/sshyp/sshyncdatabase_times\"'\")\'\"")
|
||||||
|
term(
|
||||||
|
'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/sshyp/sshyncdatabase_names ' +
|
||||||
|
'/var/lib/sshyp/sshyncdatabase_names')
|
||||||
|
term(
|
||||||
|
'sftp -P ' + port + ' ' + user + '@' + ip + ':/var/lib/sshyp/sshyncdatabase_times ' +
|
||||||
|
'/var/lib/sshyp/sshyncdatabase_times')
|
||||||
|
remote_mod_names = (open('/var/lib/sshyp/sshyncdatabase_names').read()).replace('[', '').replace(']', '').replace(
|
||||||
|
' ', '').replace("'", '').split(',')
|
||||||
|
remote_mod_times = (open('/var/lib/sshyp/sshyncdatabase_times').read()).replace('[', '').replace(']', '').replace(
|
||||||
|
' ', '').replace("'", '').split(',')
|
||||||
|
return remote_mod_names, remote_mod_times
|
||||||
|
|
||||||
|
|
||||||
|
# regular profiles check the mod time of every individual file in the directory, making them slow but versatile
|
||||||
|
def make_profile(profile_dir, local_dir, remote_dir, identity, ip, port, user):
|
||||||
|
open(profile_dir, 'w').write(user + '\n' + ip + '\n' + port + '\n' + local_dir + '\n' + remote_dir + '\n' + identity
|
||||||
|
+ '\n')
|
||||||
|
|
||||||
|
|
||||||
|
# returns the settings for a specified profile
|
||||||
|
def get_profile(profile_dir):
|
||||||
|
try:
|
||||||
|
profile_data = open(profile_dir).readlines()
|
||||||
|
except (FileNotFoundError, IndexError):
|
||||||
|
profile_data = 0
|
||||||
|
return profile_data
|
||||||
|
|
||||||
|
|
||||||
|
# sorts name lists so that local and remote are in the same order
|
||||||
|
def name_sort(local_names, remote_names):
|
||||||
|
remote_names_new = []
|
||||||
|
for ele in local_names:
|
||||||
|
if ele in remote_names:
|
||||||
|
remote_names_new.append(ele)
|
||||||
|
for ele in remote_names:
|
||||||
|
if ele not in remote_names_new:
|
||||||
|
remote_names_new.append(ele)
|
||||||
|
return remote_names_new
|
||||||
|
|
||||||
|
|
||||||
|
# sorts time lists to compensate for name list re-ordering
|
||||||
|
def time_sort(old_names, new_names, old_times):
|
||||||
|
remote_mod_times_new = []
|
||||||
|
new_pos = -1
|
||||||
|
for title in new_names:
|
||||||
|
new_pos += 1
|
||||||
|
if title in old_names:
|
||||||
|
old_pos = old_names.index(title)
|
||||||
|
try:
|
||||||
|
remote_mod_times_new.append(old_times[old_pos])
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
return remote_mod_times_new
|
||||||
|
|
||||||
|
|
||||||
|
getter_loop_count = -1
|
||||||
|
|
||||||
|
|
||||||
|
def loop_getter(split_remote_dir):
|
||||||
|
global getter_loop_count
|
||||||
|
getter_loop_count += 1
|
||||||
|
new_var = split_remote_dir[getter_loop_count] + '/'
|
||||||
|
return new_var
|
||||||
|
|
||||||
|
|
||||||
|
def run_profile(profile_dir):
|
||||||
|
# import profile data
|
||||||
|
profile_data = get_profile(profile_dir)
|
||||||
|
user = profile_data[0].replace('\n', '')
|
||||||
|
ip = profile_data[1].replace('\n', '')
|
||||||
|
port = profile_data[2].replace('\n', '')
|
||||||
|
local_dir = profile_data[3].replace('\n', '')
|
||||||
|
remote_dir = profile_data[4].replace('\n', '')
|
||||||
|
identity = profile_data[5].replace('\n', '')
|
||||||
|
# get file modification times
|
||||||
|
local_mod_names, local_mod_times = get_file_paths_mod(local_dir + '/', '/var/lib/sshyp/sshyncdatabase_names',
|
||||||
|
'/var/lib/sshyp/sshyncdatabase_times')
|
||||||
|
remote_mod_times = []
|
||||||
|
remote_mod_names, remote_mod_times_temp = get_file_paths_mod_remote('/var/lib/sshyp/sshyp.sshync')
|
||||||
|
try:
|
||||||
|
for time in remote_mod_times_temp: # remove quotes from remote_mod_times
|
||||||
|
remote_mod_times.append(float(time))
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
lmod_short = []
|
||||||
|
rmod_short = []
|
||||||
|
matching_names = []
|
||||||
|
matching_times_local = []
|
||||||
|
matching_times_remote = []
|
||||||
|
for lmod in local_mod_names:
|
||||||
|
lmod_short.append(lmod.replace(local_dir, ''))
|
||||||
|
for rmod in remote_mod_names:
|
||||||
|
rmod_short.append(rmod.replace(remote_dir, ''))
|
||||||
|
rmod_short_old = rmod_short
|
||||||
|
rmod_short = name_sort(lmod_short, rmod_short)
|
||||||
|
remote_mod_times = time_sort(rmod_short_old, rmod_short, remote_mod_times)
|
||||||
|
i = -1
|
||||||
|
for lshort in lmod_short:
|
||||||
|
i += 1
|
||||||
|
if lshort in rmod_short:
|
||||||
|
matching_names.append(lshort)
|
||||||
|
matching_times_local.append(local_mod_times[i])
|
||||||
|
else:
|
||||||
|
print('Uploading ' + lshort)
|
||||||
|
lshort_split = lshort.replace('/', '', 1).split('/')
|
||||||
|
|
||||||
|
c = -1
|
||||||
|
for _ in lshort_split:
|
||||||
|
c += 1
|
||||||
|
|
||||||
|
global getter_loop_count
|
||||||
|
getter_loop_count = -1
|
||||||
|
q = ''
|
||||||
|
for _ in range(c):
|
||||||
|
q += loop_getter(lshort_split)
|
||||||
|
|
||||||
|
term('sftp -p -i ' + "'" + identity + "' " + '-P ' + port + ' ' + user + '@' + ip + ':' + remote_dir + q +
|
||||||
|
" <<< $'put " + local_dir + lshort.replace('/', '', 1) + "'")
|
||||||
|
i = -1
|
||||||
|
for rshort in rmod_short:
|
||||||
|
i += 1
|
||||||
|
if rshort in lmod_short:
|
||||||
|
matching_times_remote.append(float(remote_mod_times[i]))
|
||||||
|
else:
|
||||||
|
print('Downloading ' + rshort)
|
||||||
|
term('sftp -p -i ' + "'" + identity + "' " + '-P ' + port + ' ' + user + '@' + ip + ':' + remote_dir +
|
||||||
|
rshort.replace('/', '', 1) + ' ' + local_dir + rshort.replace('/', '', 1))
|
||||||
|
i = -1
|
||||||
|
for ltime in matching_times_local:
|
||||||
|
i += 1
|
||||||
|
ltime = int(ltime)
|
||||||
|
if ltime == int(matching_times_remote[i]):
|
||||||
|
print('Local ' + matching_names[i] + ' is up to date, not syncing.')
|
||||||
|
elif ltime > int(matching_times_remote[i]):
|
||||||
|
print('Local ' + matching_names[i] + ' is newer, uploading.')
|
||||||
|
matching_names_split = matching_names[i].replace('/', '', 1).split('/')
|
||||||
|
|
||||||
|
c = -1
|
||||||
|
for _ in matching_names_split:
|
||||||
|
c += 1
|
||||||
|
|
||||||
|
getter_loop_count = -1
|
||||||
|
q = ''
|
||||||
|
for _ in range(c):
|
||||||
|
q += loop_getter(matching_names_split)
|
||||||
|
|
||||||
|
term('sftp -p -i ' + "'" + identity + "' " + '-P ' + port + ' ' + user + '@' + ip + ':' + remote_dir + q +
|
||||||
|
" <<< $'put " + local_dir + matching_names[i].replace('/', '', 1) + "'")
|
||||||
|
|
||||||
|
elif ltime < int(matching_times_remote[i]):
|
||||||
|
print('Local ' + matching_names[i] + ' is older, downloading.')
|
||||||
|
term('sftp -p -i ' + "'" + identity + "' " + '-P ' + port + ' ' + user + '@' + ip + ':' + remote_dir +
|
||||||
|
matching_names[i].replace('/', '', 1) + ' ' + local_dir + matching_names[i].replace('/', '', 1))
|
||||||
@@ -0,0 +1,814 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# external modules
|
||||||
|
|
||||||
|
from os import system as term
|
||||||
|
from os import remove
|
||||||
|
from os import environ
|
||||||
|
from shutil import move
|
||||||
|
from shutil import rmtree
|
||||||
|
from shutil import copy
|
||||||
|
from sys import argv
|
||||||
|
from re import search
|
||||||
|
from re import escape
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
import sshync
|
||||||
|
|
||||||
|
|
||||||
|
# internal modules
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
print('\n' * 100)
|
||||||
|
|
||||||
|
|
||||||
|
def string_found(string1, string2):
|
||||||
|
if search(r"\b" + escape(string1) + r"\b", string2):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def replace_line(file_name, line_num, text):
|
||||||
|
xlines = open(file_name, 'r').readlines()
|
||||||
|
xlines[line_num] = text
|
||||||
|
open(file_name, 'w').writelines(xlines)
|
||||||
|
|
||||||
|
|
||||||
|
def edit_note():
|
||||||
|
lines = open('/dev/shm/' + shmfolder + '/' + shmentry).readlines()
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(lines[0:3])
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'w').writelines(lines[4:-2])
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
edit_notes = open('/dev/shm/' + shmfolder + '/' + shmentry + '-n').read()
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'a').write('\n' + edit_notes + '\n\n')
|
||||||
|
|
||||||
|
|
||||||
|
def shmgen():
|
||||||
|
shmfoldergen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
||||||
|
for _ in range(random.randint(10, 30)))
|
||||||
|
shmentrygen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
||||||
|
for _ in range(random.randint(10, 30)))
|
||||||
|
term('mkdir -p /dev/shm/' + shmfoldergen)
|
||||||
|
return shmfoldergen, shmentrygen
|
||||||
|
|
||||||
|
|
||||||
|
def encrypt():
|
||||||
|
term('gpg -r ' + str(gpgid) + ' -e ' + "'" + '/dev/shm/' + shmfolder + '/' + shmentry + "'")
|
||||||
|
move('/dev/shm/' + shmfolder + '/' + shmentry + '.gpg', directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
|
||||||
|
|
||||||
|
def encryptfolder():
|
||||||
|
term('gpg -r ' + str(gpgid) + ' -e ' + "'" + '/dev/shm/' + shmfolder + '/' + shmentry + "'")
|
||||||
|
move('/dev/shm/' + shmfolder + '/' + shmentry + '.gpg', directory + folder + '/' + folderentry + '.gpg')
|
||||||
|
rmtree('/dev/shm/' + shmfolder)
|
||||||
|
|
||||||
|
|
||||||
|
# argument - filter the argument to usable text
|
||||||
|
|
||||||
|
argument = str(argv).replace('[', '', 1).replace(']', '', 1).replace(',', '').replace("'", '') \
|
||||||
|
.replace(' ', '', 1).replace('/usr/bin/', '', 1).replace('sshyp', '', 1)
|
||||||
|
|
||||||
|
# help
|
||||||
|
|
||||||
|
if argument == 'help' or argument == '--help' or argument == '-h':
|
||||||
|
print('\nsshyp Copyright (C) 2021 Randall Winkhart')
|
||||||
|
print("This program comes with ABSOLUTELY NO WARRANTY; for details type `sshyp show w'.\nThis is free software, "
|
||||||
|
"and you are welcome to redistribute it under certain conditions; type `sshyp show c' for details.")
|
||||||
|
print('\nUSAGE: sshyp [/<entry name>] [OPTION] [FLAG]\n')
|
||||||
|
print('Options: ')
|
||||||
|
print('help/--help/-h bring up this menu')
|
||||||
|
print('version/-v display sshyp version info')
|
||||||
|
print('config configure sshyp')
|
||||||
|
print('add add an entry')
|
||||||
|
print('gen generate a new password')
|
||||||
|
print('edit edit an existing entry')
|
||||||
|
print('copy copy details of an entry to your clipboard')
|
||||||
|
print('remove/-rm delete an existing entry')
|
||||||
|
print('sync/-s manually sync the entry directory via rsync\n')
|
||||||
|
print('Flags:')
|
||||||
|
print('add:')
|
||||||
|
print(' password/-p add a password entry')
|
||||||
|
print(' note/-n add a note entry')
|
||||||
|
print(' folder/-f add a new folder for entries')
|
||||||
|
print('edit:')
|
||||||
|
print(' rename/relocate/-r rename or relocate an entry')
|
||||||
|
print(' username/-u change the username of an entry')
|
||||||
|
print(' password/-p change the password of an entry')
|
||||||
|
print(' note/-n change the note attached to an entry')
|
||||||
|
print(' url/-l change the url attached to an entry')
|
||||||
|
print('copy:')
|
||||||
|
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(' url/-l copy the URL of an entry to your clipboard')
|
||||||
|
print(' note/-n copy the note of an entry to your clipboard')
|
||||||
|
print('gen:')
|
||||||
|
print(' update/-u generate a password for an existing entry\n')
|
||||||
|
print("Tip: You can quickly read an entry with 'sshyp /<entry name>'!")
|
||||||
|
print("When specifying entry names, do not include the file extension! '.gpg' is assumed!\n")
|
||||||
|
|
||||||
|
# version info
|
||||||
|
|
||||||
|
if argument == 'version' or argument == '-v':
|
||||||
|
print('\n////////////////////////////////////////////////////////')
|
||||||
|
print('/ /')
|
||||||
|
print('/ sshyp Copyright (C) 2021 Randall Winkhart /')
|
||||||
|
print('/ /')
|
||||||
|
print('/ Version 2021.11.05.fr1 /')
|
||||||
|
print('/ The sshync Update /')
|
||||||
|
print('/ /')
|
||||||
|
print('////////////////////////////////////////////////////////\n')
|
||||||
|
|
||||||
|
# licensing info
|
||||||
|
|
||||||
|
if argument == 'show w':
|
||||||
|
clear()
|
||||||
|
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('See the GNU General Public License for more details.')
|
||||||
|
print('\nhttps://opensource.org/licenses/GPL-3.0\n')
|
||||||
|
|
||||||
|
if argument == 'show c':
|
||||||
|
clear()
|
||||||
|
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('or (at your option) any later version.\n')
|
||||||
|
|
||||||
|
# config
|
||||||
|
|
||||||
|
if argument == 'config':
|
||||||
|
try:
|
||||||
|
print()
|
||||||
|
devicetype = str(input('Will this be a client or a server device? (C/s) '))
|
||||||
|
if devicetype == 's' or devicetype == 'S':
|
||||||
|
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
|
||||||
|
print('\nMake sure the ssh service is running and properly configured.\n')
|
||||||
|
copy('/usr/bin/sshync.py', '/home/' + environ.get('USER') + '/')
|
||||||
|
term('mkdir -p /home/' + environ.get('USER') + '/.password-pasture')
|
||||||
|
print('Configuration complete!\n')
|
||||||
|
else:
|
||||||
|
devicetype = 'c'
|
||||||
|
gpgid = ''
|
||||||
|
print()
|
||||||
|
gpgpresent = str(input(
|
||||||
|
'sshyp 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':
|
||||||
|
print()
|
||||||
|
gpgid = str(input('Please input the ID of your gpg key: '))
|
||||||
|
open("/var/lib/sshyp/sshyp-gpg", 'w').write(gpgid + '\n')
|
||||||
|
else:
|
||||||
|
print()
|
||||||
|
gpggen = str(
|
||||||
|
input('Would you like to generate one now? Note that if you choose not to do this, you will have '
|
||||||
|
'to re-run "sshyp config" to specify a gpg key when you acquire one (Y/n) '))
|
||||||
|
if gpggen == 'n' or gpggen == 'N':
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
|
term('gpg --full-generate-key')
|
||||||
|
print()
|
||||||
|
gpgid = str(input('Please input the ID of your gpg key: '))
|
||||||
|
open("/var/lib/sshyp/sshyp-gpg", 'w').write(gpgid + '\n')
|
||||||
|
try:
|
||||||
|
open('/var/lib/sshyp/lock', 'x').write('locked')
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
term('gpg -r ' + str(gpgid) + ' -e ' + '/var/lib/sshyp/lock')
|
||||||
|
remove('/var/lib/sshyp/lock')
|
||||||
|
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 '
|
||||||
|
'automatically generated? (Y/n) '))
|
||||||
|
if sshgen != 'n' and sshgen != 'N':
|
||||||
|
term('ssh-keygen -t ed25519 -f ~/.ssh/sshyp')
|
||||||
|
print('\nExample input: 10.10.10.10:9999\n')
|
||||||
|
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
||||||
|
print()
|
||||||
|
ip, sep, port = ip_port.partition(':')
|
||||||
|
usernamessh = str(input('What is the username of the remote server? '))
|
||||||
|
print('\nDefault directory: ' + '/home/' + usernamessh + '/.password-pasture/\n')
|
||||||
|
directoryssh = ('/home/' + usernamessh + '/.password-pasture/')
|
||||||
|
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
|
||||||
|
sshync.make_profile('/var/lib/sshyp/sshyp.sshync', '/home/' + environ.get('USER') + '/.password-pasture/',
|
||||||
|
directoryssh, '/home/' + environ.get('USER') + '/.ssh/sshyp', ip, port, usernamessh)
|
||||||
|
print('Configuration complete!\n')
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
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('sshyp is currently early software with very little polish\n')
|
||||||
|
|
||||||
|
# import userdata
|
||||||
|
|
||||||
|
devicetype = 'c'
|
||||||
|
try:
|
||||||
|
devicetype = open('/var/lib/sshyp/sshyp-device').read().strip()
|
||||||
|
gpgid = open('/var/lib/sshyp/sshyp-gpg').read().strip()
|
||||||
|
sshinfo = sshync.get_profile('/var/lib/sshyp/sshyp.sshync')
|
||||||
|
usernamessh = sshinfo[0].replace('\n', '')
|
||||||
|
ip = sshinfo[1].replace('\n', '')
|
||||||
|
port = sshinfo[2].replace('\n', '')
|
||||||
|
directory = str(sshinfo[3].replace('\n', ''))
|
||||||
|
directoryssh = sshinfo[4].replace('\n', '')
|
||||||
|
term('mkdir -p ' + directory)
|
||||||
|
except FileNotFoundError:
|
||||||
|
if devicetype != 's' and devicetype != 'S':
|
||||||
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
|
print("Not all necessary configuration files are present. Please run 'sshyp config'!")
|
||||||
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
|
devicetype, sshinfo, directory, directoryssh, ip, port, usernamessh = [0, 0, 0, 0, 0, 0, 0]
|
||||||
|
exit()
|
||||||
|
|
||||||
|
# no argument
|
||||||
|
|
||||||
|
if argument == '':
|
||||||
|
try:
|
||||||
|
print()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
readentry = str(input('Entry to read: '))
|
||||||
|
clear()
|
||||||
|
term('gpg -d ' + directory + "'" + readentry.replace('/', '', 1) + "'" + '.gpg')
|
||||||
|
print()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n\nSelection cancelled.\n')
|
||||||
|
exit()
|
||||||
|
|
||||||
|
# read shortcut
|
||||||
|
|
||||||
|
if argument.startswith('/'):
|
||||||
|
if argument.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = argument.replace('/', '', 1).partition('/')
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d ' + directory + "'" + argument.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
|
||||||
|
# add
|
||||||
|
|
||||||
|
if argument == 'add':
|
||||||
|
print('\nUSAGE: sshyp add [FLAG]')
|
||||||
|
print('Flags:')
|
||||||
|
print('add:')
|
||||||
|
print(' password/-p add a password entry')
|
||||||
|
print(' note/-n add a note entry')
|
||||||
|
print(' folder/-f add a new folder for entries\n')
|
||||||
|
|
||||||
|
if argument == 'add note' or argument == 'add -n':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
entryname = str(input('Name of note: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, notes = (0, 0)
|
||||||
|
print('\n\nEntry add cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
notes = open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'r').read()
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'): # check if user input contains slashes
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'): # create folder and entry if there are two slashes
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines('\n\n\n\n' + notes + '\n\n')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else: # create entry if there is only one slash
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines('\n\n\n\n' + notes + '\n\n')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else: # create entry if there are no slashes
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines('\n\n\n\n' + notes + '\n\n')
|
||||||
|
encrypt()
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
entryname = str(input('Name of service: '))
|
||||||
|
username = str(input('Username: '))
|
||||||
|
password = str(input('Password: '))
|
||||||
|
url = str(input('URL: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, username, password, url, notes = (0, 0, 0, 0, 0)
|
||||||
|
print('\n\nEntry add cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
add_note = input('Add a note to this entry? (y/N) ')
|
||||||
|
if add_note == 'y' or add_note == 'Y':
|
||||||
|
term('nano /dev/shm/' + shmfolder + '/' + shmentry + '-n')
|
||||||
|
notes = open('/dev/shm/' + shmfolder + '/' + shmentry + '-n', 'r').read()
|
||||||
|
else:
|
||||||
|
notes = ''
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(username + '\n' + password + '\n' + url
|
||||||
|
+ '\n\n' + notes + '\n\n')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(username + '\n' + password + '\n' + url
|
||||||
|
+ '\n\n' + notes + '\n\n')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(username + '\n' + password + '\n' + url
|
||||||
|
+ '\n\n' + notes + '\n\n')
|
||||||
|
encrypt()
|
||||||
|
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':
|
||||||
|
newfolder = str(input('Name of new folder: '))
|
||||||
|
term('mkdir ' + "'" + directory + newfolder + "'")
|
||||||
|
|
||||||
|
# edit
|
||||||
|
|
||||||
|
if argument == 'edit':
|
||||||
|
print('\nUSAGE: sshyp edit [FLAG]')
|
||||||
|
print('Flags:')
|
||||||
|
print('edit:')
|
||||||
|
print(' rename/relocate/-r rename or relocate an entry')
|
||||||
|
print(' username/-u change the username of an entry')
|
||||||
|
print(' password/-p change the password of an entry')
|
||||||
|
print(' url/-l change the url attached to an entry')
|
||||||
|
print(' note/-n change the note attached to an entry\n')
|
||||||
|
|
||||||
|
if argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit -r':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
entryname = str(input('What file would you like to edit? '))
|
||||||
|
newname = str(input('New Name: '))
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
move(directory + folder + '/' + folderentry + '.gpg', directory + '/' + newname + '.gpg')
|
||||||
|
else:
|
||||||
|
move(directory + entryname.replace('/', '', 1) + '.gpg',
|
||||||
|
directory + newname.replace('/', '', 1) + '.gpg')
|
||||||
|
else:
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
entryname = str(input('What file would you like to edit? '))
|
||||||
|
username = str(input('New Username: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, username = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
folder + '/' + folderentry + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 0, username + '\n')
|
||||||
|
remove(directory + folder + '/' + folderentry + '.gpg')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 0, username + '\n')
|
||||||
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 0, username + '\n')
|
||||||
|
remove(directory + entryname + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
entryname = str(input('What file would you like to edit? '))
|
||||||
|
password = str(input('New Password: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, password = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
folder + '/' + folderentry + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, password + '\n')
|
||||||
|
remove(directory + folder + '/' + folderentry + '.gpg')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, password + '\n')
|
||||||
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, password + '\n')
|
||||||
|
remove(directory + entryname + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
entryname = str(input('What file would you like to edit? '))
|
||||||
|
url = str(input('New URL: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, url = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
folder + '/' + folderentry + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 2, url + '\n')
|
||||||
|
remove(directory + folder + '/' + folderentry + '.gpg')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 2, url + '\n')
|
||||||
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 2, url + '\n')
|
||||||
|
remove(directory + entryname + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
entryname = str(input('What file would you like to edit? '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, notes = (0, 0)
|
||||||
|
print('\n\nEdit cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
folder + '/' + folderentry + '.gpg')
|
||||||
|
edit_note()
|
||||||
|
remove(directory + folder + '/' + folderentry + '.gpg')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
edit_note()
|
||||||
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
||||||
|
edit_note()
|
||||||
|
remove(directory + entryname + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
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
|
||||||
|
|
||||||
|
if argument == 'copy':
|
||||||
|
print('\nUSAGE: sshyp copy [FLAG]')
|
||||||
|
print('Flags:')
|
||||||
|
print('copy:')
|
||||||
|
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(' url/-l copy the URL of an entry to your clipboard')
|
||||||
|
print(' note/-n copy the note of an entry to your clipboard\n')
|
||||||
|
|
||||||
|
if argument == 'copy username' or argument == 'copy -u':
|
||||||
|
try:
|
||||||
|
print()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
|
term('wl-copy ' + "'" + copyline[0].replace('\n', '') + "'")
|
||||||
|
else:
|
||||||
|
term('echo -n ' + "'" + copyline[0].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
print()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
|
term('wl-copy ' + "'" + copyline[1].replace('\n', '').replace("'", "'\\''") + "'")
|
||||||
|
else:
|
||||||
|
term('echo -n ' + "'" + copyline[1].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
print()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
|
term('wl-copy ' + "'" + copyline[2].replace('\n', '') + "'")
|
||||||
|
else:
|
||||||
|
term('echo -n ' + "'" + copyline[2].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
print()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
readentry = str(input('Entry to copy: '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
readentry = 0
|
||||||
|
print('\n\nCopy cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + readentry + '.gpg')
|
||||||
|
copyline = open('/dev/shm/' + shmfolder + '/' + shmentry, 'r').readlines()
|
||||||
|
if environ.get('WAYLAND_DISPLAY') == 'wayland-0':
|
||||||
|
term('wl-copy ' + "'" + copyline[4].replace('\n', '') + "'")
|
||||||
|
else:
|
||||||
|
term('echo -n ' + "'" + copyline[4].replace('\n', '') + "'" + ' | xclip -sel c')
|
||||||
|
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
|
||||||
|
|
||||||
|
if argument == 'gen':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
entryname = str(input('Name of service: '))
|
||||||
|
username = str(input('Username: '))
|
||||||
|
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) '))
|
||||||
|
if passtype != 's':
|
||||||
|
passtype = string.ascii_letters + string.digits + string.punctuation
|
||||||
|
if passtype == 's':
|
||||||
|
passtype = string.ascii_letters + string.digits
|
||||||
|
passgen = ''.join(random.SystemRandom().choice(passtype) for _ in range(passlength))
|
||||||
|
url = str(input('URL: '))
|
||||||
|
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()
|
||||||
|
try:
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(username + '\n' + passgen + '\n' + url
|
||||||
|
+ '\n' + notes + '\n\n')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(username + '\n' + passgen + '\n' + url
|
||||||
|
+ '\n' + notes + '\n\n')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
open('/dev/shm/' + shmfolder + '/' + shmentry, 'w').writelines(username + '\n' + passgen + '\n' + url
|
||||||
|
+ '\n' + notes + '\n\n')
|
||||||
|
encrypt()
|
||||||
|
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':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
entryname = str(input('Which password would you like to re-generate? '))
|
||||||
|
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) '))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
entryname, passlength, passtype = (0, 0, 0)
|
||||||
|
print('\n\nEntry generation cancelled.\n')
|
||||||
|
exit()
|
||||||
|
shmfolder, shmentry = shmgen()
|
||||||
|
try:
|
||||||
|
if passtype != 's':
|
||||||
|
passtype = string.ascii_letters + string.digits + string.punctuation
|
||||||
|
if passtype == 's':
|
||||||
|
passtype = string.ascii_letters + string.digits
|
||||||
|
passgen = ''.join(random.SystemRandom().choice(passtype) for _ in range(passlength))
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
folder + '/' + folderentry + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, passgen + '\n')
|
||||||
|
remove(directory + folder + '/' + folderentry.replace('/', '', 1) + '.gpg')
|
||||||
|
encryptfolder()
|
||||||
|
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, passgen + '\n')
|
||||||
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
||||||
|
else:
|
||||||
|
term('gpg -d --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
||||||
|
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, passgen + '\n')
|
||||||
|
remove(directory + entryname + '.gpg')
|
||||||
|
encrypt()
|
||||||
|
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
|
||||||
|
|
||||||
|
if argument == 'remove' or argument == '-rm':
|
||||||
|
clear()
|
||||||
|
term('cd ' + directory + '; ls -1 *')
|
||||||
|
print()
|
||||||
|
try:
|
||||||
|
entryname = str(input('What would you like to delete? '))
|
||||||
|
try:
|
||||||
|
term('gpg -d --output /dev/shm/sshyp.lock /var/lib/sshyp/lock.gpg')
|
||||||
|
unlocker = open('/dev/shm/sshyp.lock', 'r').readlines()
|
||||||
|
remove('/dev/shm/sshyp.lock')
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\nAccess denied.\n')
|
||||||
|
exit()
|
||||||
|
if entryname.startswith('/'):
|
||||||
|
if entryname.replace('/', '', 1).__contains__('/'):
|
||||||
|
if devicetype == 'c':
|
||||||
|
term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' "' + ' rm -rf ' + "'" + directoryssh +
|
||||||
|
entryname.replace('/', '', 1) + '.gpg' + "'" + '"')
|
||||||
|
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
||||||
|
else:
|
||||||
|
if devicetype == 'c':
|
||||||
|
term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' "' + ' rm -rf ' + "'" + directoryssh +
|
||||||
|
entryname.replace('/', '', 1) + "'" + '"')
|
||||||
|
rmtree(directory + entryname.replace('/', '', 1))
|
||||||
|
else:
|
||||||
|
if devicetype == 'c':
|
||||||
|
term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' "' + ' rm -rf ' + "'" + directoryssh +
|
||||||
|
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__('-rm') or string_found('remove', argument) or string_found('add', argument) or \
|
||||||
|
string_found('edit', argument) or string_found('gen', argument) or string_found('copy', argument) or \
|
||||||
|
string_found('/', argument) or argument == 'sync' or argument == '-s' or argument == '' or argument == 'help' \
|
||||||
|
or argument == '--help' or argument == '-h' or argument == 'version' or argument == '-v' or argument == \
|
||||||
|
'config' or argument == 'show w' or argument == 'show c':
|
||||||
|
pass
|
||||||
|
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
|
||||||
|
|
||||||
|
term('find ' + directory + ' -type d -exec chmod -R 700 {} +')
|
||||||
|
term('find ' + directory + ' -type f -exec chmod -R 600 {} +')
|
||||||
|
|
||||||
|
# rsync - ran at end of program to ensure all files are properly synced
|
||||||
|
if devicetype == 'c':
|
||||||
|
if argument.__contains__('-rm') or string_found('remove', argument) or string_found('add', argument) or \
|
||||||
|
string_found('edit', argument) or string_found('gen', argument) or argument == 'sync' or argument == '-s':
|
||||||
|
print('Syncing entries with other device(s)...\n')
|
||||||
|
sshync.run_profile('/var/lib/sshyp/sshyp.sshync')
|
||||||
Executable
+305
@@ -0,0 +1,305 @@
|
|||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
sshyp 2021.11.05.fr1
|
||||||
|
|
||||||
|
First public release of sshyp.
|
||||||
|
|
||||||
|
This release fixes major bugs from rpass and rebrands the project.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- an entirely new syncing back-end called sshync (custom Python wrapper around sftp)
|
||||||
|
^ in thoery, all syncing-related data loss should now be fixed, however, this new
|
||||||
|
system has just been created and is still under testing. Maybe wait for a few patches
|
||||||
|
before trusting this system.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- branding has been updated to reflect new project name and goals
|
||||||
|
- custom directories, custom ssh keys, and offline only mode are removed (may be temporary)
|
||||||
|
^ the configuration wizard is being re-written in the next major update
|
||||||
|
|
||||||
|
Planned for next update (The Fluffy Update):
|
||||||
|
|
||||||
|
- modularized and optimized code
|
||||||
|
^ some older, bad code from "rpass" will be re-written.
|
||||||
|
- new visual features
|
||||||
|
^ this includes the new file list and thematic text art. sshyp will be
|
||||||
|
getting a retro computing theme.
|
||||||
|
- packages for more environments
|
||||||
|
^ "sshyp" will be officially packaged for Arch Linux, Alpine Linux, and Termux (Android).
|
||||||
|
Debian/Ubuntu and Fedora packaging will come later.
|
||||||
|
|
||||||
|
Planned for next update (The Sheep w/Shears Update):
|
||||||
|
|
||||||
|
- allow for copying entire notes (not just first line)
|
||||||
|
- allow for multi-client deletion... somehow
|
||||||
|
- ability to pass entries as arguments for more functions
|
||||||
|
- detatch sshync and make it a separate package
|
||||||
|
- manpage
|
||||||
|
|
||||||
|
Planned, no timeline:
|
||||||
|
|
||||||
|
- create separate gui frontend targetting mobile devices (Android + Linux phones)
|
||||||
|
^ the gui will also function on desktop linux
|
||||||
|
- package for more Linux distributions, such as Debian and Fedora)
|
||||||
|
- auto-completion on tab (currently unsure of best way to make this work)
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.11.01.mr5.1
|
||||||
|
|
||||||
|
The Notetaker Update - Patch 1
|
||||||
|
|
||||||
|
This is the FINAL release of "rpass".
|
||||||
|
After this release, the project will be rebranded as "sshyp".
|
||||||
|
|
||||||
|
rpass's syncing system is fundamentally broken, hence the need for "sshyp"
|
||||||
|
and its new syncing system. I would highly advise against using this release.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- none
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- fixed an issue with copying notes (currently only copies first line, will be changed in the future)
|
||||||
|
- rpass is validated to work with Python 3.10 (no changes were needed)
|
||||||
|
|
||||||
|
Planned for next update (sshyp fr1)
|
||||||
|
|
||||||
|
- full project rebrand ("sshyp")
|
||||||
|
- new syncing back-end
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.10.07.mr5
|
||||||
|
|
||||||
|
The Notetaker Update - Fifth main release of rpass
|
||||||
|
|
||||||
|
This release overhauls the note-taking system and provides general improvements
|
||||||
|
to overall code quality, including optimizations, bug fixes, and security improvements.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- notes are now edited in nano and can be split across multiple lines
|
||||||
|
- password confirmation has been added for entry deletion
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- fixed issues with copying passwords with certain special characters, e.g. '"()|
|
||||||
|
- auto-generated ssh key now uses ed25519, rather than rsa-3072
|
||||||
|
- entry format modified to include a blank line before the notes field (old format still mostly compatible)
|
||||||
|
- rpass is now much better at catching bad arguments
|
||||||
|
- some general code cleanup
|
||||||
|
|
||||||
|
Planned for next update (The Housekeeping Update Pt. 2):
|
||||||
|
|
||||||
|
- add new file list w/color and w/o extensions + proper displaying of nested folders
|
||||||
|
- ability to pass entries as arguments for more functions
|
||||||
|
- manpage
|
||||||
|
- add more comments to code
|
||||||
|
- validate for Python 3.10
|
||||||
|
|
||||||
|
Planned for next update (The cryptpass Update):
|
||||||
|
|
||||||
|
- initial implementation of a data store for other applications (libsecret alt.)
|
||||||
|
- modularize code in preparation for GUI frontends
|
||||||
|
|
||||||
|
Planned, no timeline:
|
||||||
|
|
||||||
|
- 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
|
||||||
|
- make platform agnostic (add Windows support and package for more Linux distributions, such as Alpine and Debian)
|
||||||
|
- auto-completion on tab (currently unsure of best way to make this work)
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.09.15.mr4.2
|
||||||
|
|
||||||
|
The Housekeeping Update (Pt. 1) - Hotfix 2
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- sync support is fixed
|
||||||
|
- files with spaces in their names can now be properly deleted from remote servers
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.09.15.mr4.1
|
||||||
|
|
||||||
|
The Housekeeping Update (Pt. 1) - Hotfix
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- the user is once again properly presented with a prompt to enter a gpg key when pressing enter through the config dialog
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass-2021.09.15.mr4
|
||||||
|
|
||||||
|
The Housekeeping Update (Pt. 1) - Fourth main release of rpass
|
||||||
|
|
||||||
|
This release focuses primarily on polishing rpass and tying up loose ends before
|
||||||
|
making any major changes in the future.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- added clipboard support for copying entry information
|
||||||
|
- many common errors are now handled with proper exceptions
|
||||||
|
- offline support (sync no longer needs to be configured for rpass to function)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- fixed gpg decryption warnings
|
||||||
|
- added version info argument
|
||||||
|
- re-ordered config wizard to make more sense
|
||||||
|
- entry deletion can now be done client-side
|
||||||
|
- removed rsyncup/rsyncdown/username/ip/port/directoryssh files,
|
||||||
|
^ replaced with one file that holds usernamessh, ip, port, directoryssh, and devicetype
|
||||||
|
- files should no longer be left in /dev/shm when an error is encountered
|
||||||
|
- fixed issues relating to using a non-default entry directory
|
||||||
|
- lots of optimizations have been made to reduce the size of rpass
|
||||||
|
|
||||||
|
Planned for next update (The Housekeeping Update Pt. 2):
|
||||||
|
|
||||||
|
- 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:
|
||||||
|
|
||||||
|
- 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
|
||||||
|
- make platform agnostic (add Windows support and package for more Linux distributions)
|
||||||
|
- auto-completion on tab (currently unsure of best way to make this work)
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.09.07.pr3.1
|
||||||
|
|
||||||
|
The Sync and Foundations Update - Hotfix
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- gpg configuration now prompts for expiration, rather than defaulting to two years
|
||||||
|
- rsync is now configured to not delete anything from any remote device when uploading
|
||||||
|
^ this behavior may be modified in the future - this is a quick fix to prevent data loss
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.09.07.pr3
|
||||||
|
|
||||||
|
The Sync and Foundations Update - Third public release of rpass.
|
||||||
|
|
||||||
|
As of this version, rpass has its intended base set of features and is considered usable.
|
||||||
|
It will now primarily recieve bug fixes and polish updates to prepare it to go
|
||||||
|
cross-platform and to make it compatible with GUI frontends.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- rsync support!
|
||||||
|
- new entry format with URL field (for future use)
|
||||||
|
- the temporary directory (/dev/shm) for editing entries has been somewhat secured
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- 'rpass edit relocate' is now properly bound
|
||||||
|
- dropped the use of 'echo'
|
||||||
|
- added 'rsync' and 'openssh' as dependencies
|
||||||
|
- fixed a bug with deleting entries from folders
|
||||||
|
- entry directory now has more secure permissions
|
||||||
|
^ these permissions are re-enforced every time rpass is used
|
||||||
|
- fixed some small typos and potential bugs, made some small optimizations
|
||||||
|
|
||||||
|
Planned for next update (The Housekeeping Update):
|
||||||
|
|
||||||
|
- move to github
|
||||||
|
- get rid of gpg decryption warnings
|
||||||
|
- proper error messages using 'except'
|
||||||
|
- add exceptions for unknown arguments
|
||||||
|
- cleanup file list by exporting to document and removing .gpg, adding color
|
||||||
|
- add a manpage
|
||||||
|
- allow notes to be multiple lines long (break lines after so many characters)
|
||||||
|
- validate for Python 3.10
|
||||||
|
- properly comment the code
|
||||||
|
|
||||||
|
Planned, no timeline:
|
||||||
|
|
||||||
|
- allow to function as alternative to gnome keyring (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
|
||||||
|
- 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)
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.09.02.pr2
|
||||||
|
|
||||||
|
The Folder Update - Second public release of rpass.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- entry and folder titles can now have spaces and be as long as you want
|
||||||
|
- entires and folders can now be deleted with 'rpass remove' or 'rpass -rm'
|
||||||
|
- entries now properly save to folders via 'rpass add' and should no longer throw errors
|
||||||
|
- entries saved in folders are now readable
|
||||||
|
- existing entries can now be moved to, from, and between folders
|
||||||
|
- previews are now shown after creating or editing an entry
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- every pre-existing function of rpass has been updated to work with the new folder system
|
||||||
|
- dropped awk as a dependency
|
||||||
|
- removed 'argument' file in /var/lib/rpass
|
||||||
|
- reduced unneccessary characters in argument parsing to decrease compatibility issues
|
||||||
|
- ensured all user input is handled correctly as a string or an integer
|
||||||
|
- lots of miscellaneous optimizations
|
||||||
|
|
||||||
|
Expected for next update (The rsync Update):
|
||||||
|
|
||||||
|
- rsync (over ssh) support!
|
||||||
|
^ including any fixes, changes, or optimizations necessary to make that happen
|
||||||
|
- new file formatting with support for URLs
|
||||||
|
^all entries created in new format should be compatible with future versions of rpass
|
||||||
|
- secure /dev/shm with random text generator
|
||||||
|
|
||||||
|
Expected for the next (next) update (The Housekeeping Update)
|
||||||
|
|
||||||
|
- get rid of gpg decryption warnings
|
||||||
|
- proper error messages using 'except'
|
||||||
|
- add exceptions for unknown arguments
|
||||||
|
- cleanup file list by exporting to document and removing .gpg, adding color
|
||||||
|
|
||||||
|
Planned, no timeline:
|
||||||
|
|
||||||
|
- make platform agnostic (basically, add windows support)
|
||||||
|
- create separate gui frontend targetting mobile devices (first linux phones, android at a later date)
|
||||||
|
^ the gui will also function on desktop linux
|
||||||
|
- ability to pass entries as arguments for more functions
|
||||||
|
- auto-completion on tab
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
rpass 2021.09.01.pr1.1
|
||||||
|
|
||||||
|
First public release of rpass.
|
||||||
|
|
||||||
|
Early build, missing critical features (e.g. sync support and the ability to have spaces in filenames).
|
||||||
|
|
||||||
|
What is currently functional:
|
||||||
|
|
||||||
|
- guided configuration wizard
|
||||||
|
- generate passwords
|
||||||
|
- add existing passwords
|
||||||
|
- make notes
|
||||||
|
- sort notes and passwords into folders
|
||||||
|
- gpg encryption
|
||||||
|
- edit password/note entries
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
sshyp 2021.11.05.fr1
|
||||||
|
|
||||||
|
First public release of sshyp.
|
||||||
|
|
||||||
|
This release fixes major bugs from rpass and rebrands the project.
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
- an entirely new syncing back-end called sshync (custom Python wrapper around sftp)
|
||||||
|
^ in thoery, all syncing-related data loss should now be fixed, however, this new
|
||||||
|
system has just been created and is still under testing. Maybe wait for a few patches
|
||||||
|
before trusting this system.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- branding has been updated to reflect new project name and goals
|
||||||
|
- custom directories, custom ssh keys, and offline only mode are removed (may be temporary)
|
||||||
|
^ the configuration wizard is being re-written in the next major update
|
||||||
|
|
||||||
|
Planned for next update (The Fluffy Update):
|
||||||
|
|
||||||
|
- modularized and optimized code
|
||||||
|
^ some older, bad code from "rpass" will be re-written.
|
||||||
|
- new visual features
|
||||||
|
^ this includes the new file list and thematic text art. sshyp will be
|
||||||
|
getting a retro computing theme.
|
||||||
|
- packages for more environments
|
||||||
|
^ "sshyp" will be officially packaged for Arch Linux, Alpine Linux, and Termux (Android).
|
||||||
|
Debian/Ubuntu and Fedora packaging will come later.
|
||||||
|
|
||||||
|
Planned for next update (The Sheep w/Shears Update):
|
||||||
|
|
||||||
|
- allow for copying entire notes (not just first line)
|
||||||
|
- allow for multi-client deletion... somehow
|
||||||
|
- ability to pass entries as arguments for more functions
|
||||||
|
- detatch sshync and make it a separate package
|
||||||
|
- manpage
|
||||||
|
|
||||||
|
Planned, no timeline:
|
||||||
|
|
||||||
|
- create separate gui frontend targetting mobile devices (Android + Linux phones)
|
||||||
|
^ the gui will also function on desktop linux
|
||||||
|
- package for more Linux distributions, such as Debian and Fedora)
|
||||||
|
- auto-completion on tab (currently unsure of best way to make this work)
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
|
The full history of changes to "sshyp" and "rpass" can be found on the following page:
|
||||||
|
https://raw.githubusercontent.com/rwinkhart/sshyp/main/extra/changelog-total
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
rpass is a FOSS password manager that takes advantage of rsync
|
sshyp is a FOSS password manager that takes advantage of rsync
|
||||||
Copyright (C) 2021 Randall Winkhart idgr@tutanota.com
|
Copyright (C) 2021 Randall Winkhart idgr@tutanota.com
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
-605
@@ -1,605 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
# rpass 2021.09.07.pr3.1
|
|
||||||
# rpass is the gnu pass alternative for those who don't want to use git
|
|
||||||
# rpass is freely licensed for modification and redistribution under the GNU General Public License V3
|
|
||||||
|
|
||||||
from os import system
|
|
||||||
from os import remove
|
|
||||||
from os import environ
|
|
||||||
from shutil import move
|
|
||||||
from shutil import rmtree
|
|
||||||
from sys import argv
|
|
||||||
import random
|
|
||||||
import string
|
|
||||||
|
|
||||||
|
|
||||||
def clear():
|
|
||||||
print("\n" * 100)
|
|
||||||
|
|
||||||
|
|
||||||
def term(cmd):
|
|
||||||
_ = system(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
def replace_line(file_name, line_num, text):
|
|
||||||
lines = open(file_name, 'r').readlines()
|
|
||||||
lines[line_num] = text
|
|
||||||
out = open(file_name, 'w')
|
|
||||||
out.writelines(lines)
|
|
||||||
out.close()
|
|
||||||
|
|
||||||
|
|
||||||
def encrypt():
|
|
||||||
term('gpg -r ' + str(gpgid) + ' -e ' + "'" + '/dev/shm/' + shmfolder + '/' + shmentry + "'")
|
|
||||||
move('/dev/shm/' + shmfolder + '/' + shmentry + '.gpg', directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
rmtree('/dev/shm/' + shmfolder)
|
|
||||||
|
|
||||||
|
|
||||||
def encryptfolder():
|
|
||||||
term('gpg -r ' + str(gpgid) + ' -e ' + "'" + '/dev/shm/' + shmfolder + '/' + shmentry + "'")
|
|
||||||
move('/dev/shm/' + shmfolder + '/' + shmentry + '.gpg', directory + folder + '/' + folderentry + '.gpg')
|
|
||||||
rmtree('/dev/shm/' + shmfolder)
|
|
||||||
|
|
||||||
|
|
||||||
def rsyncup():
|
|
||||||
term(rsyncupp + ' ' + directory + ' ' + usernamessh + '@' + ip + ':' + directoryssh)
|
|
||||||
|
|
||||||
|
|
||||||
def rsyncdown():
|
|
||||||
term(rsyncdownn + ' ' + usernamessh + '@' + ip + ':' + directoryssh + ' ' + directory)
|
|
||||||
|
|
||||||
|
|
||||||
# argument - filter the argument to usable text - some replacements are only done once to prevent interference
|
|
||||||
|
|
||||||
argument = str(argv).replace('[', '', 1).replace(']', '', 1).replace(',', '').replace("'", '') \
|
|
||||||
.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
|
|
||||||
|
|
||||||
if argument == 'help' or argument == '--help' or argument == '-h':
|
|
||||||
print()
|
|
||||||
print('rpass Copyright (C) 2021 Randall Winkhart')
|
|
||||||
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.")
|
|
||||||
print()
|
|
||||||
print('USAGE: rpass [/<entry name>] [OPTION] [FLAG]')
|
|
||||||
print()
|
|
||||||
print('Options: ')
|
|
||||||
print('help/--help/-h bring up this menu')
|
|
||||||
print('config configure rpass')
|
|
||||||
print('add add an entry')
|
|
||||||
print('gen generate a new password')
|
|
||||||
print('edit edit an existing entry')
|
|
||||||
print('remove/-rm delete an existing entry')
|
|
||||||
print('sync/-s manually sync the entry directory via rsync')
|
|
||||||
print()
|
|
||||||
print('Flags:')
|
|
||||||
print('add:')
|
|
||||||
print(' password/-p add a password entry')
|
|
||||||
print(' note/-n add a note entry')
|
|
||||||
print(' folder/-f add a new folder for entries')
|
|
||||||
print('edit:')
|
|
||||||
print(' rename/relocate/-r rename or relocate an entry')
|
|
||||||
print(' username/-u change the username of an entry')
|
|
||||||
print(' password/-p change the password of an entry')
|
|
||||||
print(' note/-n change the note attached to an entry')
|
|
||||||
print(' url/-l change the url attached to an entry')
|
|
||||||
print('gen:')
|
|
||||||
print(' update/-u generate a password for an existing entry')
|
|
||||||
print()
|
|
||||||
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()
|
|
||||||
|
|
||||||
# licensing info
|
|
||||||
|
|
||||||
if argument == 'show w':
|
|
||||||
clear()
|
|
||||||
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('See the GNU General Public License for more details.')
|
|
||||||
print()
|
|
||||||
print('https://opensource.org/licenses/GPL-3.0')
|
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'show c':
|
|
||||||
clear()
|
|
||||||
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('or (at your option) any later version.')
|
|
||||||
print()
|
|
||||||
|
|
||||||
# config
|
|
||||||
|
|
||||||
if argument == 'config':
|
|
||||||
print()
|
|
||||||
directorychoice = str(input('Would you like to use the default entry directory (~/.rpass-store/)? (Y/n) '))
|
|
||||||
if directorychoice != 'n':
|
|
||||||
with open("/var/lib/rpass/rpassdir", 'w') as f:
|
|
||||||
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: '))
|
|
||||||
with open("/var/lib/rpass/rpassdir", 'w') as f:
|
|
||||||
f.write(directory + '\n')
|
|
||||||
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':
|
|
||||||
print()
|
|
||||||
gpgid = str(input('Please input the ID of your gpg key: '))
|
|
||||||
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
|
||||||
f.write(gpgid + '\n')
|
|
||||||
if gpgpresent != 'y':
|
|
||||||
print()
|
|
||||||
gpggen = str(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) '))
|
|
||||||
if gpggen != 'n':
|
|
||||||
term('gpg --full-generate-key')
|
|
||||||
print()
|
|
||||||
gpgid = str(input('Please input the ID of your gpg key: '))
|
|
||||||
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
|
||||||
f.write(gpgid + '\n')
|
|
||||||
if gpggen == 'n' or gpggen == 'N':
|
|
||||||
exit()
|
|
||||||
print()
|
|
||||||
syncsetup = str(input('Would you like to configure rsync over ssh for entry backup and syncing? (Y/n) '))
|
|
||||||
if syncsetup != 'n':
|
|
||||||
print()
|
|
||||||
sshgen = str(input('rsync support requires a unique ssh key. Would you like to have this '
|
|
||||||
'automatically generated? (Y/n) '))
|
|
||||||
if sshgen != 'n':
|
|
||||||
term('ssh-keygen -f ~/.ssh/rpass')
|
|
||||||
print()
|
|
||||||
print('The server device(s) should be configured first.')
|
|
||||||
print()
|
|
||||||
devicetype = str(input('Will this be a client or a server device? (c/S) '))
|
|
||||||
if devicetype != 'c':
|
|
||||||
print()
|
|
||||||
print('Make sure the ssh service is running and that the proper port is forwarded.')
|
|
||||||
if devicetype == 'c':
|
|
||||||
print()
|
|
||||||
print('Make sure the ssh service is running and that the proper port is forwarded on the remote server.')
|
|
||||||
print('Example input: 10.10.10.10:9999')
|
|
||||||
print()
|
|
||||||
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
|
||||||
print()
|
|
||||||
usernamessh = str(input('What is the username of the remote server? '))
|
|
||||||
ip, sep, port = ip_port.partition(':')
|
|
||||||
with open("/var/lib/rpass/rpassuserssh", 'w') as f:
|
|
||||||
f.write(usernamessh + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassrsyncup", 'w') as f:
|
|
||||||
f.write('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassrsyncdown", 'w') as f:
|
|
||||||
f.write('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassip", 'w') as f:
|
|
||||||
f.write(ip + '\n')
|
|
||||||
print()
|
|
||||||
print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/')
|
|
||||||
print()
|
|
||||||
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':
|
|
||||||
print()
|
|
||||||
print('Format: /this/path/ends/with/a/slash/')
|
|
||||||
print()
|
|
||||||
directoryssh = str(input('What directory is the server using?: '))
|
|
||||||
with open("/var/lib/rpass/rpassdirssh", 'w') as f:
|
|
||||||
f.write(directoryssh + '\n')
|
|
||||||
|
|
||||||
# import userdata
|
|
||||||
|
|
||||||
with open("/var/lib/rpass/rpassgpg") as f:
|
|
||||||
gpgid = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassdir") as f:
|
|
||||||
directory = f.read().strip()
|
|
||||||
term('mkdir -p ' + directory)
|
|
||||||
with open("/var/lib/rpass/rpassdirssh") as f:
|
|
||||||
directoryssh = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassrsyncup") as f:
|
|
||||||
rsyncupp = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassrsyncdown") as f:
|
|
||||||
rsyncdownn = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassip") as f:
|
|
||||||
ip = f.read().strip()
|
|
||||||
with open("/var/lib/rpass/rpassuserssh") as f:
|
|
||||||
usernamessh = f.read().strip()
|
|
||||||
|
|
||||||
if argument == '':
|
|
||||||
print()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
readentry = str(input('Entry to read: '))
|
|
||||||
clear()
|
|
||||||
term('gpg -d ' + directory + "'" + readentry.replace('/', '', 1) + "'" + '.gpg')
|
|
||||||
print()
|
|
||||||
|
|
||||||
# read shortcut
|
|
||||||
|
|
||||||
if argument.startswith('/'):
|
|
||||||
if argument.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = argument.replace('/', '', 1).partition('/')
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg -d ' + directory + "'" + argument.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
|
|
||||||
# add
|
|
||||||
|
|
||||||
if argument == 'add':
|
|
||||||
print()
|
|
||||||
print('USAGE: rpass add [FLAG]')
|
|
||||||
print('Flags:')
|
|
||||||
print('add:')
|
|
||||||
print(' password/-p add a password entry')
|
|
||||||
print(' note/-n add a note entry')
|
|
||||||
print(' folder/-f add a new folder for entries')
|
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'add note' or argument == 'add -n':
|
|
||||||
clear()
|
|
||||||
entryname = str(input('Name of note: '))
|
|
||||||
notes = str(input('Contents of note: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines('\n\n\n' + notes + '\n\n')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
if argument == 'add password' or argument == 'add -p':
|
|
||||||
clear()
|
|
||||||
entryname = str(input('Name of service: '))
|
|
||||||
username = str(input('Username: '))
|
|
||||||
password = str(input('Password: '))
|
|
||||||
url = str(input('URL: '))
|
|
||||||
notes = str(input('Additional notes: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines(username + '\n' + password + '\n' + url + '\n' + notes + '\n\n')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
if argument == 'add folder' or argument == 'add -f':
|
|
||||||
newfolder = str(input('Name of new folder: '))
|
|
||||||
term('mkdir ' + "'" + directory + newfolder + "'")
|
|
||||||
|
|
||||||
# edit
|
|
||||||
|
|
||||||
if argument == 'edit':
|
|
||||||
print()
|
|
||||||
print('USAGE: rpass edit [FLAG]')
|
|
||||||
print('Flags:')
|
|
||||||
print('edit:')
|
|
||||||
print(' rename/relocate/-r rename or relocate an entry')
|
|
||||||
print(' username/-u change the username of an entry')
|
|
||||||
print(' password/-p change the password of an entry')
|
|
||||||
print(' note/-n change the note attached to an entry')
|
|
||||||
print(' url/-l change the url attached to an entry')
|
|
||||||
print()
|
|
||||||
|
|
||||||
if argument == 'edit rename' or argument == 'edit relocate' or argument == 'edit -r':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('What file would you like to edit? '))
|
|
||||||
newname = str(input('New Name: '))
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
move(directory + folder + '/' + folderentry + '.gpg', directory + '/' + newname + '.gpg')
|
|
||||||
else:
|
|
||||||
move(directory + entryname.replace('/', '', 1) + '.gpg', directory + newname.replace('/', '', 1) + '.gpg')
|
|
||||||
else:
|
|
||||||
move(directory + entryname + '.gpg', directory + newname + '.gpg')
|
|
||||||
|
|
||||||
if argument == 'edit username' or argument == 'edit -u':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('What file would you like to edit? '))
|
|
||||||
username = str(input('New Username: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
folder + '/' + folderentry + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 0, username + '\n')
|
|
||||||
remove(directory + folder + '/' + folderentry + '.gpg')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 0, username + '\n')
|
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 0, username + '\n')
|
|
||||||
remove(directory + entryname + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
if argument == 'edit password' or argument == 'edit -p':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('What file would you like to edit? '))
|
|
||||||
password = str(input('New Password: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
folder + '/' + folderentry + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, password + '\n')
|
|
||||||
remove(directory + folder + '/' + folderentry + '.gpg')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, password + '\n')
|
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, password + '\n')
|
|
||||||
remove(directory + entryname + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
if argument == 'edit url' or argument == 'edit -l':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('What file would you like to edit? '))
|
|
||||||
url = str(input('New URL: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
folder + '/' + folderentry + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 2, url + '\n')
|
|
||||||
remove(directory + folder + '/' + folderentry + '.gpg')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 2, url + '\n')
|
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 2, url + '\n')
|
|
||||||
remove(directory + entryname + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
if argument == 'edit note' or argument == 'edit -n':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('What file would you like to edit? '))
|
|
||||||
notes = str(input('New Note: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
folder + '/' + folderentry + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 3, notes + '\n')
|
|
||||||
remove(directory + folder + '/' + folderentry + '.gpg')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 3, notes + '\n')
|
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 3, notes + '\n')
|
|
||||||
remove(directory + entryname + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
# gen
|
|
||||||
|
|
||||||
if argument == 'gen':
|
|
||||||
clear()
|
|
||||||
entryname = str(input('Name of service: '))
|
|
||||||
username = str(input('Username: '))
|
|
||||||
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) '))
|
|
||||||
if passtype != 's':
|
|
||||||
passtype = string.ascii_letters + string.digits + string.punctuation
|
|
||||||
if passtype == 's':
|
|
||||||
passtype = string.ascii_letters + string.digits
|
|
||||||
passgen = ''.join(random.SystemRandom().choice(passtype) for _ in range(passlength))
|
|
||||||
url = str(input('URL: '))
|
|
||||||
notes = str(input('Additional notes: '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines(username + '\n' + passgen + '\n' + url + '\n' + notes + '\n\n')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines(username + '\n' + passgen + '\n' + url + '\n' + notes + '\n\n')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
with open('/dev/shm/' + shmfolder + '/' + shmentry, 'w') as f:
|
|
||||||
f.writelines(username + '\n' + passgen + '\n' + url + '\n' + notes + '\n\n')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
if argument == 'gen update' or argument == 'gen -u':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('Which password would you like to re-generate? '))
|
|
||||||
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) '))
|
|
||||||
# generate random strings for /dev/shm
|
|
||||||
shmfolder = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
shmentry = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
|
||||||
for _ in range(random.randint(10, 30)))
|
|
||||||
term('mkdir -p /dev/shm/' + shmfolder)
|
|
||||||
# end string and folder generation
|
|
||||||
if passtype != 's':
|
|
||||||
passtype = string.ascii_letters + string.digits + string.punctuation
|
|
||||||
if passtype == 's':
|
|
||||||
passtype = string.ascii_letters + string.digits
|
|
||||||
passgen = ''.join(random.SystemRandom().choice(passtype) for _ in range(passlength))
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
folder, sep, folderentry = entryname.replace('/', '', 1).partition('/')
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
folder + '/' + folderentry + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, passgen + '\n')
|
|
||||||
remove(directory + folder + '/' + folderentry.replace('/', '', 1) + '.gpg')
|
|
||||||
encryptfolder()
|
|
||||||
term('gpg -d ' + directory + folder + '/' + "'" + folderentry + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory +
|
|
||||||
entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, passgen + '\n')
|
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname.replace('/', '', 1) + '.gpg' + "'")
|
|
||||||
else:
|
|
||||||
term('gpg --output /dev/shm/' + shmfolder + '/' + shmentry + ' ' + directory + entryname + '.gpg')
|
|
||||||
replace_line('/dev/shm/' + shmfolder + '/' + shmentry, 1, passgen + '\n')
|
|
||||||
remove(directory + entryname + '.gpg')
|
|
||||||
encrypt()
|
|
||||||
term('gpg -d ' + directory + "'" + entryname + '.gpg' + "'")
|
|
||||||
|
|
||||||
# remove
|
|
||||||
|
|
||||||
if argument == 'remove' or argument == '-rm':
|
|
||||||
clear()
|
|
||||||
term('cd ~/.rpass-store; ls -1 *')
|
|
||||||
print()
|
|
||||||
entryname = str(input('What would you like to delete? '))
|
|
||||||
if entryname.startswith('/'):
|
|
||||||
if entryname.replace('/', '', 1).__contains__('/'):
|
|
||||||
remove(directory + entryname.replace('/', '', 1) + '.gpg')
|
|
||||||
else:
|
|
||||||
rmtree(directory + entryname.replace('/', '', 1))
|
|
||||||
else:
|
|
||||||
remove(directory + entryname + '.gpg')
|
|
||||||
|
|
||||||
# permissions - applied pre-sync to ensure permissions are correct before upload
|
|
||||||
|
|
||||||
term('find ' + directory + ' -type d -exec chmod -R 700 {} +')
|
|
||||||
term('find ' + directory + ' -type f -exec chmod -R 600 {} +')
|
|
||||||
|
|
||||||
# rsync - ran at end of program to ensure all files are properly synced
|
|
||||||
|
|
||||||
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':
|
|
||||||
rsyncup()
|
|
||||||
rsyncdown()
|
|
||||||
print()
|
|
||||||
print('Please note that as of this time, entries can only be deleted if removed from the central server in a '
|
|
||||||
'client-server scenario. This will be adjusted soon.')
|
|
||||||
print()
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
|
||||||
|
|
||||||
rpass-2021.09.08.pr4
|
|
||||||
|
|
||||||
The Housekeeping Update - Fourth public release of rpass
|
|
||||||
|
|
||||||
This release focuses primarily on polishing rpass and tying up loose ends before
|
|
||||||
making any major changes in the future.
|
|
||||||
|
|
||||||
New features:
|
|
||||||
|
|
||||||
**overhaul error message using exceptions
|
|
||||||
**add exceptions for unknown arguments
|
|
||||||
**make clean, colorful file list by exporting to document and removing extensions
|
|
||||||
**make a manpage
|
|
||||||
**multi-line notes?
|
|
||||||
|
|
||||||
Changes:
|
|
||||||
|
|
||||||
**move project to github
|
|
||||||
**change gpg prompt to get rid of expiration date
|
|
||||||
**get rid of gpg decryption warnings
|
|
||||||
**optimize code (specifically for when there is no folder but there is a slash)
|
|
||||||
**add version info argument
|
|
||||||
**update rsync config wizard
|
|
||||||
**properly comment the code
|
|
||||||
**validate for Python 3.10
|
|
||||||
|
|
||||||
Planned for next update (The Secret Update):
|
|
||||||
|
|
||||||
- allow to function as alternative to gnome keyring (libsecret integration)
|
|
||||||
|
|
||||||
Planned, no timeline:
|
|
||||||
|
|
||||||
- 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
|
|
||||||
- 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)
|
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
|
||||||
|
|
||||||
rpass 2021.09.07.pr3.1
|
|
||||||
|
|
||||||
The Sync and Foundations Update - Hotfix
|
|
||||||
|
|
||||||
Changes:
|
|
||||||
|
|
||||||
- gpg configuration now prompts for expiration, rather than defaulting to two years
|
|
||||||
- rsync is now configured to not delete anything from any remote device when uploading
|
|
||||||
^ this behavior may be modified in the future - this is a quick fix to prevent data loss
|
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
|
||||||
|
|
||||||
rpass 2021.09.07.pr3
|
|
||||||
|
|
||||||
The Sync and Foundations Update - Third public release of rpass.
|
|
||||||
|
|
||||||
As of this version, rpass has its intended base set of features and is considered usable.
|
|
||||||
It will now primarily recieve bug fixes and polish updates to prepare it to go
|
|
||||||
cross-platform and to make it compatible with GUI frontends.
|
|
||||||
|
|
||||||
New features:
|
|
||||||
|
|
||||||
- rsync support!
|
|
||||||
- new entry format with URL field (for future use)
|
|
||||||
- the temporary directory (/dev/shm) for editing entries has been somewhat secured
|
|
||||||
|
|
||||||
Changes:
|
|
||||||
|
|
||||||
- 'rpass edit relocate' is now properly bound
|
|
||||||
- dropped the use of 'echo'
|
|
||||||
- added 'rsync' and 'openssh' as dependencies
|
|
||||||
- fixed a bug with deleting entries from folders
|
|
||||||
- entry directory now has more secure permissions
|
|
||||||
^ these permissions are re-enforced every time rpass is used
|
|
||||||
- fixed some small typos and potential bugs, made some small optimizations
|
|
||||||
|
|
||||||
Planned for next update (The Housekeeping Update):
|
|
||||||
|
|
||||||
- move to github
|
|
||||||
- get rid of gpg decryption warnings
|
|
||||||
- proper error messages using 'except'
|
|
||||||
- add exceptions for unknown arguments
|
|
||||||
- cleanup file list by exporting to document and removing .gpg, adding color
|
|
||||||
- add a manpage
|
|
||||||
- allow notes to be multiple lines long (break lines after so many characters)
|
|
||||||
- validate for Python 3.10
|
|
||||||
- properly comment the code
|
|
||||||
|
|
||||||
Planned, no timeline:
|
|
||||||
|
|
||||||
- allow to function as alternative to gnome keyring (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
|
|
||||||
- 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)
|
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
|
||||||
|
|
||||||
rpass 2021.09.02.pr2
|
|
||||||
|
|
||||||
The Folder Update - Second public release of rpass.
|
|
||||||
|
|
||||||
New features:
|
|
||||||
|
|
||||||
- entry and folder titles can now have spaces and be as long as you want
|
|
||||||
- entires and folders can now be deleted with 'rpass remove' or 'rpass -rm'
|
|
||||||
- entries now properly save to folders via 'rpass add' and should no longer throw errors
|
|
||||||
- entries saved in folders are now readable
|
|
||||||
- existing entries can now be moved to, from, and between folders
|
|
||||||
- previews are now shown after creating or editing an entry
|
|
||||||
|
|
||||||
Changes:
|
|
||||||
|
|
||||||
- every pre-existing function of rpass has been updated to work with the new folder system
|
|
||||||
- dropped awk as a dependency
|
|
||||||
- removed 'argument' file in /var/lib/rpass
|
|
||||||
- reduced unneccessary characters in argument parsing to decrease compatibility issues
|
|
||||||
- ensured all user input is handled correctly as a string or an integer
|
|
||||||
- lots of miscellaneous optimizations
|
|
||||||
|
|
||||||
Expected for next update (The rsync Update):
|
|
||||||
|
|
||||||
- rsync (over ssh) support!
|
|
||||||
^ including any fixes, changes, or optimizations necessary to make that happen
|
|
||||||
- new file formatting with support for URLs
|
|
||||||
^all entries created in new format should be compatible with future versions of rpass
|
|
||||||
- secure /dev/shm with random text generator
|
|
||||||
|
|
||||||
Expected for the next (next) update (The Housekeeping Update)
|
|
||||||
|
|
||||||
- get rid of gpg decryption warnings
|
|
||||||
- proper error messages using 'except'
|
|
||||||
- add exceptions for unknown arguments
|
|
||||||
- cleanup file list by exporting to document and removing .gpg, adding color
|
|
||||||
|
|
||||||
Planned, no timeline:
|
|
||||||
|
|
||||||
- make platform agnostic (basically, add windows support)
|
|
||||||
- create separate gui frontend targetting mobile devices (first linux phones, android at a later date)
|
|
||||||
^ the gui will also function on desktop linux
|
|
||||||
- ability to pass entries as arguments for more functions
|
|
||||||
- auto-completion on tab
|
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
|
||||||
|
|
||||||
rpass 2021.09.01.pr1.1
|
|
||||||
|
|
||||||
First public release of rpass.
|
|
||||||
|
|
||||||
Early build, missing critical features (e.g. sync support and the ability to have spaces in filenames).
|
|
||||||
|
|
||||||
What is currently functional:
|
|
||||||
|
|
||||||
- guided configuration wizard
|
|
||||||
- generate passwords
|
|
||||||
- add existing passwords
|
|
||||||
- make notes
|
|
||||||
- sort notes and passwords into folders
|
|
||||||
- gpg encryption
|
|
||||||
- edit password/note entries
|
|
||||||
|
|
||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
|
||||||
Reference in New Issue
Block a user