Last active
May 13, 2016 13:26
-
-
Save drozdziak1/0e7695cb29e5b44203f81d1f4e26e062 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env perl | |
use strict; | |
use Authen::OATH; | |
use Term::ReadKey; | |
use Clipboard; | |
my $pw; # password | |
my $secret_plain; | |
my $oath; | |
my $totp_token; | |
my $pass_with_token; | |
print "Enter Password (not to be stored anywhere): "; | |
ReadMode("noecho"); | |
chomp( $pw = <STDIN> ); | |
ReadMode('restore'); | |
$secret_plain = `gpg -dq $ARGV[0]`; | |
$oath = Authen::OATH->new(); | |
$totp_token = $oath->totp($secret_plain); | |
$pass_with_token = $pw . $totp_token; | |
$pass_with_token; | |
system("echo -n $pass_with_token | xclip"); | |
print "\nPassword with token copied to middle mouse button clipboard\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment