From 0ad86a1040bb04015c96ae0c06d29eb1383eaa93 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Wed, 1 Mar 2023 10:21:45 -0500 Subject: [PATCH] sshyp-mfa - Removed interactive entry prompt and updated help text --- sshyp-mfa/extra/manpage | 10 +++++----- sshyp-mfa/lib/sshyp-mfa.py | 9 +++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/sshyp-mfa/extra/manpage b/sshyp-mfa/extra/manpage index eb8db56..2bfaba1 100644 --- a/sshyp-mfa/extra/manpage +++ b/sshyp-mfa/extra/manpage @@ -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 [/] +Extension Usage: sshyp copy -m + +Direct Usage: sshyp-mfa .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 diff --git a/sshyp-mfa/lib/sshyp-mfa.py b/sshyp-mfa/lib/sshyp-mfa.py index a70289f..71c8e02 100755 --- a/sshyp-mfa/lib/sshyp-mfa.py +++ b/sshyp-mfa/lib/sshyp-mfa.py @@ -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 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')