sshyp-mfa - Removed interactive entry prompt and updated help text

This commit is contained in:
2023-03-01 10:21:45 -05:00
parent 931d7a0494
commit 0ad86a1040
2 changed files with 8 additions and 11 deletions
+5 -5
View File
@@ -1,15 +1,15 @@
.TH sshyp-mfa 1 "12 July 2022" "rolling" "sshyp-mfa man page"
.TH sshyp-mfa 1 "01 March 2023" "v1.4.0.1" "sshyp-mfa man page"
.SH NAME
sshyp-mfa \- An MFA (TOTP/Steam) key generator for the sshyp password manager.
.SH SYNOPSIS
sshyp-mfa [/<entry name>]
Extension Usage: sshyp </entry name> copy -m
Direct Usage: sshyp-mfa </entry name>
.SH DESCRIPTION
sshyp-mfa is an extension for the sshyp password manager that reads MFA data from sshyp entries and generates generic TOTP and Steam keys.
.SH EXAMPLES
Viewing the entry database:
sshyp-mfa
Generating and copying an MFA key for an existing entry saved as ~/.local/share/sshyp-mfa/development/github.gpg
sshyp /development/github copy -m
sshyp-mfa /development/github
.SH SETUP
+3 -6
View File
@@ -21,7 +21,7 @@ def totp(_secret, _algo, _digits, _period): # uses provided information to gene
return str(_binary)[-_digits:].zfill(_digits)
def mfa_read_shortcut(): # reads and extracts MFA info from the user-specified sshyp entry
def mfa_read_shortcut(): # extracts MFA info from the user-specified sshyp entry
from shutil import rmtree
if not Path(f"{directory}{arguments[0]}.gpg").exists():
print(f"\n\u001b[38;5;9merror: entry ({arguments[0]}) does not exist\u001b[0m\n")
@@ -49,8 +49,8 @@ def mfa_read_shortcut(): # reads and extracts MFA info from the user-specified
if __name__ == '__main__':
# argument fetcher
arguments = argv[1:]
if len(arguments) > 0 and not arguments[0].startswith('/'):
print(f"\n\u001b[38;5;9merror: invalid argument - run 'man sshyp-mfa' for usage information\u001b[0m\n")
if len(arguments) < 1 or not arguments[0].startswith('/'):
print("\nsshyp-mfa extension usage: sshyp </entry name> copy -m\n\nrun 'man sshyp-mfa' for more information\n")
s_exit(1)
# user data fetcher
@@ -64,9 +64,6 @@ if __name__ == '__main__':
# main process: runs functions to generate MFA key, then continuously copies up-to-date MFA key to clipboard
try:
if len(arguments) < 1:
entry_list_gen()
arguments.append(input('entry to read: '))
mfa_data, copied = mfa_read_shortcut(), None
print('\nmfa key copied to clipboard\n\nuntil this process is closed, your clipboard will be automatically '
'updated with the newest mfa key')