Skip to main content

Extract tokens from FreeOTP backup

Project description

FreeOTP tokens extractor

Backing up FreeOTP

Using adb, create a backup of the app using the following command:

adb backup -f freeotp-backup.ab -apk org.fedorahosted.freeotp

org.fedorahosted.freeotp is the app ID for FreeOTP.

This will ask, on the phone, for a password to encrypt the backup. Proceed with a password.

Manually extracting the backup

The backups are some form of encrypted tar file. Android Backup Extractor can decrypt them.

It's available on the AUR as android-backup-extractor-git.

Use it like so (this command will ask you for the password you just set to decrypt it):

abe unpack freeotp-backup.ab freeotp-backup.tar

Then extract the generated tar file:

$ tar xvf freeotp-backup.tar
apps/org.fedorahosted.freeotp/_manifest
apps/org.fedorahosted.freeotp/sp/tokens.xml

We don't care about the manifest file, so let's look at apps/org.fedorahosted.freeotp/sp/tokens.xml.

Extract tokens

First, download freeotp_extractor.py, then you can run python freeotp_extractor.py -h :

usage: freeotp_extractor.py [-h] [-v] [-o OUTPUT] input

Extract token from FreeOTP

positional arguments:
  input                 File containing XML with tokens (usually 'tokens.xml')

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -o OUTPUT, --output OUTPUT
                        Give the output file for save tokens

To just have tokens, run python freeotp_extractor.py apps/org.fedorahosted.freeotp/sp/tokens.xml It will output something like :

Dropbox:example@gmail.com: BQ4F6XX3QOFEXQY5SNFPJZW3
gitlab.com:example@gmail.com: 4FBTY2GE3VK7BMFBFOE3X7CR
Google:example@gmail.com: RK6MVRZCQXFBUMGBKZBF5CAA

Or you can pass a output parameter to save it into a file python freeotp_extractor.py -o tokens.json apps/org.fedorahosted.freeotp/sp/tokens.xml

tokens.json:

{
  "Dropbox:example@gmail.com":"BQ4F6XX3QOFEXQY5SNFPJZW3",
  "gitlab.com:example@gmail.com":"4FBTY2GE3VK7BMFBFOE3X7CR",
  "Google:example@gmail.com":"RK6MVRZCQXFBUMGBKZBF5CAA"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freeotp-extractor-0.2.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freeotp_extractor-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file freeotp-extractor-0.2.0.tar.gz.

File metadata

  • Download URL: freeotp-extractor-0.2.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for freeotp-extractor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 28da6caa8d116e36048c707018c5daef116b5c7819579bc8661d58ffa64cc650
MD5 1de7af0bab78581d8ef63dc1f99850b9
BLAKE2b-256 c5bdf0ab23534fd072a6c9a32e3b4631384bb16f429cbc124d514fe31a9a051d

See more details on using hashes here.

File details

Details for the file freeotp_extractor-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: freeotp_extractor-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for freeotp_extractor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 784fb98334d0319f91d7fdacc162b8c3be56de7e9f9bbdd29364f1ec51307617
MD5 4d161ee0e6b928ee2f1c33da8d6f09b0
BLAKE2b-256 e4e88f25bab3e18a46b7c29883eed46099bc3e3797df160dec63f55f0b419355

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page