From 3392e3ceea1e7c688f2490863cff29b4f26f09a6 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Fri, 25 Nov 2022 12:00:51 -0500 Subject: [PATCH] Use ASCII 30 and 31 as separators, removes limitations on "@", "^&*", and "*&^". Former-commit-id: cd08e1adde9f810e0099338722b617357055c422 [formerly 289d12f45a6d0f425f3c4c2934d19f85abe58e6b] Former-commit-id: 7f70d015e3afe2101aba2d1d21001101db0de81e --- extra/manpage | 6 +----- lib/sshync.py | 8 +------- lib/sshyp.py | 3 --- lib/sshypRemote.py | 11 +++-------- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/extra/manpage b/extra/manpage index 2e42a86..a9924ef 100644 --- a/extra/manpage +++ b/extra/manpage @@ -1,4 +1,4 @@ -.TH sshyp 1 "06 November 2022" "v1.2.0" "sshyp man page" +.TH sshyp 1 "25 November 2022" "v1.2.1" "sshyp man page" .SH NAME sshyp \- A very simple self-hosted, synchronized password manager for UNIX(-like) systems. Alternative to (and compatible with) pass/password-store. .SH SYNOPSIS @@ -88,10 +88,6 @@ whitelist: list/-l view all registered device ids and their quick-unlock whitelist status add whitelist a device id for quick-unlock delete/del remove a device id from the quick-unlock whitelist -.SH LIMITATIONS -The following characters/character sequences are not supported in entry/folder titles: - - @ ^&* *&^ .SH SETUP sshyp operates on a client-server model, and thus requires you to have access to your own server (whether it be a physical home server or a cloud rental) with remote access via SSH. diff --git a/lib/sshync.py b/lib/sshync.py index f6db020..1253c7d 100755 --- a/lib/sshync.py +++ b/lib/sshync.py @@ -1,14 +1,8 @@ #!/usr/bin/env python3 - -# external modules - from os import system, walk from os.path import getmtime, join -from sys import exit as s_exit from subprocess import PIPE, run - - -# utility functions +from sys import exit as s_exit def get_local_data(_directory, _device): # retrieves titles and mod times from the local device diff --git a/lib/sshyp.py b/lib/sshyp.py index f85865d..ef92663 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -1,7 +1,4 @@ #!/usr/bin/env python3 - -# external modules - from os import environ, listdir, path, remove, system, uname, walk from pathlib import Path from random import randint, SystemRandom diff --git a/lib/sshypRemote.py b/lib/sshypRemote.py index e0373f0..aaf18d7 100755 --- a/lib/sshypRemote.py +++ b/lib/sshypRemote.py @@ -1,14 +1,9 @@ #!/usr/bin/env python3 - -# external modules - from os import listdir, remove, walk from os.path import expanduser from shutil import rmtree -# utility functions - def delete(_file_path, _target_database): # deletes an entry or folder, should be run remotely via ssh try: if _file_path.endswith('/'): @@ -18,14 +13,14 @@ def delete(_file_path, _target_database): # deletes an entry or folder, should except FileNotFoundError: print(f"location does not exist {_target_database}") for _device_name in listdir(expanduser('~/.config/sshyp/devices')): - open(f"{expanduser('~/.config/sshyp/deleted/')}{_file_path.replace('/', '@')}^&*{_device_name}", 'w') + open(expanduser('~/.config/sshyp/deleted/') + _file_path.replace('/', '\x1e') + '\x1f' + _device_name, 'w') def deletion_check(_client_device_name): # creates a list of entries and folders to be deleted from a local machine open(expanduser('~/.config/sshyp/deletion_database'), 'w').write('') for _file in listdir(expanduser('~/.config/sshyp/deleted')): - _file_path = _file.replace('@', '/').split('^&*')[0] - _device = _file.split('^&*')[1] + _file_path, _sep, _device = _file.partition('\x1f') + _file_path = _file_path.replace('\x1e', '/') if _device == _client_device_name: try: remove(f"{expanduser('~/.config/sshyp/deleted/')}{_file}")