mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-31 06:16:29 -04:00
Allow the user to choose preferred editor, drop nano as dependency
This commit is contained in:
+14
-9
@@ -164,7 +164,7 @@ def edit_note(_shm_folder, _shm_entry):
|
|||||||
lines = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}").readlines()
|
lines = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}").readlines()
|
||||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines(lines[0:3])
|
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines(lines[0:3])
|
||||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'w').writelines(lines[3:])
|
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'w').writelines(lines[3:])
|
||||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||||
edit_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n").read()
|
edit_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n").read()
|
||||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'a').write(edit_notes)
|
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'a').write(edit_notes)
|
||||||
|
|
||||||
@@ -216,7 +216,6 @@ 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(f"{gpg} --full-generate-key")
|
system(f"{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(path.expanduser('~/.config/sshyp/sshyp-gpg'), 'w').write(_gpg_id + '\n')
|
|
||||||
|
|
||||||
# lock file generation
|
# lock file generation
|
||||||
open(path.expanduser('~/.config/sshyp/lock'), 'w')
|
open(path.expanduser('~/.config/sshyp/lock'), 'w')
|
||||||
@@ -242,6 +241,10 @@ def tweak(): # runs configuration wizard
|
|||||||
_username_ssh = str(input('\nusername of the remote server: '))
|
_username_ssh = str(input('\nusername of the remote server: '))
|
||||||
print(f"\nentry directory: /home/{_username_ssh}/.password-pasture/")
|
print(f"\nentry directory: /home/{_username_ssh}/.password-pasture/")
|
||||||
|
|
||||||
|
# sshyp-only data storage
|
||||||
|
open(path.expanduser('~/.config/sshyp/sshyp-data'), 'w')\
|
||||||
|
.write(_gpg_id + '\n' + input('\nexample input: vim\n\npreferred text editor: '))
|
||||||
|
|
||||||
# sshync profile generation
|
# sshync profile generation
|
||||||
sshync.make_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'),
|
sshync.make_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'),
|
||||||
path.expanduser('~/.password-pasture/'), f"/home/{_username_ssh}/.password-pasture/",
|
path.expanduser('~/.password-pasture/'), f"/home/{_username_ssh}/.password-pasture/",
|
||||||
@@ -308,10 +311,10 @@ def print_info(): # prints help text based on argument
|
|||||||
'randall winkhart\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
'randall winkhart\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
|
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
|
||||||
'\u001b[38;5;7;48;5;8m/\u001b[0m')
|
'\u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mversion 1.0.1'
|
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mversion 1.1.0'
|
||||||
'\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
'\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mthe polished trotters '
|
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mthe sheecrets '
|
||||||
'update\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
'update\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
|
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
|
||||||
'\u001b[38;5;7;48;5;8m/\u001b[0m')
|
'\u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||||
print('\u001b[38;5;7;48;5;8m<><><><><><><><><><><><><><><><><><><><><><><><><><><><>\u001b[0m\n')
|
print('\u001b[38;5;7;48;5;8m<><><><><><><><><><><><><><><><><><><><><><><><><><><><>\u001b[0m\n')
|
||||||
@@ -436,7 +439,7 @@ def add_entry(): # adds a new entry
|
|||||||
s_exit(1)
|
s_exit(1)
|
||||||
if argument_list[1] == 'note' or argument_list[1] == '-n':
|
if argument_list[1] == 'note' or argument_list[1] == '-n':
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n' + _notes)
|
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n' + _notes)
|
||||||
elif argument_list[1] == 'password' or argument_list[1] == '-p':
|
elif argument_list[1] == 'password' or argument_list[1] == '-p':
|
||||||
@@ -446,7 +449,7 @@ 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 {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||||
else:
|
else:
|
||||||
_notes = ''
|
_notes = ''
|
||||||
@@ -547,7 +550,7 @@ 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 {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||||
else:
|
else:
|
||||||
_notes = ''
|
_notes = ''
|
||||||
@@ -659,7 +662,9 @@ if __name__ == "__main__":
|
|||||||
directory = str(ssh_info[3].replace('\n', ''))
|
directory = str(ssh_info[3].replace('\n', ''))
|
||||||
directory_ssh = '/home/' + username_ssh + '/.password-pasture/'
|
directory_ssh = '/home/' + username_ssh + '/.password-pasture/'
|
||||||
client_device_name = listdir(path.expanduser('~/.config/sshyp/devices'))[0]
|
client_device_name = listdir(path.expanduser('~/.config/sshyp/devices'))[0]
|
||||||
gpg_id = open(path.expanduser('~/.config/sshyp/sshyp-gpg')).read().strip()
|
sshyp_data = open(path.expanduser('~/.config/sshyp/sshyp-data')).readlines()
|
||||||
|
gpg_id = sshyp_data[0].replace('\n', '')
|
||||||
|
editor = sshyp_data[1].replace('\n', '')
|
||||||
ssh_error = int(open(path.expanduser('~/.config/sshyp/ssh-error')).read().strip())
|
ssh_error = int(open(path.expanduser('~/.config/sshyp/ssh-error')).read().strip())
|
||||||
if ssh_error != 0:
|
if ssh_error != 0:
|
||||||
ssh_error = copy_name_check(port, username_ssh, ip, client_device_name)
|
ssh_error = copy_name_check(port, username_ssh, ip, client_device_name)
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
+4
-8
@@ -55,7 +55,6 @@ requires {
|
|||||||
gnupg
|
gnupg
|
||||||
openssh
|
openssh
|
||||||
python3
|
python3
|
||||||
nano
|
|
||||||
}
|
}
|
||||||
urls {
|
urls {
|
||||||
\"https://github.com/rwinkhart/sshyp\"
|
\"https://github.com/rwinkhart/sshyp\"
|
||||||
@@ -85,7 +84,7 @@ Section: utils
|
|||||||
Architecture: all
|
Architecture: all
|
||||||
Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
||||||
Description: A light-weight, self-hosted, synchronized password manager
|
Description: A light-weight, self-hosted, synchronized password manager
|
||||||
Depends: python3, gnupg, openssh-client, nano, xclip, wl-clipboard
|
Depends: python3, gnupg, openssh-client, xclip, wl-clipboard
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Installed-Size: 185
|
Installed-Size: 185
|
||||||
" > packages/debiantemp/sshyp_"$version"-"$revision"_all/DEBIAN/control
|
" > packages/debiantemp/sshyp_"$version"-"$revision"_all/DEBIAN/control
|
||||||
@@ -110,7 +109,7 @@ Section: utils
|
|||||||
Architecture: all
|
Architecture: all
|
||||||
Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
||||||
Description: A light-weight, self-hosted, synchronized password manager
|
Description: A light-weight, self-hosted, synchronized password manager
|
||||||
Depends: python, gnupg, openssh, nano, termux-api, termux-am
|
Depends: python, gnupg, openssh, termux-api, termux-am
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Installed-Size: 185
|
Installed-Size: 185
|
||||||
" > packages/termuxtemp/sshyp_"$version"-"$revision"_all_termux/DEBIAN/control
|
" > packages/termuxtemp/sshyp_"$version"-"$revision"_all_termux/DEBIAN/control
|
||||||
@@ -155,7 +154,7 @@ License: GPLv3
|
|||||||
URL: https://github.com/rwinkhart/sshyp
|
URL: https://github.com/rwinkhart/sshyp
|
||||||
Source0: sshyp-"$version".tar.xz
|
Source0: sshyp-"$version".tar.xz
|
||||||
|
|
||||||
Requires: python gnupg openssh nano wl-clipboard
|
Requires: python gnupg openssh wl-clipboard
|
||||||
|
|
||||||
%description
|
%description
|
||||||
sshyp is a password-store compatible CLI password manager available for UNIX(-like) systems - its primary goal is to make syncing passwords and notes across devices as easy as possible via CLI.
|
sshyp is a password-store compatible CLI password manager available for UNIX(-like) systems - its primary goal is to make syncing passwords and notes across devices as easy as possible via CLI.
|
||||||
@@ -201,9 +200,6 @@ prefix: /
|
|||||||
\"gnupg\" : {
|
\"gnupg\" : {
|
||||||
\"origin\" : \"security/gnupg\"
|
\"origin\" : \"security/gnupg\"
|
||||||
},
|
},
|
||||||
\"nano\" : {
|
|
||||||
\"origin\" : \"editors/nano\"
|
|
||||||
},
|
|
||||||
\"xclip\" : {
|
\"xclip\" : {
|
||||||
\"origin\" : \"x11/xclip\"
|
\"origin\" : \"x11/xclip\"
|
||||||
},
|
},
|
||||||
@@ -237,7 +233,7 @@ pkgdesc='A light-weight, self-hosted, synchronized password manager'
|
|||||||
url='https://github.com/rwinkhart/sshyp'
|
url='https://github.com/rwinkhart/sshyp'
|
||||||
arch=('any')
|
arch=('any')
|
||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
depends=(python gnupg openssh nano xclip wl-clipboard)
|
depends=(python gnupg openssh xclip wl-clipboard)
|
||||||
|
|
||||||
source=(\""$source"\")
|
source=(\""$source"\")
|
||||||
sha512sums=('"$sha512"')
|
sha512sums=('"$sha512"')
|
||||||
|
|||||||
Regular → Executable
Reference in New Issue
Block a user