Added old posts

Signed-off-by: Ettore <noettore@gmail.com>
This commit is contained in:
2019-05-25 16:52:14 +02:00
parent 845eec3def
commit dd3c6392c5
3 changed files with 144 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
+++
date = "2017-06-12T11:44:46+02:00"
title = "How to: backup google authenticator app two-factor secrets"
+++
Quick and dirty:
- Connect your device to the PC via USB
- Enable debugging mode
- From the terminal:
```bash
adb root
adb pull /data/data/com.google.android.apps.authenticator2/databases/databases
sqlite3 ./databases "select * from accounts" > ./gauth_backup.txt
```
If you want to generate an auth code from a TOTP secret you can use `oathtool`:
```bash
oathtool --base32 --totp "<secret>"
```
Enjoy!
---
Pro tip: to generate all the QR codes from the `sqlite` database you could use this python script (which requires the `qrcode` module):
```py
import qrcode
import sqlite3
conn = sqlite3.connect('databases')
c = conn.cursor()
for idx, (email, secret, issuer) in enumerate(c.execute("SELECT email,secret,issuer FROM accounts").fetchall()):
url = 'otpauth://totp/{}?secret={}&issuer={}'.format(email, secret, issuer)
print url
im = qrcode.make(url)
im.save('{}.png'.format(idx))
```
(source: [thouis](https://github.com/thouis))