diff --git a/mirobo/extract_tokens.py b/mirobo/extract_tokens.py index 51e235df1..ba60614cc 100644 --- a/mirobo/extract_tokens.py +++ b/mirobo/extract_tokens.py @@ -2,14 +2,15 @@ import tarfile import tempfile import sqlite3 -import binascii from Crypto.Cipher import AES from pprint import pformat as pf + def dump_raw(dev): raw = {k: dev[k] for k in dev.keys()} click.echo(pf(raw)) + def decrypt_ztoken(ztoken): if len(ztoken) <= 32: return ztoken @@ -46,12 +47,14 @@ def read_android(conn): token = dev['token'] click.echo("%s (%s) at %s. token: %s (mac: %s, ssid: %s)" % (name, model, ip, token, mac, ssid)) + def write(db, fp): fp.open() db.seek(0) # go to the beginning click.echo("Saving db to %s" % fp) fp.write(db.read()) + def read_tokens(db): conn = sqlite3.connect(db) conn.row_factory = sqlite3.Row @@ -93,4 +96,4 @@ def main(backup, write_to_disk): if __name__ == "__main__": - main() \ No newline at end of file + main()