mirror of
https://github.com/rwinkhart/sshyp-labs.git
synced 2026-09-05 00:27:18 -04:00
Only refresh the mfa key on 15-second intervals
This commit is contained in:
+14
-13
@@ -10,7 +10,7 @@ from sshyp import decrypt, entry_list_gen, shm_gen
|
|||||||
from steam.guard import generate_twofactor_code as steam_totp
|
from steam.guard import generate_twofactor_code as steam_totp
|
||||||
from struct import pack, unpack
|
from struct import pack, unpack
|
||||||
from sys import argv, exit as s_exit
|
from sys import argv, exit as s_exit
|
||||||
from time import sleep, time
|
from time import sleep, strftime, time
|
||||||
|
|
||||||
|
|
||||||
def totp(_secret, _algo, _digits, _period):
|
def totp(_secret, _algo, _digits, _period):
|
||||||
@@ -59,18 +59,19 @@ if __name__ == '__main__':
|
|||||||
'updated with the newest mfa key')
|
'updated with the newest mfa key')
|
||||||
while True:
|
while True:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
if mfa_data[0] == 'steam':
|
if str(int(strftime('%S'))/15).endswith('.0'):
|
||||||
_mfa_key = steam_totp(b32decode(mfa_data[1]))
|
if mfa_data[0] == 'steam':
|
||||||
else:
|
_mfa_key = steam_totp(b32decode(mfa_data[1]))
|
||||||
_mfa_key = totp(mfa_data[1], mfa_data[2], mfa_data[3], mfa_data[4])
|
else:
|
||||||
if uname()[0] == 'Haiku': # Haiku clipboard detection
|
_mfa_key = totp(mfa_data[1], mfa_data[2], mfa_data[3], mfa_data[4])
|
||||||
system(f"clipboard -c '{_mfa_key}'")
|
if uname()[0] == 'Haiku': # Haiku clipboard detection
|
||||||
elif Path("/data/data/com.termux").exists(): # Termux (Android) clipboard detection
|
system(f"clipboard -c '{_mfa_key}'")
|
||||||
system(f"termux-clipboard-set '{_mfa_key}'")
|
elif Path("/data/data/com.termux").exists(): # Termux (Android) clipboard detection
|
||||||
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0': # Wayland clipboard detection
|
system(f"termux-clipboard-set '{_mfa_key}'")
|
||||||
system(f"wl-copy '{_mfa_key}'")
|
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0': # Wayland clipboard detection
|
||||||
else: # X11 clipboard detection
|
system(f"wl-copy '{_mfa_key}'")
|
||||||
system(f"echo -n '{_mfa_key}' | xclip -sel c")
|
else: # X11 clipboard detection
|
||||||
|
system(f"echo -n '{_mfa_key}' | xclip -sel c")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n')
|
print('\n')
|
||||||
s_exit()
|
s_exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user