Skip to content

Instantly share code, notes, and snippets.

@drozdziak1
Last active May 13, 2016 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drozdziak1/0e7695cb29e5b44203f81d1f4e26e062 to your computer and use it in GitHub Desktop.
Save drozdziak1/0e7695cb29e5b44203f81d1f4e26e062 to your computer and use it in GitHub Desktop.
#!/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