Compare commits

...
5 changed files with 83 additions and 39 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ cd sshyp
makepkg -si makepkg -si
``` ```
Packaging for other distributions coming soon. Pre-built packages exist for Arch, Debian, and Termux. These can be downloaded from the releases page.
# 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.
+6 -9
View File
@@ -1,26 +1,23 @@
#!/usr/bin/python3 #!/usr/bin/python3
# sshync 2022.01.16.unreleased11 # sshync 2022.01.16.unreleased12
# external modules # external modules
from os import system, remove, mkdir, walk from os import path, system, walk
from os.path import getmtime, join, expanduser from os.path import getmtime, join, expanduser
from sys import exit as s_exit from sys import exit as s_exit
from pathlib import Path
# utility functions # utility functions
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 Path(path.expanduser('~/.config/sshync')).mkdir(0o700, parents=True, exist_ok=True) # create config directory
mkdir(expanduser('~/.config/sshync'), 0o700)
except FileExistsError:
pass
# local fetching # local fetching
if _destination == 'l': if _destination == 'l':
remove(expanduser('~/.config/sshync/database')) # assumed to exist because remote runs first open(expanduser('~/.config/sshync/database'), 'w').write('') # blanks out database file
open(expanduser('~/.config/sshync/database'), 'w') # create blank database file
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))
@@ -36,7 +33,7 @@ def get_titles_mods(_directory, _destination, _user_data):
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]}:" system(f"sftp -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:"
f"'{expanduser(f'/home/{_user_data[0]}/.config/sshync/database')}' " f"'{expanduser(f'/home/{_user_data[0]}/.config/sshync/database')}' "
f"'{expanduser('~/.config/sshync/database')}'") f"'{expanduser('~/.config/sshync/')}'")
_titles, _sep, _mods = ' '.join(open(expanduser('~/.config/sshync/database')).readlines()).replace('\n', '')\ _titles, _sep, _mods = ' '.join(open(expanduser('~/.config/sshync/database')).readlines()).replace('\n', '')\
.partition('^&*') .partition('^&*')
_title_list, _mod_list = _titles.split(' ')[:-1], _mods.split(' ')[1:] _title_list, _mod_list = _titles.split(' ')[:-1], _mods.split(' ')[1:]
+12 -21
View File
@@ -2,7 +2,7 @@
# external modules # external modules
from os import environ, mkdir, remove, system, path from os import environ, remove, system, path
from shutil import copy, move, rmtree from shutil import copy, move, rmtree
from sys import argv, exit as s_exit from sys import argv, exit as s_exit
from pathlib import Path from pathlib import Path
@@ -24,7 +24,7 @@ def shm_gen(): # generates a random temporary folder for security and returns r
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"{tmp_dir}{_shm_folder_gen}", 0o700) Path(tmp_dir + _shm_folder_gen).mkdir(0o700)
return _shm_folder_gen, _shm_entry_gen return _shm_folder_gen, _shm_entry_gen
@@ -48,17 +48,11 @@ 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: Path(path.expanduser('~/.password-pasture')).mkdir(0o700, parents=True, exist_ok=True)
mkdir(path.expanduser('~/.password-pasture'), 0o700) Path(path.expanduser('~/.config/sshyp')).mkdir(0o700, parents=True, exist_ok=True)
except FileExistsError: if not Path(f"{path.expanduser('~/.config/sshyp/tmp')}").exists():
pass if Path("/data/data/com.termux").exists():
try: system(f"ln -s '/data/data/com.termux/files/usr/tmp' {path.expanduser('~/.config/sshyp/tmp')}")
mkdir(path.expanduser('~/.config/sshyp'), 0o700)
except FileExistsError:
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: else:
system(f"ln -s /dev/shm {path.expanduser('~/.config/sshyp/tmp')}") system(f"ln -s /dev/shm {path.expanduser('~/.config/sshyp/tmp')}")
# device type configuration # device type configuration
@@ -83,10 +77,7 @@ def tweak(): # runs configuration wizard
open(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: open(path.expanduser('~/.config/sshyp/lock'), 'w')
open(path.expanduser('~/.config/sshyp/lock'), 'x').write('')
except FileExistsError:
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")
@@ -156,7 +147,7 @@ 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.16.fr3.2 /') print('/ Version 2022.01.17.fr3.3 /')
print('/ The Boxing Update /') print('/ The Boxing Update /')
print('/ /') print('/ /')
print('////////////////////////////////////////////////////////\n') print('////////////////////////////////////////////////////////\n')
@@ -242,7 +233,7 @@ def add_entry(): # adds a new entry
def add_folder(): # creates a new folder def add_folder(): # creates a new folder
_folder_name = str(input('Name of new folder: ')) _folder_name = str(input('Name of new folder: '))
mkdir(directory + _folder_name, 0o700) Path(directory + _folder_name).mkdir(0o700)
system(f"ssh -p {port} {username_ssh}@{ip} \"mkdir -p '{directory_ssh}{_folder_name}'\"") system(f"ssh -p {port} {username_ssh}@{ip} \"mkdir -p '{directory_ssh}{_folder_name}'\"")
@@ -348,7 +339,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output {tmp_dir}{_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"{tmp_dir}{_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").exists(): # 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("'", "'\\''") + "'")
elif argument == 'copy password' or argument == 'copy -p': elif argument == 'copy password' or argument == 'copy -p':
@@ -386,7 +377,7 @@ def remove_data(): # deletes an entry or folder from both the client and the se
_entry_name = _entry_name.replace('/', '', 1) _entry_name = _entry_name.replace('/', '', 1)
try: try:
system(f"gpg -d --output {tmp_dir}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('{tmp_dir}sshyp.lock', 'r').readlines() _unlock = open(f"{tmp_dir}sshyp.lock", 'r').readlines()
remove(f"{tmp_dir}sshyp.lock") remove(f"{tmp_dir}sshyp.lock")
except FileNotFoundError: except FileNotFoundError:
print('\nAccess denied.\n') print('\nAccess denied.\n')
+55 -2
View File
@@ -1,8 +1,61 @@
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2022.01.17.fr3.3
The Boxing Update - Patch 3
This release is a hotfix for 2022.01.16.fr3.2. It fixes major bugs, especially with Termux.
Changes:
- the temporary directory for Termux is now sym-linked with its full path (no longer dangling)
- the copy function can now properly detect if Termux is being used
- ~/.config is created, if it does not already exist
- "sshyp shear" now functions again, as a bug with the lock file has been fixed
- sshync -should- now properly detect the database file on all platforms (was broken on Termux)
- total lines of code have been slightly reduced with various small optimizations
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.2 sshyp 2022.01.16.fr3.2
The Boxing Update The Boxing Update - Patch 2
This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux. This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux.
@@ -52,7 +105,7 @@ Backlog:
sshyp 2022.01.16.fr3.1 sshyp 2022.01.16.fr3.1
The Boxing Update The Boxing Update - Patch 1
This release is a hotfix for 2022.01.13.fr3. It fixes sshync/syncing support after the changes in the last release. This release is a hotfix for 2022.01.13.fr3. It fixes sshync/syncing support after the changes in the last release.
+9 -6
View File
@@ -1,14 +1,17 @@
sshyp 2022.01.16.fr3.2 sshyp 2022.01.17.fr3.3
The Boxing Update The Boxing Update - Patch 3
This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux. This release is a hotfix for 2022.01.16.fr3.2. It fixes major bugs, especially with Termux.
Changes: Changes:
- sshyp now uses a symlink to the temporary storage directory, allowing for easy implementation of different temporary directories on different platforms - the temporary directory for Termux is now sym-linked with its full path (no longer dangling)
^ the first usage of this is enabling the use of temporary storage on Termux - the copy function can now properly detect if Termux is being used
- sshync now properly auto-generates its config directory - ~/.config is created, if it does not already exist
- "sshyp shear" now functions again, as a bug with the lock file has been fixed
- sshync -should- now properly detect the database file on all platforms (was broken on Termux)
- total lines of code have been slightly reduced with various small optimizations
Additions planned for minor releases: Additions planned for minor releases: