Skip to content

Instantly share code, notes, and snippets.

@Rayquaza01
Created April 9, 2018 22:45
Show Gist options
  • Save Rayquaza01/1d58fb8eb31714671bfeca85ea3936ec to your computer and use it in GitHub Desktop.
Save Rayquaza01/1d58fb8eb31714671bfeca85ea3936ec to your computer and use it in GitHub Desktop.
Python script to convert Google Authenticator database to a format the Authenticator extension can read
#!/usr/bin/env python3
import sqlite3
import json
conn = sqlite3.connect("databases")
c = conn.cursor()
c.execute("SELECT * FROM accounts")
obj = {"otp_list": []}
for row in c.fetchall():
obj["otp_list"].append({
"name": row[1],
"key": row[2]
})
with open("totp.json", "w") as f:
f.write(json.dumps(obj))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment