Last active
December 28, 2017 23:49
Star
You must be signed in to star a gist
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
#!/bin/bash | |
echo "This will wipe the Yubikey and restore to factory settings" | |
read -p "Are you sure? (y/n)" -n 1 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
gpg-connect-agent <<EOF | |
/hex | |
scd serialno | |
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40 | |
scd apdu 00 e6 00 00 | |
scd apdu 00 44 00 00 | |
/echo card has been reset to factory defaults | |
EOF | |
echo "Now remove your Yubikey, wait a few seconds and plug it back in. I'll wait" | |
sleep 5 | |
echo "Yubikey has been successfully reset." | |
echo "The factory default PINs are 123456 (user) and 12345678 (admin)." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment