mirror of
https://github.com/rwinkhart/sshyp-labs.git
synced 2026-09-05 16:47:29 -04:00
Added exception for opening entries without MFA data
This commit is contained in:
@@ -28,6 +28,7 @@ def mfa_read_shortcut(): # reads and extracts MFA info from the user-specified
|
|||||||
s_exit(1)
|
s_exit(1)
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
decrypt(directory + argument_list[1].replace('/', '', 1), _shm_folder, _shm_entry, gpg)
|
decrypt(directory + argument_list[1].replace('/', '', 1), _shm_folder, _shm_entry, gpg)
|
||||||
|
try:
|
||||||
_mfa_data = open(f"{path.expanduser('~/.config/sshyp/tmp/')}{_shm_folder}/{_shm_entry}", 'r').readlines()
|
_mfa_data = open(f"{path.expanduser('~/.config/sshyp/tmp/')}{_shm_folder}/{_shm_entry}", 'r').readlines()
|
||||||
_type = _mfa_data[4].split('otpauth://')[1].split('/')[0]
|
_type = _mfa_data[4].split('otpauth://')[1].split('/')[0]
|
||||||
_secret = _mfa_data[4].split('?secret=')[1].split('&issuer=')[0]
|
_secret = _mfa_data[4].split('?secret=')[1].split('&issuer=')[0]
|
||||||
@@ -36,6 +37,10 @@ def mfa_read_shortcut(): # reads and extracts MFA info from the user-specified
|
|||||||
_period = int(_mfa_data[4].split('&period=')[1])
|
_period = int(_mfa_data[4].split('&period=')[1])
|
||||||
rmtree(f"{path.expanduser('~/.config/sshyp/tmp/')}{_shm_folder}")
|
rmtree(f"{path.expanduser('~/.config/sshyp/tmp/')}{_shm_folder}")
|
||||||
return _type, _secret, _algo, _digits, _period
|
return _type, _secret, _algo, _digits, _period
|
||||||
|
except IndexError:
|
||||||
|
print(f"\n\u001b[38;5;9merror: ({argument_list[1].replace('/', '', 1)}) no valid mfa data\u001b[0m\n")
|
||||||
|
rmtree(f"{path.expanduser('~/.config/sshyp/tmp/')}{_shm_folder}")
|
||||||
|
s_exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user