{"id":19684234,"url":"https://github.com/elliotwutingfeng/2fas-backup-decryptor","last_synced_at":"2025-04-29T06:30:25.981Z","repository":{"id":216476648,"uuid":"741426540","full_name":"elliotwutingfeng/2fas-backup-decryptor","owner":"elliotwutingfeng","description":"CLI tool to decrypt backup files exported from the 2FAS Authenticator app. This application is neither affiliated with Two Factor Authentication Service, Inc. nor 2FAS.","archived":false,"fork":false,"pushed_at":"2024-09-07T16:48:43.000Z","size":131,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-07T18:11:08.396Z","etag":null,"topics":["2fa","2fas","aes","aes-gcm","android","backup","cryptography","cybersecurity","decryption","encrypt","encryption","hmac-sha256","ios","linux","macos","otp","pbkdf2","security","totp","windows"],"latest_commit_sha":null,"homepage":"https://2fas.com/support/2fas-mobile-app/i-want-to-move-copy-transfer-tokens-codes-between-ios-and-android","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elliotwutingfeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-10T11:23:25.000Z","updated_at":"2024-09-07T16:48:46.000Z","dependencies_parsed_at":"2024-01-15T11:34:07.272Z","dependency_job_id":"50a3aa89-611e-4645-b34d-3d9eb3779fde","html_url":"https://github.com/elliotwutingfeng/2fas-backup-decryptor","commit_stats":null,"previous_names":["elliotwutingfeng/2fas-backup-decryptor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotwutingfeng%2F2fas-backup-decryptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotwutingfeng%2F2fas-backup-decryptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotwutingfeng%2F2fas-backup-decryptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotwutingfeng%2F2fas-backup-decryptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elliotwutingfeng","download_url":"https://codeload.github.com/elliotwutingfeng/2fas-backup-decryptor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224151083,"owners_count":17264436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","2fas","aes","aes-gcm","android","backup","cryptography","cybersecurity","decryption","encrypt","encryption","hmac-sha256","ios","linux","macos","otp","pbkdf2","security","totp","windows"],"created_at":"2024-11-11T18:17:12.062Z","updated_at":"2025-04-29T06:30:25.967Z","avatar_url":"https://github.com/elliotwutingfeng.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 2FAS Backup Decryptor\n\n[![Ruby](https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge\u0026logo=ruby\u0026logoColor=white)](https://ruby-lang.org)\n[![Coveralls](https://img.shields.io/coverallsCoverage/github/elliotwutingfeng/2fas-backup-decryptor?logo=coveralls\u0026style=for-the-badge)](https://coveralls.io/github/elliotwutingfeng/2fas-backup-decryptor?branch=main)\n[![GitHub license](https://img.shields.io/badge/LICENSE-GPLv3-GREEN?style=for-the-badge)](LICENSE)\n\nCLI tool to decrypt backup files exported from the [2FAS Authenticator app](https://2fas.com).\n\nThis application is neither affiliated with Two Factor Authentication Service, Inc. nor 2FAS.\n\n## Requirements\n\n- **Ruby:** 2.5+/3.0+, no external gems needed\n- **OpenSSL:** 1.0.2+/3.0+\n  - In the terminal, run the following to view your Ruby interpreter's [OpenSSL](https://openssl.org) version\n\n    ```bash\n    ruby -e \"require 'openssl'; puts OpenSSL::OPENSSL_LIBRARY_VERSION\"\n    # Example output\n    # OpenSSL 3.4.0 22 Oct 2024\n    ```\n\n  - [LibreSSL](https://libressl.org) is not supported\n\n- **OS:** Either Windows, macOS, or Linux\n\n### Safety\n\n\u003e [!CAUTION]\n\u003e This program writes the backup file content to stdout in plaintext. By default, this means the content will be displayed on the screen.\n\u003e\n\u003e **Recommended precautions:**\n\u003e\n\u003e - Do NOT decrypt your backup file in public areas, or in the presence of untrusted persons and surveillance cameras.\n\u003e - Do NOT decrypt your backup file on a machine that you suspect to be infected by malware.\n\u003e - ENSURE that your terminal session output is not being unintentionally saved or recorded.\n\n## Example\n\n**File:** `test/encrypted_test.2fas`\n\n**Password:** `example.com`\n\n```bash\n# Enter the above password when prompted\nruby lib/decrypt.rb test/encrypted_test.2fas\n```\n\nYou should get the following plaintext JSON output.\n\n```json\n[{\"name\":\"Deno\",\"secret\":\"4SJHB4GSD43FZBAI7C2HLRJGPQ\",\"updatedAt\":1708958115316,\"otp\":{\"label\":\"Mason\",\"account\":\"Mason\",\"issuer\":\"Deno\",\"digits\":6,\"period\":30,\"algorithm\":\"SHA1\",\"tokenType\":\"TOTP\",\"source\":\"Link\"},\"order\":{\"position\":0},\"icon\":{\"selected\":\"Label\",\"label\":{\"text\":\"DE\",\"backgroundColor\":\"Brown\"},\"iconCollection\":{\"id\":\"a5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad\"}}},{\"name\":\"SPDX\",\"secret\":\"5OM4WOOGPLQEF6UGN3CPEOOLWU\",\"updatedAt\":1708958115348,\"otp\":{\"label\":\"James\",\"account\":\"James\",\"issuer\":\"SPDX\",\"digits\":7,\"period\":30,\"algorithm\":\"SHA256\",\"tokenType\":\"TOTP\",\"source\":\"Link\"},\"order\":{\"position\":1},\"icon\":{\"selected\":\"Label\",\"label\":{\"text\":\"SP\",\"backgroundColor\":\"Red\"},\"iconCollection\":{\"id\":\"a5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad\"}}},{\"name\":\"Airbnb\",\"secret\":\"7ELGJSGXNCCTV3O6LKJWYFV2RA\",\"updatedAt\":1708958115376,\"otp\":{\"label\":\"Elijah\",\"account\":\"Elijah\",\"issuer\":\"Airbnb\",\"digits\":8,\"period\":60,\"algorithm\":\"SHA512\",\"tokenType\":\"TOTP\",\"source\":\"Link\"},\"order\":{\"position\":2},\"icon\":{\"selected\":\"Label\",\"label\":{\"text\":\"AI\",\"backgroundColor\":\"Pink\"},\"iconCollection\":{\"id\":\"a5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad\"}}},{\"name\":\"Boeing\",\"secret\":\"JRZCL47CMXVOQMNPZR2F7J4RGI\",\"updatedAt\":1708958115391,\"otp\":{\"label\":\"Sophia\",\"account\":\"Sophia\",\"issuer\":\"Boeing\",\"digits\":5,\"period\":10,\"algorithm\":\"SHA1\",\"tokenType\":\"STEAM\",\"source\":\"Link\"},\"order\":{\"position\":3},\"icon\":{\"selected\":\"Label\",\"label\":{\"text\":\"BO\",\"backgroundColor\":\"Brown\"},\"iconCollection\":{\"id\":\"a5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad\"}}},{\"name\":\"Air Canada\",\"secret\":\"KUVJJOM753IHTNDSZVCNKL7GII\",\"updatedAt\":1708958401763,\"otp\":{\"link\":\"otpauth://hotp/Benjamin?secret=KUVJJOM753IHTNDSZVCNKL7GII\u0026issuer=Air%20Canada\u0026counter=10\u0026algorithm=SHA256\u0026digits=8\",\"label\":\"Benjamin\",\"account\":\"Benjamin\",\"issuer\":\"Air Canada\",\"digits\":8,\"algorithm\":\"SHA256\",\"counter\":10,\"tokenType\":\"HOTP\",\"source\":\"Link\"},\"order\":{\"position\":4},\"icon\":{\"selected\":\"Label\",\"label\":{\"text\":\"AI\",\"backgroundColor\":\"Brown\"},\"iconCollection\":{\"id\":\"a5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad\"}}}]\n```\n\n### Other formats\n\nYou can also add the `-f / --format` option to print the plaintext output as `csv` or as a `pretty` CSV-like String padded with spaces.\n\n#### csv\n\n```bash\n# Enter the above password when prompted\nruby lib/decrypt.rb test/encrypted_test.2fas -f csv\n```\n\n```csv\nicon.iconCollection.id,icon.label.backgroundColor,icon.label.text,icon.selected,name,order.position,otp.account,otp.algorithm,otp.counter,otp.digits,otp.issuer,otp.label,otp.link,otp.period,otp.source,otp.tokenType,secret,updatedAt\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad,Brown,DE,Label,Deno,0,Mason,SHA1,,6,Deno,Mason,,30,Link,TOTP,4SJHB4GSD43FZBAI7C2HLRJGPQ,1708958115316\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad,Red,SP,Label,SPDX,1,James,SHA256,,7,SPDX,James,,30,Link,TOTP,5OM4WOOGPLQEF6UGN3CPEOOLWU,1708958115348\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad,Pink,AI,Label,Airbnb,2,Elijah,SHA512,,8,Airbnb,Elijah,,60,Link,TOTP,7ELGJSGXNCCTV3O6LKJWYFV2RA,1708958115376\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad,Brown,BO,Label,Boeing,3,Sophia,SHA1,,5,Boeing,Sophia,,10,Link,STEAM,JRZCL47CMXVOQMNPZR2F7J4RGI,1708958115391\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad,Brown,AI,Label,Air Canada,4,Benjamin,SHA256,10,8,Air Canada,Benjamin,otpauth://hotp/Benjamin?secret=KUVJJOM753IHTNDSZVCNKL7GII\u0026issuer=Air%20Canada\u0026counter=10\u0026algorithm=SHA256\u0026digits=8,,Link,HOTP,KUVJJOM753IHTNDSZVCNKL7GII,1708958401763\n```\n\n#### pretty\n\n```bash\n# Enter the above password when prompted\nruby lib/decrypt.rb test/encrypted_test.2fas -f pretty\n```\n\n```csv\nicon.iconCollection.id                icon.label.backgroundColor  icon.label.text  icon.selected  name        order.position  otp.account  otp.algorithm  otp.counter  otp.digits  otp.issuer  otp.label  otp.link                                                                                                            otp.period  otp.source  otp.tokenType  secret                      updatedAt\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad  Brown                       DE               Label          Deno        0               Mason        SHA1                        6           Deno        Mason                                                                                                                          30          Link        TOTP           4SJHB4GSD43FZBAI7C2HLRJGPQ  1708958115316\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad  Red                         SP               Label          SPDX        1               James        SHA256                      7           SPDX        James                                                                                                                          30          Link        TOTP           5OM4WOOGPLQEF6UGN3CPEOOLWU  1708958115348\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad  Pink                        AI               Label          Airbnb      2               Elijah       SHA512                      8           Airbnb      Elijah                                                                                                                         60          Link        TOTP           7ELGJSGXNCCTV3O6LKJWYFV2RA  1708958115376\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad  Brown                       BO               Label          Boeing      3               Sophia       SHA1                        5           Boeing      Sophia                                                                                                                         10          Link        STEAM          JRZCL47CMXVOQMNPZR2F7J4RGI  1708958115391\na5b3fb65-4ec5-43e6-8ec1-49e24ca9e7ad  Brown                       AI               Label          Air Canada  4               Benjamin     SHA256         10           8           Air Canada  Benjamin   otpauth://hotp/Benjamin?secret=KUVJJOM753IHTNDSZVCNKL7GII\u0026issuer=Air%20Canada\u0026counter=10\u0026algorithm=SHA256\u0026digits=8              Link        HOTP           KUVJJOM753IHTNDSZVCNKL7GII  1708958401763\n```\n\n### Hiding unwanted fields\n\nWhen the `-f / --format` option is set to `csv` or `pretty`, you can use the `-e / --except` option to hide unwanted fields. Non-existent fields are silently ignored.\n\n```bash\n# Enter the above password when prompted\nruby lib/decrypt.rb test/encrypted_test.2fas -f pretty -e icon.iconCollection.id,icon.label.backgroundColor,icon.label.text,icon.selected,order.position,otp.link,name,otp.account,otp.source,updatedAt\n```\n\n```csv\notp.algorithm  otp.counter  otp.digits  otp.issuer  otp.label  otp.period  otp.tokenType  secret\nSHA1                        6           Deno        Mason      30          TOTP           4SJHB4GSD43FZBAI7C2HLRJGPQ\nSHA256                      7           SPDX        James      30          TOTP           5OM4WOOGPLQEF6UGN3CPEOOLWU\nSHA512                      8           Airbnb      Elijah     60          TOTP           7ELGJSGXNCCTV3O6LKJWYFV2RA\nSHA1                        5           Boeing      Sophia     10          STEAM          JRZCL47CMXVOQMNPZR2F7J4RGI\nSHA256         10           8           Air Canada  Benjamin               HOTP           KUVJJOM753IHTNDSZVCNKL7GII\n```\n\n## Testing\n\n```bash\ngem install bundler\nbundle install\nbundle exec rspec -r spec_helper\n```\n\n## Vendoring Bundled Gems\n\n```bash\nrm -rf vendor/\ngem unpack csv --target=vendor/gems/\n```\n\nThen update gem versions in Gemfile, and run `bundle install`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotwutingfeng%2F2fas-backup-decryptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felliotwutingfeng%2F2fas-backup-decryptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotwutingfeng%2F2fas-backup-decryptor/lists"}