-
-
Save vjt/a6641c707402cc8f28c7c9d003f3c03f to your computer and use it in GitHub Desktop.
Revisions
-
vjt revised this gist
Oct 12, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ #!/bin/bash # -*- 2fa Command Line -*- # # Uses oath-toolkit http://nongnu.org/oath-toolkit/ # to generate 2FA OTPs and copies them in the Mac's # clipboard using pbcopy(1). For other UNIX systems # you can just strip the pbcopy at the bottom. # # In the dir below you should put TOTP token seeds, # one per file, naming it after the service you are # authenticating against. @@ -17,6 +17,10 @@ # for TOTP to work, you *need* the seed, so it will # be hidden, somewhere, for you to find out. # # - [email protected] Thu Oct 12 22:53:11 CEST 2017 # # WTFPL license (http://www.wtfpl.net/) # BASEDIR=~/Documents/2fa service=$1 -
vjt revised this gist
Oct 12, 2017 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,22 @@ #!/bin/bash # # Uses oath-toolkit http://nongnu.org/oath-toolkit/ # to generate 2FA OTPs and copies them in the Mac's # clipboard using pbcopy(1). For other UNIX systems # you can just strip the pbcopy at the bottom. # # In the dir below you should put TOTP token seeds, # one per file, naming it after the service you are # authenticating against. # # Each service uses different approaches to let you # know (or to try to prevent you from knowing) your # TOTP seed: it's up to you to find it out. Anyway, # for TOTP to work, you *need* the seed, so it will # be hidden, somewhere, for you to find out. # BASEDIR=~/Documents/2fa service=$1 @@ -23,5 +40,4 @@ fi code=$(cat $file) oathtool --totp -b "$code" | pbcopy echo "Copied to the clipboard" -
vjt revised this gist
Oct 12, 2017 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash BASEDIR=~/Documents/2fa @@ -22,8 +22,6 @@ if [ ! -f "$file" ]; then fi code=$(cat $file) oathtool --totp -b "$code" | pbcopy echo "Copied to the clipboard" -
vjt created this gist
Oct 12, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/sh BASEDIR=~/Documents/2fa service=$1 if [ -z "$service" ]; then echo "Usage: $0 <service>" exit 1 fi if ! echo "$service" | grep -Eq '[a-zA-Z0-9]+'; then echo "Invalid service name: $service" exit 2 fi file="$BASEDIR/$service" if [ ! -f "$file" ]; then echo "Unknown service: $service" exit 3; fi code=$(cat $file) oathtool --totp -b "$code" | pbcopy echo "Copied to the clipboard"