mirror of
https://github.com/rwinkhart/sshyp-labs.git
synced 2026-08-28 12:56:33 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1216d06975 | ||
|
|
8e45b15fee | ||
|
|
6ee49d6b95 | ||
|
|
7b03cfdc5e |
+10
-13
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from base64 import b32decode
|
||||
from os import environ, listdir, path, system, uname
|
||||
from os import environ, listdir, path, uname
|
||||
from pathlib import Path
|
||||
from sshync import get_profile
|
||||
from sshyp import decrypt, entry_list_gen, shm_gen, whitelist_verify
|
||||
from subprocess import PIPE, Popen, run
|
||||
from sys import argv, exit as s_exit
|
||||
from time import sleep, strftime, time
|
||||
|
||||
@@ -27,9 +28,9 @@ def mfa_read_shortcut(): # reads and extracts MFA info from the user-specified
|
||||
s_exit(1)
|
||||
_shm_folder, _shm_entry = shm_gen()
|
||||
if quick_unlock_enabled == 'y':
|
||||
decrypt(directory + argument, _shm_folder, _shm_entry, gpg, whitelist_verify(port, username_ssh, ip, device_id))
|
||||
decrypt(directory + argument, _shm_folder, _shm_entry, whitelist_verify(port, username_ssh, ip, device_id))
|
||||
else:
|
||||
decrypt(directory + argument, _shm_folder, _shm_entry, gpg, False)
|
||||
decrypt(directory + argument, _shm_folder, _shm_entry, False)
|
||||
try:
|
||||
_mfa_data = open(f"{path.expanduser('~/.config/sshyp/tmp/')}{_shm_folder}/{_shm_entry}", 'r').readlines()
|
||||
_type = _mfa_data[4].split('otpauth://')[1].split('/')[0]
|
||||
@@ -60,10 +61,6 @@ if __name__ == '__main__':
|
||||
ip = str(ssh_info[1].rstrip())
|
||||
port = str(ssh_info[2].rstrip())
|
||||
directory = str(ssh_info[3].rstrip())
|
||||
if uname()[0] == 'Haiku': # set proper gpg command for OS
|
||||
gpg = 'gpg --pinentry-mode loopback'
|
||||
else:
|
||||
gpg = 'gpg'
|
||||
|
||||
# main process: runs functions to generate MFA key, then continuously copies up-to-date MFA key to clipboard
|
||||
try:
|
||||
@@ -83,14 +80,14 @@ if __name__ == '__main__':
|
||||
_mfa_key = steam_totp(b32decode(mfa_data[1]))
|
||||
else:
|
||||
_mfa_key = totp(mfa_data[1], mfa_data[2], mfa_data[3], mfa_data[4])
|
||||
if uname()[0] == 'Haiku': # Haiku clipboard detection
|
||||
system(f"clipboard -c '{_mfa_key}'")
|
||||
if 'WAYLAND_DISPLAY' in environ: # Wayland clipboard detection
|
||||
run(['wl-copy', _mfa_key])
|
||||
elif uname()[0] == 'Haiku': # Haiku clipboard detection
|
||||
run(['clipboard', '-c', _mfa_key])
|
||||
elif Path("/data/data/com.termux").exists(): # Termux (Android) clipboard detection
|
||||
system(f"termux-clipboard-set '{_mfa_key}'")
|
||||
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0': # Wayland clipboard detection
|
||||
system(f"wl-copy '{_mfa_key}'")
|
||||
run(['termux-clipboard-set', _mfa_key])
|
||||
else: # X11 clipboard detection
|
||||
system(f"echo -n '{_mfa_key}' | xclip -sel c")
|
||||
run(['xclip', '-sel', 'c'], stdin=Popen(['echo', '-n', _mfa_key], stdout=PIPE).stdout)
|
||||
sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
print('\n')
|
||||
|
||||
@@ -67,7 +67,7 @@ package() {
|
||||
}
|
||||
|
||||
sha512sums=\"
|
||||
"$sha512' 'sshyp-mfa\"\$pkgver\".tar.xz"
|
||||
"$sha512' 'sshyp-mfa-\"\$pkgver\".tar.xz"
|
||||
\"
|
||||
" > output/APKBUILD
|
||||
echo -e "\nAPKBUILD generated\n"
|
||||
|
||||
Reference in New Issue
Block a user