Compare commits

..
5 changed files with 173 additions and 76 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
# Maintainer: Randall Winkhart <idgr at tutanota dot com> # Maintainer: Randall Winkhart <idgr at tutanota dot com>
pkgname=sshyp pkgname=sshyp
pkgver=2021.12.01.fr2 pkgver=2021.12.01.fr2.2
pkgrel=1 pkgrel=1
pkgdesc='A self-hosted, synchronized password manager' pkgdesc='A self-hosted, synchronized password manager'
url='https://github.com/rwinkhart/sshyp' url='https://github.com/rwinkhart/sshyp'
@@ -9,10 +9,10 @@ arch=('x86_64' 'aarch64')
license=('GPL3') license=('GPL3')
depends=( python gnupg openssh nano xclip wl-clipboard) depends=( python gnupg openssh nano xclip wl-clipboard)
source_x86_64=('https://github.com/rwinkhart/sshyp/releases/download/v2021.12.01.fr2/sshyp-2021.12.01.fr2.tar.xz') source_x86_64=('https://github.com/rwinkhart/sshyp/releases/download/v2021.12.01.fr2.2/sshyp-2021.12.01.fr2.2.tar.xz')
source_aarch64=('https://github.com/rwinkhart/sshyp/releases/download/v2021.12.01.fr2/sshyp-2021.12.01.fr2.tar.xz') source_aarch64=('https://github.com/rwinkhart/sshyp/releases/download/v2021.12.01.fr2.2/sshyp-2021.12.01.fr2.2.tar.xz')
sha512sums_x86_64=('88b1db43a0234e00cc9b2b5aa6aff642a350109e101a1ebc95e06e7ebc294b09c8369eead06fd16bbffd1f6ce564fb1e8736685ee716f7806532710d7357a5cb') sha512sums_x86_64=('470f7b4fd2bb0cc34a98e8ab5506ae4bc82e311616e2a81ee4fc559dd9e2c2e46a05517a49ba4d4fe108f341f92250bd1d63acca134d277b37d2475e03713adf')
sha512sums_aarch64=('88b1db43a0234e00cc9b2b5aa6aff642a350109e101a1ebc95e06e7ebc294b09c8369eead06fd16bbffd1f6ce564fb1e8736685ee716f7806532710d7357a5cb') sha512sums_aarch64=('470f7b4fd2bb0cc34a98e8ab5506ae4bc82e311616e2a81ee4fc559dd9e2c2e46a05517a49ba4d4fe108f341f92250bd1d63acca134d277b37d2475e03713adf')
package() { package() {
+12 -9
View File
@@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
# sshync 2021.12.01.unreleased6 # sshync 2021.12.01.unreleased7
# external modules # external modules
@@ -17,7 +17,10 @@ def get_titles_mods(_directory, _destination, _user_data):
if _destination == 'l': if _destination == 'l':
if type(_user_data) == str: if type(_user_data) == str:
_user_data = str(_user_data).strip('(').strip(')').replace(' ', '').split(',') _user_data = str(_user_data).strip('(').strip(')').replace(' ', '').split(',')
try:
remove(_user_data[6] + 'sshync_database') 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))
@@ -89,18 +92,18 @@ def run_profile(_profile_dir):
# compare mod times and sync # compare mod times and sync
if int(_index_l[1][_i]) > int(_index_r[1][_i]): if int(_index_l[1][_i]) > int(_index_r[1][_i]):
print(f"[{_title}] Local is newer, uploading...") print(f"[{_title}] Local is newer, uploading...")
system(f"sftp -p -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:" system(f"sftp -p -q -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:"
f"{_user_data[4]}{_title} <<< $'put {_user_data[3]}{_title}'") f"{_user_data[4]}{'/'.join(_title.split('/')[:-1]) + '/'} <<< $'put {_user_data[3]}{_title}'")
elif int(_index_l[1][_i]) < int(_index_r[1][_i]): elif int(_index_l[1][_i]) < int(_index_r[1][_i]):
print(f"[{_title}] Remote is newer, downloading...") print(f"[{_title}] Remote is newer, downloading...")
system(f"sftp -p -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:" system(f"sftp -p -q -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:"
f"{_user_data[4]}{_title} {_user_data[3]}{_title}") f"{_user_data[4]}{_title} {_user_data[3]}{'/'.join(_title.split('/')[:-1]) + '/'}")
else: else:
print(f"[{_title}] Not on remote server, uploading...") print(f"[{_title}] Not on remote server, uploading...")
system(f"sftp -p -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:{_user_data[4]}" system(f"sftp -p -q -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:{_user_data[4]}"
f"{_title} <<< $'put {_user_data[3]}{_title}'") f"{'/'.join(_title.split('/')[:-1]) + '/'} <<< $'put {_user_data[3]}{_title}'")
for _title in _index_r[0]: for _title in _index_r[0]:
if _title not in _index_l[0]: if _title not in _index_l[0]:
print(f"[{_title}] Not in local directory, downloading...") print(f"[{_title}] Not in local directory, downloading...")
system(f"sftp -p -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:{_user_data[4]}" system(f"sftp -p -q -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:{_user_data[4]}"
f"{_title} {_user_data[3]}{_title}") f"{_title} {_user_data[3]}{'/'.join(_title.split('/')[:-1]) + '/'}")
+29 -26
View File
@@ -2,7 +2,7 @@
# external modules # external modules
from os import environ, remove, system from os import environ, mkdir, remove, system
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
import random import random
@@ -12,16 +12,6 @@ import string
# utility functions # utility functions
def argument_filter(): # filters arguments to usable text
_argument_list = argv
_i, _argument = 0, ''
for _ in _argument_list:
while _i < len(_argument_list) - 1:
_i += 1
_argument += _argument_list[_i] + ' '
return _argument[:-1]
def replace_line(file_name, line_num, text): # replaces text in a given line with different text def replace_line(file_name, line_num, text): # replaces text in a given line with different text
_lines = open(file_name, 'r').readlines() _lines = open(file_name, 'r').readlines()
_lines[line_num] = text _lines[line_num] = text
@@ -33,7 +23,7 @@ def shm_gen(): # generates random folder in /dev/shm 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)))
system(f"mkdir -p /dev/shm/{_shm_folder_gen}") # TODO generate with Python mkdir(f"/dev/shm/{_shm_folder_gen}", 0o700)
return _shm_folder_gen, _shm_entry_gen return _shm_folder_gen, _shm_entry_gen
@@ -57,14 +47,18 @@ def edit_note(_shm_folder, _shm_entry):
def tweak(): # runs configuration wizard def tweak(): # runs configuration wizard
# storage directory creation # storage directory creation
system(f"mkdir -p /home/{environ.get('USER')}/.password-pasture") try:
mkdir(f"/home/{environ.get('USER')}/.password-pasture", 0o700)
except FileExistsError:
pass
# 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 == 'S' or _device_type == 's': if _device_type == 'S' or _device_type == 's':
open("/var/lib/sshyp/sshyp-device", 'w').write(_device_type) open("/var/lib/sshyp/sshyp-device", 'w').write(_device_type)
copy('/usr/bin/sshync.py', f"/home/{environ.get('USER')}/") copy('/usr/bin/sshync.py', f"/home/{environ.get('USER')}/")
print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!') print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!\n')
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
@@ -154,7 +148,7 @@ def version(): # displays version information
print('/ /') print('/ /')
print('/ sshyp Copyright (C) 2021 Randall Winkhart /') print('/ sshyp Copyright (C) 2021 Randall Winkhart /')
print('/ /') print('/ /')
print('/ Version 2021.12.01.fr2 /') print('/ Version 2021.12.01.fr2.2 /')
print('/ The Lighter Update /') print('/ The Lighter Update /')
print('/ /') print('/ /')
print('////////////////////////////////////////////////////////\n') print('////////////////////////////////////////////////////////\n')
@@ -225,7 +219,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: '))
system(f"mkdir '{directory}{_folder_name}'") # TODO create using Python mkdir(directory + _folder_name, 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}'\"")
@@ -372,7 +366,17 @@ def remove_data(): # deletes an entry or folder from both the client and the se
# program start sequence # program start sequence
# retrieve typed argument
argument_list = argv
i, argument = 0, ''
for _ in argument_list:
while i < len(argument_list) - 1:
i += 1
argument += argument_list[i] + ' '
argument = argument[:-1]
# import saved userdata # import saved userdata
if argument != 'tweak':
device_type = '' device_type = ''
try: try:
device_type = open('/var/lib/sshyp/sshyp-device').read().strip() device_type = open('/var/lib/sshyp/sshyp-device').read().strip()
@@ -390,9 +394,13 @@ except FileNotFoundError:
print("Not all necessary configuration files are present. Please run 'sshyp tweak'!") print("Not all necessary configuration files are present. Please run 'sshyp tweak'!")
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n') print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
s_exit() s_exit()
else:
# retrieve typed argument try:
argument = argument_filter() tweak()
s_exit()
except KeyboardInterrupt:
print('\n')
s_exit()
# run function based on argument # run function based on argument
error = 0 # create an error flag to determine if syncing should occur at end error = 0 # create an error flag to determine if syncing should occur at end
@@ -404,12 +412,6 @@ elif argument == '':
except KeyboardInterrupt: except KeyboardInterrupt:
print('\n') print('\n')
s_exit() s_exit()
elif argument == 'tweak':
try:
tweak()
except KeyboardInterrupt:
print('\n')
s_exit()
elif argument == 'help' or argument == '--help' or argument == '-h': elif argument == 'help' or argument == '--help' or argument == '-h':
helper() helper()
elif argument == 'license': elif argument == 'license':
@@ -478,5 +480,6 @@ if argument != '' and argument != 'help' and argument != '--help' and argument !
argument != 'add' and argument != 'sync' and argument != 'edit' and argument != 'copy username' and argument \ argument != 'add' and argument != 'sync' and argument != 'edit' and argument != 'copy username' and argument \
!= 'copy -u' and argument != 'copy password' and argument != 'copy -p' and argument != 'copy url' and argument \ != 'copy -u' and argument != 'copy password' and argument != 'copy -p' and argument != 'copy url' and argument \
!= 'copy -l' and argument != 'copy note' and argument != 'copy -n' and argument != 'copy' and argument != \ != 'copy -l' and argument != 'copy note' and argument != 'copy -n' and argument != 'copy' and argument != \
'tweak' and argument != 'shear' and argument != '-rm' and error == 0 and argument.startswith('/') is False: 'shear' and argument != '-rm' and argument != 'version' and argument != '-v' and error == 0 and \
argument.startswith('/') is False:
sync() sync()
+100
View File
@@ -1,5 +1,105 @@
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2021.12.01.fr2.2
The Lighter Update - Patch 2
This release is a hotfix for 2021.12.01.fr2.1.
Changes:
- a major fix for "/var/lib/sshync_database" needing to already exist server-side
- a major fix for syncing functionality (it should actually work now)
- silenced some sftp output
An fr2.3 patch is planned for this version. It will include the following:
- fixes for any new bugs that may be discovered in the new sshyp and sshync code
- the gen command in sshyp will be updated to use the newer notetaking system
- printing functions in sshyp will be combined into one function (arguments will determine section to print)
- file not found exceptions will be re-implemented
- when syncing, a check will be made to see if any folders are not on all devices and this will be corrected
Planned for next major update (The Fluffier Update):
- 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.
- imporove password generator to guarantee more secure results
Planned for next, next major update (The Shears Update Pt. 1):
- enforce permissions on the server-side
- allow for copying entire notes (not just first line)
- allow for multi-client deletion... somehow
- detatch sshync and make it a separate package
- manpage
Planned for next, next, next major update (The Shears Update Pt. 2):
- ability to pass entries as arguments for more functions
- auto-completion on tab (currently unsure of best way to make this work)
Backlog:
- package for more Linux distributions, such as Debian and Fedora
- create separate gui frontend targetting mobile and desktop Linux
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2021.12.01.fr2.1
The Lighter Update - Patch 1
This release is a hotfix for 2021.12.01.fr2.
Changes:
- fixed a bug where "sshyp tweak" would not function on new installations
- moved the argument parser to the global process
- running "sshyp version" or "sshyp -v" no longer triggers syncing
- folders are now created natively with Python, rather than through system commands
An fr2.2 patch is planned for this version. It will include the following:
- fixes for any new bugs that may be discovered in the new sshyp and sshync code
- the gen command in sshyp will be updated to use the newer notetaking system
- printing functions in sshyp will be combined into one function (arguments will determine section to print)
- file not found exceptions will be re-implemented
Planned for next major update (The Fluffier Update):
- 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.
- imporove password generator to guarantee more secure results
Planned for next, next major update (The Shears Update Pt. 1):
- enforce permissions on the server-side
- allow for copying entire notes (not just first line)
- allow for multi-client deletion... somehow
- detatch sshync and make it a separate package
- manpage
Planned for next, next, next major update (The Shears Update Pt. 2):
- ability to pass entries as arguments for more functions
- auto-completion on tab (currently unsure of best way to make this work)
Backlog:
- package for more Linux distributions, such as Debian and Fedora
- create separate gui frontend targetting mobile and desktop Linux
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp 2021.12.01.fr2 sshyp 2021.12.01.fr2
The Lighter Update The Lighter Update
+9 -18
View File
@@ -1,32 +1,22 @@
sshyp 2021.12.01.fr2 sshyp 2021.12.01.fr2.2
The Lighter Update The Lighter Update - Patch 2
This release features a major re-write of old "rpass" code. This release is a hotfix for 2021.12.01.fr2.1.
sshyp is now more reliable and better documented.
New features:
- a full re-write of the old "rpass" code used in the last release
^ includes more reliable argument parsing and various optimizations
- a full re-write of "sshync", many issues fixed
^fixed many instances where sshync would refuse to upload/download
^fixed errors that were being thrown despite sshync working as intended
- new folders are now also created on the server
Changes: Changes:
- nested folders actually work now - a major fix for "/var/lib/sshync_database" needing to already exist server-side
- multi-word entry and folder titles are fixed - a major fix for syncing functionality (it should actually work now)
- silenced some sftp output
An fr2.1 patch is planned for this version. It will include the following: An fr2.3 patch is planned for this version. It will include the following:
- fixes for any new bugs that may be discovered in the new sshyp and sshync code - fixes for any new bugs that may be discovered in the new sshyp and sshync code
- the gen command in sshyp will be updated to use the newer notetaking system - the gen command in sshyp will be updated to use the newer notetaking system
- printing functions in sshyp will be combined into one function (arguments will determine section to print) - printing functions in sshyp will be combined into one function (arguments will determine section to print)
- file not found exceptions will be re-implemented - file not found exceptions will be re-implemented
- the argument parser will be moved to the global process (no need for it to be in a function) - when syncing, a check will be made to see if any folders are not on all devices and this will be corrected
- folders will be created natively in python
Planned for next major update (The Fluffier Update): Planned for next major update (The Fluffier Update):
@@ -40,6 +30,7 @@ Planned for next major update (The Fluffier Update):
Planned for next, next major update (The Shears Update Pt. 1): Planned for next, next major update (The Shears Update Pt. 1):
- enforce permissions on the server-side
- allow for copying entire notes (not just first line) - allow for copying entire notes (not just first line)
- allow for multi-client deletion... somehow - allow for multi-client deletion... somehow
- detatch sshync and make it a separate package - detatch sshync and make it a separate package