Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save phatz/5123ed4d93ef381641369acc3ab24881 to your computer and use it in GitHub Desktop.
Save phatz/5123ed4d93ef381641369acc3ab24881 to your computer and use it in GitHub Desktop.
Extract data from android backup of Google Authenticator 2 to qrcodes
#!/bin/bash
# Extract data from nandroid backup of Google Authenticator 2
# > /data/data/com.google.android.apps.authenticator2/databases/databases
# require: sqlite3 + qrencode
sqlite3 databases <<!
.headers off
.mode csv
.output codes.csv
select printf("otpauth://totp/%s?secret=%s&issuer=%s",email,secret,issuer) from accounts;
!
# Unquote lines
sed -i 's/\"//g' codes.csv
# Display as QR CODE
i=0;
while read p; do
qrencode -t ANSIUTF8 -8 -o - "${p}"
echo "${p}"
echo -e "\n\n"
done < codes.csv
rm codes.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment