Compare commits

...
5 changed files with 185 additions and 82 deletions
+4 -2
View File
@@ -47,7 +47,7 @@ Packaging for other distributions coming soon.
# Building # Building
Since sshyp is written entirely in Python, it doesn't need to be compiled. It does, however, need to be packaged for installation. Since sshyp is written entirely in Python, it doesn't need to be compiled. It does, however, need to be packaged for installation.
A packaging script is included in the root directory of the repo in order to package sshyp for your distribution (currently only a generic package used for the AUR PKGBUILD is supported). To package sshyp from source, simply run: A packaging script is included in the root directory of the repo in order to package sshyp for your distribution. To package sshyp from source, simply run:
``` ```
git clone https://github.com/rwinkhart/sshyp.git git clone https://github.com/rwinkhart/sshyp.git
@@ -55,9 +55,11 @@ cd sshyp
./package.sh ./package.sh
``` ```
The packaging script has been tested on Arch Linux with dpkg as a dependency for Debian and Termux packaging.
The AUR version and the packages attatched to the release tags were already packaged using this script. The AUR version and the packages attatched to the release tags were already packaged using this script.
Packaging for other distributions coming soon. Currently, the script can create packages for Arch (PKGBUILD), Debian, Termux, and generic. Packaging for other distributions coming soon.
# Usage # Usage
Upon initial installation (on both the server and client devices), be sure to run: Upon initial installation (on both the server and client devices), be sure to run:
+18 -18
View File
@@ -1,11 +1,11 @@
#!/usr/bin/python3 #!/usr/bin/python3
# sshync 2022.01.10.unreleased8 # sshync 2022.01.16.unreleased11
# external modules # external modules
from os import system, remove, walk from os import system, remove, mkdir, walk
from os.path import getmtime, join from os.path import getmtime, join, expanduser
from sys import exit as s_exit from sys import exit as s_exit
@@ -13,31 +13,32 @@ from sys import exit as s_exit
def get_titles_mods(_directory, _destination, _user_data): def get_titles_mods(_directory, _destination, _user_data):
_title_list, _mod_list = [], [] _title_list, _mod_list = [], []
try: # create config directory
mkdir(expanduser('~/.config/sshync'), 0o700)
except FileExistsError:
pass
# local fetching # local fetching
if _destination == 'l': if _destination == 'l':
if type(_user_data) == str: remove(expanduser('~/.config/sshync/database')) # assumed to exist because remote runs first
_user_data = str(_user_data).strip('(').strip(')').replace(' ', '').split(',') open(expanduser('~/.config/sshync/database'), 'w') # create blank database file
try:
remove(_user_data[6] + 'sshync_database')
except FileNotFoundError:
pass
for _root, _directories, _files in walk(_directory): for _root, _directories, _files in walk(_directory):
for _filename in _files: for _filename in _files:
_title_list.append(join(_root.replace(_directory, '', 1), _filename)) _title_list.append(join(_root.replace(_directory, '', 1), _filename))
_mod_list.append(int(getmtime(join(_root, _filename)))) _mod_list.append(int(getmtime(join(_root, _filename))))
i = -1
for _title in _title_list: for _title in _title_list:
open(_user_data[6] + 'sshync_database', 'a').write(str(_title) + '\n') open(expanduser('~/.config/sshync/database'), 'a').write(str(_title) + '\n')
open(_user_data[6] + 'sshync_database', 'a').write('^&*\n') open(expanduser('~/.config/sshync/database'), 'a').write('^&*\n')
for _mod in _mod_list: for _mod in _mod_list:
open(_user_data[6] + 'sshync_database', 'a').write(str(_mod) + '\n') open(expanduser('~/.config/sshync/database'), 'a').write(str(_mod) + '\n')
# remote fetching # remote fetching
if _destination == 'r': if _destination == 'r':
system(f"ssh -i '{_user_data[5]}' -p {_user_data[2]} {_user_data[0]}@{_user_data[1]} \"python -c 'import sshync" system(f"ssh -i '{_user_data[5]}' -p {_user_data[2]} {_user_data[0]}@{_user_data[1]} \"python -c 'import sshync"
f"; sshync.get_titles_mods(\"'\"{_user_data[4]}\"'\", \"'\"l\"'\", \"'\"{_user_data}\"'\")'\"") f"; sshync.get_titles_mods(\"'\"{_user_data[4]}\"'\", \"'\"l\"'\", \"'\"{_user_data}\"'\")'\"")
system(f"sftp -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:'{_user_data[6]}sshync_database' " system(f"sftp -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:"
f"'{_user_data[6]}sshync_database'") f"'{expanduser(f'/home/{_user_data[0]}/.config/sshync/database')}' "
_titles, _sep, _mods = ' '.join(open(_user_data[6] + 'sshync_database').readlines()).replace('\n', '').partition('^&*') f"'{expanduser('~/.config/sshync/database')}'")
_titles, _sep, _mods = ' '.join(open(expanduser('~/.config/sshync/database')).readlines()).replace('\n', '')\
.partition('^&*')
_title_list, _mod_list = _titles.split(' ')[:-1], _mods.split(' ')[1:] _title_list, _mod_list = _titles.split(' ')[:-1], _mods.split(' ')[1:]
return _title_list, _mod_list return _title_list, _mod_list
@@ -76,8 +77,7 @@ def get_profile(_profile_dir):
_local_dir = _profile_data[3].replace('\n', '') _local_dir = _profile_data[3].replace('\n', '')
_remote_dir = _profile_data[4].replace('\n', '') _remote_dir = _profile_data[4].replace('\n', '')
_identity = _profile_data[5].replace('\n', '') _identity = _profile_data[5].replace('\n', '')
_data_dir = ' '.join(_profile_dir.split('/')[:-1]).replace(' ', '/') + '/' return _user, _ip, _port, _local_dir, _remote_dir, _identity
return _user, _ip, _port, _local_dir, _remote_dir, _identity, _data_dir
def run_profile(_profile_dir): def run_profile(_profile_dir):
+57 -52
View File
@@ -19,28 +19,28 @@ def replace_line(file_name, line_num, text): # replaces text in a given line wi
open(file_name, 'w').writelines(_lines) open(file_name, 'w').writelines(_lines)
def shm_gen(): # generates random folder in /dev/shm for security and returns random names for the folder and temp file def shm_gen(): # generates a random temporary folder for security and returns random names for the folder and temp file
_shm_folder_gen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) _shm_folder_gen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
for _ in range(random.randint(10, 30))) for _ in range(random.randint(10, 30)))
_shm_entry_gen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) _shm_entry_gen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
for _ in range(random.randint(10, 30))) for _ in range(random.randint(10, 30)))
mkdir(f"/dev/shm/{_shm_folder_gen}", 0o700) mkdir(f"{tmp_dir}{_shm_folder_gen}", 0o700)
return _shm_folder_gen, _shm_entry_gen return _shm_folder_gen, _shm_entry_gen
def encrypt(_shm_folder, _shm_entry, _location): def encrypt(_shm_folder, _shm_entry, _location):
system(f"gpg -r {str(gpg_id)} -e '/dev/shm/{_shm_folder}/{_shm_entry}'") system(f"gpg -r {str(gpg_id)} -e '{tmp_dir}{_shm_folder}/{_shm_entry}'")
move(f"/dev/shm/{_shm_folder}/{_shm_entry}.gpg", f"{directory}{_location}.gpg") move(f"{tmp_dir}{_shm_folder}/{_shm_entry}.gpg", f"{directory}{_location}.gpg")
rmtree(f"/dev/shm/{_shm_folder}") rmtree(f"{tmp_dir}{_shm_folder}")
def edit_note(_shm_folder, _shm_entry): def edit_note(_shm_folder, _shm_entry):
lines = open(f"/dev/shm/{_shm_folder}/{_shm_entry}").readlines() lines = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}").readlines()
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'w').writelines(lines[0:3]) open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines(lines[0:3])
open(f"/dev/shm/{_shm_folder}/{_shm_entry}-n", 'w').writelines(lines[4:-2]) open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'w').writelines(lines[4:-2])
system(f"nano /dev/shm/{_shm_folder}/{_shm_entry}-n") system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
edit_notes = open(f"/dev/shm/{_shm_folder}/{_shm_entry}-n").read() edit_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n").read()
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'a').write('\n' + edit_notes + '\n\n') open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'a').write('\n' + edit_notes + '\n\n')
# argument-specific functions # argument-specific functions
@@ -49,25 +49,29 @@ def edit_note(_shm_folder, _shm_entry):
def tweak(): # runs configuration wizard def tweak(): # runs configuration wizard
# storage/config directory creation # storage/config directory creation
try: try:
mkdir(f"{path.expanduser('~')}/.password-pasture", 0o700) mkdir(path.expanduser('~/.password-pasture'), 0o700)
except FileExistsError: except FileExistsError:
pass pass
try: try:
mkdir(path.expanduser('~/.config/sshyp'), 0o700) mkdir(path.expanduser('~/.config/sshyp'), 0o700)
except FileExistsError: except FileExistsError:
pass pass
if not Path(f"{path.expanduser('~/.config/sshyp/tmp')}").is_file():
if Path("/data/data/com.termux").is_file():
system(f"ln -s {path.expanduser('~/../usr/tmp')} {path.expanduser('~/.config/sshyp/tmp')}")
else:
system(f"ln -s /dev/shm {path.expanduser('~/.config/sshyp/tmp')}")
# device type configuration # device type configuration
_device_type = input('\nIs this installation for a client or for a server? (C/s) ') _device_type = input('\nIs this installation for a client or for a server? (C/s) ')
if _device_type.lower() == 's': if _device_type.lower() == 's':
open(f"{path.expanduser('~/.config/sshyp')}/sshyp-device", 'w').write(_device_type) open(path.expanduser('~/.config/sshyp/sshyp-device'), 'w').write(_device_type)
copy('/usr/bin/sshync.py', path.expanduser('~/')) copy('/usr/bin/sshync.py', path.expanduser('~/'))
print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!\n') print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!\n')
s_exit() s_exit()
else: else:
# device type configuration # device type configuration
_device_type = 'c' # ensure device type flag is properly set _device_type = 'c' # ensure device type flag is properly set
open(f"{path.expanduser('~/.config/sshyp')}/sshyp-device", 'w').write(_device_type) open(path.expanduser('~/.config/sshyp/sshyp-device'), 'w').write(_device_type)
# gpg configuration # gpg configuration
_gpg_id = input('\nsshyp requires the use of a unique gpg key. Do you already have one that you are ' _gpg_id = input('\nsshyp requires the use of a unique gpg key. Do you already have one that you are '
@@ -76,14 +80,14 @@ def tweak(): # runs configuration wizard
print('\nA unique gpg key has been generated for you.') print('\nA unique gpg key has been generated for you.')
system('gpg --full-generate-key') system('gpg --full-generate-key')
_gpg_id = str(input('\nPlease input the ID of your gpg key: ')) _gpg_id = str(input('\nPlease input the ID of your gpg key: '))
open(f"{path.expanduser('~/.config/sshyp')}/sshyp-gpg", 'w').write(_gpg_id + '\n') open(path.expanduser('~/.config/sshyp/sshyp-gpg'), 'w').write(_gpg_id + '\n')
# lock file generation # lock file generation
try: try:
open(f"{path.expanduser('~/.config/sshyp')}/lock", 'x').write('') open(path.expanduser('~/.config/sshyp/lock'), 'x').write('')
except FileExistsError: except FileExistsError:
pass pass
system(f"gpg -r {str(_gpg_id)} -e {path.expanduser('~/.config/sshyp')}/lock") system(f"gpg -r {str(_gpg_id)} -e {path.expanduser('~/.config/sshyp/lock')}")
remove(f"{path.expanduser('~/.config/sshyp')}/lock") remove(f"{path.expanduser('~/.config/sshyp')}/lock")
# ssh key configuration # ssh key configuration
@@ -93,7 +97,7 @@ def tweak(): # runs configuration wizard
if _ssh_gen.lower() != 'n': if _ssh_gen.lower() != 'n':
system('ssh-keygen -t ed25519 -f ~/.ssh/sshyp') system('ssh-keygen -t ed25519 -f ~/.ssh/sshyp')
else: else:
print(f"\nEnsure that the key file you are using is located at {path.expanduser('~')}/.ssh/sshyp") print(f"\nEnsure that the key file you are using is located at {path.expanduser('~/.ssh/sshyp')}")
# ssh ip+port configuration # ssh ip+port configuration
print('\nExample input: 10.10.10.10:9999\n') print('\nExample input: 10.10.10.10:9999\n')
@@ -105,9 +109,9 @@ def tweak(): # runs configuration wizard
print(f"\nEntry directory: /home/{_username_ssh}/.password-pasture/") print(f"\nEntry directory: /home/{_username_ssh}/.password-pasture/")
# sshync profile generation # sshync profile generation
sshync.make_profile(f"{path.expanduser('~/.config/sshyp')}/sshyp.sshync", sshync.make_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'),
f"{path.expanduser('~')}/.password-pasture/", f"/home/{_username_ssh}/.password-pasture/", path.expanduser('~/.password-pasture/'), f"/home/{_username_ssh}/.password-pasture/",
f"{path.expanduser('~')}/.ssh/sshyp", _ip, _port, _username_ssh) path.expanduser('~/.ssh/sshyp'), _ip, _port, _username_ssh)
print('\nConfiguration complete!\n') print('\nConfiguration complete!\n')
@@ -152,8 +156,8 @@ def print_info(): # prints help text based on argument
print('/ /') print('/ /')
print('/ sshyp Copyright (C) 2021 Randall Winkhart /') print('/ sshyp Copyright (C) 2021 Randall Winkhart /')
print('/ /') print('/ /')
print('/ Version 2022.01.13.fr3 /') print('/ Version 2022.01.16.fr3.2 /')
print('/ The Boxing Update /') print('/ The Boxing Update /')
print('/ /') print('/ /')
print('////////////////////////////////////////////////////////\n') print('////////////////////////////////////////////////////////\n')
elif argument == 'license': elif argument == 'license':
@@ -206,7 +210,7 @@ def sync(): # calls sshync to sync changes to the user's server
# set permissions before uploading # set permissions before uploading
system('find ' + directory + ' -type d -exec chmod -R 700 {} +') system('find ' + directory + ' -type d -exec chmod -R 700 {} +')
system('find ' + directory + ' -type f -exec chmod -R 600 {} +') system('find ' + directory + ' -type f -exec chmod -R 600 {} +')
sshync.run_profile(f"{path.expanduser('~/.config/sshyp')}/sshyp.sshync") sshync.run_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'))
def add_entry(): # adds a new entry def add_entry(): # adds a new entry
@@ -216,9 +220,9 @@ def add_entry(): # adds a new entry
_entry_name = _entry_name.replace('/', '', 1) _entry_name = _entry_name.replace('/', '', 1)
if argument == 'add note' or argument == 'add -n': if argument == 'add note' or argument == 'add -n':
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"nano /dev/shm/{_shm_folder}/{_shm_entry}-n") system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
_notes = open(f"/dev/shm/{_shm_folder}/{_shm_entry}-n", 'r').read() _notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n\n' + _notes + '\n\n') open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n\n' + _notes + '\n\n')
elif argument == 'add password' or argument == 'add -p': elif argument == 'add password' or argument == 'add -p':
_username = str(input('Username: ')) _username = str(input('Username: '))
_password = str(input('Password: ')) _password = str(input('Password: '))
@@ -226,11 +230,11 @@ def add_entry(): # adds a new entry
_add_note = input('Add a note to this entry? (y/N) ') _add_note = input('Add a note to this entry? (y/N) ')
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
if _add_note.lower() == 'y': if _add_note.lower() == 'y':
system(f"nano /dev/shm/{_shm_folder}/{_shm_entry}-n") system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
_notes = open(f"/dev/shm/{_shm_folder}/{_shm_entry}-n", 'r').read() _notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
else: else:
_notes = '' _notes = ''
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'w').writelines(_username + '\n' + _password + '\n' + _url + '\n\n' open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines(_username + '\n' + _password + '\n' + _url + '\n\n'
+ _notes + '\n\n') + _notes + '\n\n')
encrypt(_shm_folder, _shm_entry, _entry_name) encrypt(_shm_folder, _shm_entry, _entry_name)
system(f"gpg -d '{directory}{_entry_name}.gpg'") system(f"gpg -d '{directory}{_entry_name}.gpg'")
@@ -270,21 +274,21 @@ def edit(): # edits the contents of an entry
if argument == 'edit username' or argument == 'edit -u': if argument == 'edit username' or argument == 'edit -u':
_detail = str(input('New Username: ')) _detail = str(input('New Username: '))
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'") system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
replace_line(f"/dev/shm/{_shm_folder}/{_shm_entry}", 0, _detail + '\n') replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 0, _detail + '\n')
elif argument == 'edit password' or argument == 'edit -p': elif argument == 'edit password' or argument == 'edit -p':
_detail = str(input('New Password: ')) _detail = str(input('New Password: '))
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'") system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
replace_line(f"/dev/shm/{_shm_folder}/{_shm_entry}", 1, _detail + '\n') replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 1, _detail + '\n')
elif argument == 'edit url' or argument == 'edit -l': elif argument == 'edit url' or argument == 'edit -l':
_detail = str(input('New URL: ')) _detail = str(input('New URL: '))
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'") system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
replace_line(f"/dev/shm/{_shm_folder}/{_shm_entry}", 2, _detail + '\n') replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 2, _detail + '\n')
elif argument == 'edit note' or argument == 'edit -n': elif argument == 'edit note' or argument == 'edit -n':
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'") system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
edit_note(_shm_folder, _shm_entry) edit_note(_shm_folder, _shm_entry)
remove(f"{directory}{_entry_name}.gpg") remove(f"{directory}{_entry_name}.gpg")
encrypt(_shm_folder, _shm_entry, _entry_name) encrypt(_shm_folder, _shm_entry, _entry_name)
@@ -317,18 +321,18 @@ def gen(): # generates a password for a new or an existing entry
_add_note = input('Add a note to this entry? (y/N) ') _add_note = input('Add a note to this entry? (y/N) ')
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
if _add_note.lower() == 'y': if _add_note.lower() == 'y':
system(f"nano /dev/shm/{_shm_folder}/{_shm_entry}-n") system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
_notes = open(f"/dev/shm/{_shm_folder}/{_shm_entry}-n", 'r').read() _notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
else: else:
_notes = '' _notes = ''
open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'w').writelines(_username + '\n' + _pass_gen + '\n' + _url + '\n\n' open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines(_username + '\n' + _pass_gen + '\n' + _url + '\n\n'
+ _notes + '\n\n') + _notes + '\n\n')
encrypt(_shm_folder, _shm_entry, _entry_name) encrypt(_shm_folder, _shm_entry, _entry_name)
system(f"gpg -d '{directory}{_entry_name}.gpg'") system(f"gpg -d '{directory}{_entry_name}.gpg'")
else: else:
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'") system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_entry_name}.gpg'")
replace_line(f"/dev/shm/{_shm_folder}/{_shm_entry}", 1, _pass_gen + '\n') replace_line(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 1, _pass_gen + '\n')
remove(f"{directory}{_entry_name}.gpg") remove(f"{directory}{_entry_name}.gpg")
encrypt(_shm_folder, _shm_entry, _entry_name) encrypt(_shm_folder, _shm_entry, _entry_name)
system(f"gpg -d '{directory}{_entry_name}.gpg'") system(f"gpg -d '{directory}{_entry_name}.gpg'")
@@ -342,8 +346,8 @@ def copy_data(): # copies a specified field of an entry to the clipboard
print("\nThe file does not exist!\n") print("\nThe file does not exist!\n")
s_exit() s_exit()
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'") system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'")
_copy_line = open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'r').readlines() _copy_line = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'r').readlines()
if Path("/data/data/com.termux").is_file(): # checks for Termux, Wayland, or X if Path("/data/data/com.termux").is_file(): # checks for Termux, Wayland, or X
if argument == 'copy username' or argument == 'copy -u': if argument == 'copy username' or argument == 'copy -u':
system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'") system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
@@ -371,7 +375,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c') system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
elif argument == 'copy note' or argument == 'copy -n': elif argument == 'copy note' or argument == 'copy -n':
system('echo -n ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c') system('echo -n ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
rmtree(f"/dev/shm/{_shm_folder}") rmtree(f"{tmp_dir}{_shm_folder}")
def remove_data(): # deletes an entry or folder from both the client and the server def remove_data(): # deletes an entry or folder from both the client and the server
@@ -381,9 +385,9 @@ def remove_data(): # deletes an entry or folder from both the client and the se
if _entry_name.startswith('/'): if _entry_name.startswith('/'):
_entry_name = _entry_name.replace('/', '', 1) _entry_name = _entry_name.replace('/', '', 1)
try: try:
system(f"gpg -d --output /dev/shm/sshyp.lock {path.expanduser('~/.config/sshyp')}/lock.gpg") system(f"gpg -d --output {tmp_dir}sshyp.lock {path.expanduser('~/.config/sshyp/lock.gpg')}")
_unlock = open('/dev/shm/sshyp.lock', 'r').readlines() _unlock = open('{tmp_dir}sshyp.lock', 'r').readlines()
remove('/dev/shm/sshyp.lock') remove(f"{tmp_dir}sshyp.lock")
except FileNotFoundError: except FileNotFoundError:
print('\nAccess denied.\n') print('\nAccess denied.\n')
s_exit() s_exit()
@@ -406,11 +410,12 @@ argument = argument[:-1]
# import saved userdata # import saved userdata
if argument != 'tweak': if argument != 'tweak':
device_type = '' device_type = ''
tmp_dir = path.expanduser('~/.config/sshyp/tmp/')
try: try:
device_type = open(f"{path.expanduser('~/.config/sshyp')}/sshyp-device").read().strip() device_type = open(path.expanduser('~/.config/sshyp/sshyp-device')).read().strip()
if device_type == 'c': if device_type == 'c':
gpg_id = open(f"{path.expanduser('~/.config/sshyp')}/sshyp-gpg").read().strip() gpg_id = open(path.expanduser('~/.config/sshyp/sshyp-gpg')).read().strip()
ssh_info = sshync.get_profile(f"{path.expanduser('~/.config/sshyp')}/sshyp.sshync") ssh_info = sshync.get_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'))
username_ssh = ssh_info[0].replace('\n', '') username_ssh = ssh_info[0].replace('\n', '')
ip = ssh_info[1].replace('\n', '') ip = ssh_info[1].replace('\n', '')
port = ssh_info[2].replace('\n', '') port = ssh_info[2].replace('\n', '')
+101
View File
@@ -1,5 +1,106 @@
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2022.01.16.fr3.2
The Boxing Update
This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux.
Changes:
- sshyp now uses a symlink to the temporary storage directory, allowing for easy implementation of different temporary directories on different platforms
^ the first usage of this is enabling the use of temporary storage on Termux
- sshync now properly auto-generates its config directory
Additions planned for minor releases:
** updated the manpage with more information regarding how sshyp works and how to set it up
** ensured that it is now impossible for ghosts of entires to remain in /dev/shm
** reduced total lines of code with small optimizations
&&
Planned for next major update (fr4, The sshyp Doing a Split Update):
sshyp:
** sshyp has recieved a major visual overhaul
^ this includes the new file list and thematic text art
sshync:
** sshync has been split into a separate package and now has standalone functionality as a backup/syncing utility
^ more details will be available in the sshync repo, once it is created
&&
Planned for next, next major update (fr5, The Farmer Shearing the sshyp Update):
** allow for multi-client deletion... somehow (in sshync)
** when syncing, a check is made to see if any folders are not on all devices - if the check comes back true, it is corrected (in sshyp)
** imporove password generator to guarantee more secure results
** enforce permissions on the server-side
** allow for copying entire notes (not just first line)
** ability to pass entries as arguments for more functions
&&
Backlog:
** create separate gui frontend targetting mobile and desktop Linux
** auto-completion on tab (currently unsure of best way to make this work)
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2022.01.16.fr3.1
The Boxing Update
This release is a hotfix for 2022.01.13.fr3. It fixes sshync/syncing support after the changes in the last release.
Changes:
- sshync has been updated to work with the new config directory
- sshync now uses its own directory to store the database file
^ this is preperation for separating sshync into its own package
- expanduser lines in sshyp have been simplified (no user-facing impact)
Additions planned for minor releases:
** updated the manpage with more information regarding how sshyp works and how to set it up
** ensured that it is now impossible for ghosts of entires to remain in /dev/shm
** reduced total lines of code with small optimizations
&&
Planned for next major update (fr4, The sshyp Doing a Split Update):
sshyp:
** sshyp has recieved a major visual overhaul
^ this includes the new file list and thematic text art
sshync:
** sshync has been split into a separate package and now has standalone functionality as a backup/syncing utility
^ more details will be available in the sshync repo, once it is created
&&
Planned for next, next major update (fr5, The Farmer Shearing the sshyp Update):
** allow for multi-client deletion... somehow (in sshync)
** when syncing, a check is made to see if any folders are not on all devices - if the check comes back true, it is corrected (in sshyp)
** imporove password generator to guarantee more secure results
** enforce permissions on the server-side
** allow for copying entire notes (not just first line)
** ability to pass entries as arguments for more functions
&&
Backlog:
** create separate gui frontend targetting mobile and desktop Linux
** auto-completion on tab (currently unsure of best way to make this work)
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2022.01.13.fr3 sshyp 2022.01.13.fr3
The Boxing Update The Boxing Update
+5 -10
View File
@@ -1,19 +1,14 @@
sshyp 2022.01.13.fr3 sshyp 2022.01.16.fr3.2
The Boxing Update The Boxing Update
This release adapts sshyp to be compatible with Termux and allows for packaging for various distributions in addition to Arch Linux. This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux.
Features:
- the copy function now has support for termux-clipboard-set from termux-api
^ this allows clipboard functionality to work on Termux
Changes: Changes:
- sshyp no longer writes to/reads from /var - sshyp now uses a symlink to the temporary storage directory, allowing for easy implementation of different temporary directories on different platforms
^ configuration files are now stored under the user's home directory in ~/.config/sshyp ^ the first usage of this is enabling the use of temporary storage on Termux
^ this change allows for compatibility with less standard environments, such as Termux on Android - sshync now properly auto-generates its config directory
Additions planned for minor releases: Additions planned for minor releases: