Skip to content

Instantly share code, notes, and snippets.

@lemontv
Created August 1, 2022 23:48
Show Gist options
  • Save lemontv/62d9ae76981ffde24bd6f1e08bd67293 to your computer and use it in GitHub Desktop.
Save lemontv/62d9ae76981ffde24bd6f1e08bd67293 to your computer and use it in GitHub Desktop.
Get Yubikey OTP from NFC reader
#!/bin/sh
# Get avaialbel reader
reader=$(opensc-tool --list-reader | grep 'Yes' | awk '{ print $1 }')
# Get Yubikey OTP
opensc-tool -c default -r "$reader" -s 00:A4:04:00:07:D2:76:00:00:85:01:01 -s 00:A4:00:0C:02:E1:04 -s 00:B0:00:00:00 | grep -Ev 'Sending|Received' | awk '{ print substr($0, 49) }' | tr -d '\n' | awk '{ print substr($0, 26) }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment