Repository: dchapkine/extract-google-authenticator-credentials Branch: master Commit: d1fd7d7b31d8 Files: 10 Total size: 124.9 KB Directory structure: gitextract_3gxgsx9b/ ├── .gitignore ├── README.md ├── clean.sh ├── dumpcsv.sh ├── extract.sh ├── genhtml.sh ├── main.sh ├── server.sh └── templates/ ├── footer.html └── header.html ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ data ================================================ FILE: README.md ================================================ ## Works for me (TM) This was tested only with google authenticator v2.49 on android 4.2.1 (rooted) Scripts in this repository highly depend on sqlite database schema of google authenticator app. So it the schema changes in new versions this method could break until i update the repository. If it breaks for you, please open an issue with following information: - google authenticator exact version (you can check it in settings > about) - android exact version - any other information about the error ## It doesn't work Sure it does ! The only thing that can fail here is time synchronisation between your different devices and different authenticator app vendors. Please check that both old and new devices have the same timezone and time Try to play with "offset compensation" feature in authenticator settings if codes don't match Keep in mind that you won't be able to have perfect match between two different devices. You may experience 10 seconds offset between two devices. ## Does it work on linux/osx/windows ? Should work everywhere as long as you have all dependencies installed (see below): - linux (tested on ubuntu 14.04) - osx - windows via cygwin ## Step1 Root your phone that has google authenticator installed ## Step2 Install adb on your pc/mac ## Step3 Make sure you have sqlite3, netcat (nc), adb and bash installed on your machine ## Step4 by default, when you do "adb pull", this command does not run as root on device, so you cant access files you want Install Adb unsecure, to allow "abd pull" command as root https://play.google.com/store/apps/details?id=eu.chainfire.adbd http://forum.xda-developers.com/showthread.php?t=1687590 !!! IMPORTANT: open "adbd insecure" app and check "Enable insecure adbd" ## Step5 plug the phone ## Step6 check that you can see the device using adb devices ## Step7 If yes, run ./extract.sh ## Step8 If no error showed, it means it worked and the file is not inside data/databases ## Step9 If step 7 was successful, run ./dumpcsv.sh ## Step10 run ./server.sh ## Step11 goto http://localhost:2001 in your browser ## Step12 Here you go, hover your mouse on one of blue squares, qrcode is shown. Open google authenticator on new device, and scan each code ## Step13 Congratulations if you made it so far, your google authenticator codes are now transfered to your new device. Before you remove your codes from old device, make sure that one time passwords generated by google authenticator are EXACTLY the same on both devices. Note that both devices should have correct datetime set Thank you for using this guide :) ## Step14 Now that you understand the process, you can run ./main.sh to do all this steps in one command Enjoy ! ## Awesome links: - Google auth url format https://code.google.com/p/google-authenticator/wiki/KeyUriFormat - QRcode js library http://davidshimjs.github.io/qrcodejs/ - QRcode commandline library https://github.com/gtanner/qrcode-terminal - Tutorial http://www.howtogeek.com/130755/how-to-move-your-google-authenticator-credentials-to-a-new-android-phone-or-tablet/ - Adb unsecure, to allow "abd pull" command as root https://play.google.com/store/apps/details?id=eu.chainfire.adbd http://forum.xda-developers.com/showthread.php?t=1687590 ================================================ FILE: clean.sh ================================================ #!/bin/bash rm -rf ./data ================================================ FILE: dumpcsv.sh ================================================ #!/bin/bash mkdir -p ./data && echo ".schema accounts" | sqlite3 ./data/databases > ./data/schema.txt && echo "select * from accounts;" | sqlite3 -separator ';' ./data/databases > ./data/dump.csv ================================================ FILE: extract.sh ================================================ #!/bin/bash mkdir -p ./data && adb pull /data/data/com.google.android.apps.authenticator2/databases/databases && mv databases data/databases ================================================ FILE: genhtml.sh ================================================ #!/bin/bash echo -e "HTTP/1.1 200 OK\r\n\ $(date)\r\n\ Content-Type: text/html\r\n\ \r\n"; cat ./templates/header.html OLDIFS=$IFS IFS=";" while read _id email secret counter type provider issuer original_name do url="otpauth://totp/"$email"?secret="$secret"&issuer="$issuer; echo '
================================================ FILE: templates/header.html ================================================