add oath script
This commit is contained in:
parent
470f609979
commit
98f8731afd
1 changed files with 20 additions and 0 deletions
20
home/bin/oath
Executable file
20
home/bin/oath
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env expect -f
|
||||
|
||||
set query [lindex $argv 0]
|
||||
|
||||
spawn ykman oath code $query
|
||||
expect "Enter your password:"
|
||||
|
||||
stty -echo
|
||||
expect_user -re "(.*)\n"
|
||||
stty echo
|
||||
set pin $expect_out(1,string)
|
||||
|
||||
send "$pin\r\r"
|
||||
|
||||
expect "Touch your YubiKey..."
|
||||
expect -re {(\d{6})}
|
||||
|
||||
set code $expect_out(1,string)
|
||||
|
||||
system printf $code | pbcopy
|
Loading…
Add table
Reference in a new issue