### Last tested February 7 2014 on a Galaxy S3 (d2att) running Cyanogenmod 11 nightly, with Google Authenticator 2.49. | |
### Device with Google Authenticator must have root. | |
### Computer requires Android Developer Tools and SQLite 3. | |
### Connect your device in USB debugging mode. | |
$ cd /tmp | |
$ adb root | |
$ adb pull /data/data/com.google.android.apps.authenticator2/databases/databases | |
$ sqlite3 ./databases "select * from accounts" > /Volumes/TRUECRYPT_ENCRYPTED_VOLUME/google_authenticator_backup.txt | |
$ rm ./databases | |
### If you look at the file, you see a pipe-delimited file with entries looking like the following. | |
### The X's mark the key. | |
1|Google:me@gmail.com|XXXXXXXXXXXXXXXXXXXXXXXX|0|0|0|| | |
2|Google:me@domain.org|XXXXXXXXXXXXXXXXXXXXXXXX|0|0|0|Google|Google:me@domain.org | |
3|Dropbox:me@gmail.com|XXXXXXXXXXXXXXXXXXXXXXXX|0|0|0|Dropbox|Dropbox:me@gmail.com | |
### To restore the keys, you can key them in manually in Google Authenticator: | |
### Menu -> Set up account -> Enter provided key. | |
### Enter the key exactly as it appears, case sensitive, and choose Time-based. |
This comment has been minimized.
This comment has been minimized.
Hi there, |
This comment has been minimized.
This comment has been minimized.
if you lost your phone and happen to have a titanium backup of your data you might be able to recover it. Otherwise: no. I needed this to go from Google Authenticator to Authy. I wasn't able to do adb root, it said something about can't be done in a production environment. But I was able to use the info to grab the "databases" file using Root Explorer and then pop it over onto a linux box to run the sqllite3 command. |
This comment has been minimized.
This comment has been minimized.
Ok I need help! I have my phone rooted but i don't understand what to do above. I have a samsung s5, I hard reset my phone but my google account restored all my applications including google authenticator but it didn't keep all my keys from the websites. I really need help! Someone explain specifically how to obtain this on a phone that was recently formatted but it still has root. |
This comment has been minimized.
This comment has been minimized.
Thank you very much!! |
This comment has been minimized.
This comment has been minimized.
If you have python and the 'qrcode' module installed, you can use this to generate QR codes from the sqlite database:
Be sure to treat the qrcode images as secret (remove them when you're done!). |
This comment has been minimized.
This comment has been minimized.
Thanks a lot! |
This comment has been minimized.
This comment has been minimized.
to make the python script above working with google authenticator from fdroid issue must be removed #! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3 python3Packages.qrcode
import qrcode
import sqlite3
conn = sqlite3.connect('databases')
c = conn.cursor()
for i, (email, secret) in enumerate(c.execute("SELECT email, secret FROM accounts").fetchall()):
url = 'otpauth://totp/{}?secret={}'.format(email, secret)
print(url)
im = qrcode.make(url)
im.save('{}.png'.format(i)) |
This comment has been minimized.
This comment has been minimized.
I don't have root and my phone has a locked bootloader. What can I do? There is another app that you can use to extract saves without root. Will that work? |
This comment has been minimized.
This comment has been minimized.
Hello, |
This comment has been minimized.
This comment has been minimized.
Here's a version of the script if you need to edit or recover the issuer field:
|
This comment has been minimized.
This comment has been minimized.
Here is a new version, with terminal QC code: (comment out some line) import pyqrcode for idx, (email, secret, issuer) in enumerate(c.execute("SELECT email,secret,issuer FROM accounts").fetchall()):
|
This comment has been minimized.
This comment has been minimized.
does anyone know how to open .enc file |
This comment has been minimized.
This comment has been minimized.
could someone plzz tell how to import qrcode and sqlite3 |
This comment has been minimized.
This comment has been minimized.
This still works on version 5.10, that was released in april 2020. Thanks |
This comment has been minimized.
This comment has been minimized.
Really thanks. You just save my life. Still works. |
This comment has been minimized.
It's interesting that the length of the keys varies wildly, from 16 to 52 (presumably base64) characters.