mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-02 15:17:18 -04:00
Strip data being copied when reading, rather than when sending to clipboard
Former-commit-id: 8b3ced0685b76b116ff9d1b7909c0d571054ee26 Former-commit-id: 34abaa4089dcad7dcc3bc3d8209d10e90915139c
This commit is contained in:
+8
-8
@@ -46,7 +46,7 @@ def entry_list_gen(_directory=f"{home}/.local/share/sshyp/"):
|
|||||||
|
|
||||||
# displays the contents of an entry in a readable format
|
# displays the contents of an entry in a readable format
|
||||||
def entry_reader(_decrypted_entry):
|
def entry_reader(_decrypted_entry):
|
||||||
_entry_lines, _notes_flag = [line.strip() for line in open(_decrypted_entry, 'r').readlines()], 0
|
_entry_lines, _notes_flag = [_line.strip() for _line in open(_decrypted_entry, 'r').readlines()], 0
|
||||||
if pass_show:
|
if pass_show:
|
||||||
_entry_password = f'\u001b[38;5;10m{_entry_lines[0]}\u001b[0m'
|
_entry_password = f'\u001b[38;5;10m{_entry_lines[0]}\u001b[0m'
|
||||||
else:
|
else:
|
||||||
@@ -627,7 +627,7 @@ def copy_data():
|
|||||||
s_exit(2)
|
s_exit(2)
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
determine_decrypt(directory + entry_name, _shm_folder, _shm_entry)
|
determine_decrypt(directory + entry_name, _shm_folder, _shm_entry)
|
||||||
_copy_line, _index = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'r').readlines(), 0
|
_copy_line, _index = [_line.strip() for _line in open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'r').readlines()], 0
|
||||||
if arguments[2] in ('username', '-u'):
|
if arguments[2] in ('username', '-u'):
|
||||||
_index = 1
|
_index = 1
|
||||||
elif arguments[2] in ('password', '-p'):
|
elif arguments[2] in ('password', '-p'):
|
||||||
@@ -639,28 +639,28 @@ def copy_data():
|
|||||||
# PORT START CLIPBOARD
|
# PORT START CLIPBOARD
|
||||||
# WSL clipboard detection
|
# WSL clipboard detection
|
||||||
if 'WSL_DISTRO_NAME' in environ:
|
if 'WSL_DISTRO_NAME' in environ:
|
||||||
run(('powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"))
|
run(('powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].replace("'", "''") + "'"))
|
||||||
Popen("sleep 30; pwsh.exe -c 'echo \"\" | Set-Clipboard'", shell=True)
|
Popen("sleep 30; pwsh.exe -c 'echo \"\" | Set-Clipboard'", shell=True)
|
||||||
# Wayland clipboard detection
|
# Wayland clipboard detection
|
||||||
elif 'WAYLAND_DISPLAY' in environ:
|
elif 'WAYLAND_DISPLAY' in environ:
|
||||||
run(('wl-copy', _copy_line[_index].rstrip()))
|
run(('wl-copy', _copy_line[_index]))
|
||||||
Popen('sleep 30; wl-copy -c', shell=True)
|
Popen('sleep 30; wl-copy -c', shell=True)
|
||||||
# Haiku clipboard detection
|
# Haiku clipboard detection
|
||||||
elif uname()[0] == 'Haiku':
|
elif uname()[0] == 'Haiku':
|
||||||
run(('clipboard', '-c', _copy_line[_index].rstrip()))
|
run(('clipboard', '-c', _copy_line[_index]))
|
||||||
Popen('sleep 30; clipboard -r', shell=True)
|
Popen('sleep 30; clipboard -r', shell=True)
|
||||||
# MacOS clipboard detection
|
# MacOS clipboard detection
|
||||||
elif uname()[0] == 'Darwin':
|
elif uname()[0] == 'Darwin':
|
||||||
run(('pbcopy'), stdin=Popen(('printf', _copy_line[_index].rstrip().replace('\\', '\\\\').replace('%', '%%')),
|
run(('pbcopy'), stdin=Popen(('printf', _copy_line[_index].replace('\\', '\\\\').replace('%', '%%')),
|
||||||
stdout=PIPE).stdout)
|
stdout=PIPE).stdout)
|
||||||
Popen("sleep 30; printf '' | pbcopy", shell=True)
|
Popen("sleep 30; printf '' | pbcopy", shell=True)
|
||||||
# Termux (Android) clipboard detection
|
# Termux (Android) clipboard detection
|
||||||
elif exists("/data/data/com.termux"):
|
elif exists("/data/data/com.termux"):
|
||||||
run(('termux-clipboard-set', _copy_line[_index].rstrip()))
|
run(('termux-clipboard-set', _copy_line[_index]))
|
||||||
Popen("sleep 30; termux-clipboard-set ''", shell=True)
|
Popen("sleep 30; termux-clipboard-set ''", shell=True)
|
||||||
# X11 clipboard detection
|
# X11 clipboard detection
|
||||||
else:
|
else:
|
||||||
run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_line[_index].rstrip().replace('\\', '\\\\')
|
run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_line[_index].replace('\\', '\\\\')
|
||||||
.replace('%', '%%')), stdout=PIPE).stdout)
|
.replace('%', '%%')), stdout=PIPE).stdout)
|
||||||
Popen("sleep 30; printf '' | xclip -sel c", shell=True)
|
Popen("sleep 30; printf '' | xclip -sel c", shell=True)
|
||||||
# PORT END CLIPBOARD
|
# PORT END CLIPBOARD
|
||||||
|
|||||||
Reference in New Issue
Block a user