puddly / android-otp-extractor

Extracts OTP tokens from rooted Android devices
GNU General Public License v3.0
238 stars 22 forks source link

Broken sqlite database from `adb exec-out` #1

Closed jayme-github closed 6 years ago

jayme-github commented 6 years ago

Thanks for this tool!

I tried to dump Google Authenticator secrets but that failed because adb exec-out does not dump the complete database file in my case (don't know why, reproducible when run manually). I ended up copying the file (as root) to a temp directory and and than from phone to pc via adb pull.

puddly commented 6 years ago

Can you provide some more info please?

jayme-github commented 6 years ago

Sorry for getting back late!

Operating System is Debian 9, Android ROM is Sony Xperia Stock, Android 7.0

puddly commented 6 years ago

Base64-encoding the output of adb shell might be a better (albeit slower) choice if adb exec-out doesn't work properly on all devices.

Can you try using the code in the base64-extraction branch?

mdkcore0 commented 6 years ago

Hi, I had a similar issue when running it:

Checking for root. You might have to grant ADB temporary root access. Reading file /data/data/com.authy.authy/shared_prefs/com.authy.storage.tokens.authenticator.xml Reading file /data/data/com.authy.authy/shared_prefs/com.authy.storage.tokens.authy.xml Reading file /data/data/org.fedorahosted.freeotp/shared_prefs/tokens.xml Reading file /data/data/com.duosecurity.duomobile/files/duokit/accounts.json Reading file /data/data/com.google.android.apps.authenticator2/databases/databases Traceback (most recent call last): File "extract_otp_tokens.py", line 247, in accounts.update(read_google_authenticator_accounts(args.data)) File "extract_otp_tokens.py", line 130, in read_google_authenticator_accounts cursor.execute('SELECT email, secret FROM accounts;') sqlite3.DatabaseError: database disk image is malformed

when switching to the base64-extraction branch it worked as expected ;)

adb information:

Android Debug Bridge version 1.0.36 Revision 0e9850346394-android

thank you for this awesome tool!