elliotwutingfeng/aegis-backup-decryptor

GitHub: elliotwutingfeng/aegis-backup-decryptor

一个基于 Ruby 的命令行工具,专门用于解密 Aegis Authenticator 导出的加密备份文件。

Stars: 12 | Forks: 0

# Aegis 备份解密工具 [![Ruby](https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge&logo=ruby&logoColor=white)](https://ruby-lang.org) [![Coveralls](https://img.shields.io/coverallsCoverage/github/elliotwutingfeng/aegis-backup-decryptor?logo=coveralls&style=for-the-badge)](https://coveralls.io/github/elliotwutingfeng/aegis-backup-decryptor?branch=main) [![GitHub 许可证](https://img.shields.io/badge/LICENSE-GPLv3-GREEN?style=for-the-badge)](LICENSE) 用于解密从 [Aegis Authenticator 应用](https://getaegis.app) 导出的备份文件的 CLI 工具。 本应用与 Beem Development 及 Aegis Authenticator 均无关联。 ## 系统要求 - **Ruby:** 2.5+ / 3.0+,无需外部 gem - **OpenSSL:** 1.1+ / 3.0+ - 在终端中运行以下命令查看 Ruby 解释器的 [OpenSSL](https://openssl.org) 版本 ``` ruby -e "require 'openssl'; puts OpenSSL::OPENSSL_LIBRARY_VERSION" # 示例输出 # OpenSSL 3.4.0 2024年10月22日 ``` - 不支持 [LibreSSL](https://libressl.org) - **操作系统:** Windows、macOS 或 Linux 均可 ### 安全性 (此处原文为空,保留为空块) ## 示例 **文件:** `test/encrypted_test.json` **密码:** `test` ``` # 当提示时输入上述密码 ruby lib/decrypt.rb test/encrypted_test.json ``` 你将得到如下明文 JSON 输出: ``` { "version": 1, "entries": [ { "type": "totp", "uuid": "3ae6f1ad-2e65-4ed2-a953-1ec0dff2386d", "name": "Mason", "issuer": "Deno", "icon": null, "info": { "secret": "4SJHB4GSD43FZBAI7C2HLRJGPQ", "algo": "SHA1", "digits": 6, "period": 30 } }, { "type": "totp", "uuid": "84b55971-a3d2-4173-a5bb-0aea113dbc17", "name": "James", "issuer": "SPDX", "icon": null, "info": { "secret": "5OM4WOOGPLQEF6UGN3CPEOOLWU", "algo": "SHA256", "digits": 7, "period": 20 } }, { "type": "totp", "uuid": "3deaff2e-f181-4837-80e1-fdf0c54e9363", "name": "Elijah", "issuer": "Airbnb", "icon": null, "info": { "secret": "7ELGJSGXNCCTV3O6LKJWYFV2RA", "algo": "SHA512", "digits": 8, "period": 50 } }, { "type": "hotp", "uuid": "0a8c0571-ff6f-4b02-aa4b-50553b4fb4fe", "name": "James", "issuer": "Issuu", "icon": null, "info": { "secret": "YOOMIXWS5GN6RTBPUFFWKTW5M4", "algo": "SHA1", "digits": 6, "counter": 1 } }, { "type": "hotp", "uuid": "03e572f2-8ebd-44b0-a57e-e958af74815d", "name": "Benjamin", "issuer": "Air Canada", "icon": null, "info": { "secret": "KUVJJOM753IHTNDSZVCNKL7GII", "algo": "SHA256", "digits": 7, "counter": 50 } }, { "type": "hotp", "uuid": "b25f8815-007f-40f7-a700-ce058ac05435", "name": "Mason", "issuer": "WWE", "icon": null, "info": { "secret": "5VAML3X35THCEBVRLV24CGBKOY", "algo": "SHA512", "digits": 8, "counter": 10300 } }, { "type": "steam", "uuid": "5b11ae3b-6fc3-4d46-8ca7-cf0aea7de920", "name": "Sophia", "issuer": "Boeing", "icon": null, "info": { "secret": "JRZCL47CMXVOQMNPZR2F7J4RGI", "algo": "SHA1", "digits": 5, "period": 30 } } ] } ``` ### 其他格式 你还可以添加 `-f / --format` 选项,将明文输出打印为 `csv` 或 `pretty`(一种用空格填充的类似 CSV 的字符串)。 #### csv ``` # 当提示时输入上述密码 ruby lib/decrypt.rb test/encrypted_test.json -f csv ``` ``` uuid,type,name,issuer,info.secret,info.period,info.digits,info.counter,info.algo,icon 3ae6f1ad-2e65-4ed2-a953-1ec0dff2386d,totp,Mason,Deno,4SJHB4GSD43FZBAI7C2HLRJGPQ,30,6,,SHA1, 84b55971-a3d2-4173-a5bb-0aea113dbc17,totp,James,SPDX,5OM4WOOGPLQEF6UGN3CPEOOLWU,20,7,,SHA256, 3deaff2e-f181-4837-80e1-fdf0c54e9363,totp,Elijah,Airbnb,7ELGJSGXNCCTV3O6LKJWYFV2RA,50,8,,SHA512, 0a8c0571-ff6f-4b02-aa4b-50553b4fb4fe,hotp,James,Issuu,YOOMIXWS5GN6RTBPUFFWKTW5M4,,6,1,SHA1, 03e572f2-8ebd-44b0-a57e-e958af74815d,hotp,Benjamin,Air Canada,KUVJJOM753IHTNDSZVCNKL7GII,,7,50,SHA256, b25f8815-007f-40f7-a700-ce058ac05435,hotp,Mason,WWE,5VAML3X35THCEBVRLV24CGBKOY,,8,10300,SHA512, 5b11ae3b-6fc3-4d46-8ca7-cf0aea7de920,steam,Sophia,Boeing,JRZCL47CMXVOQMNPZR2F7J4RGI,30,5,,SHA1, ``` #### pretty ``` # 当提示时输入上述密码 ruby lib/decrypt.rb test/encrypted_test.json -f pretty ``` ``` uuid type name issuer info.secret info.period info.digits info.counter info.algo icon 3ae6f1ad-2e65-4ed2-a953-1ec0dff2386d totp Mason Deno 4SJHB4GSD43FZBAI7C2HLRJGPQ 30 6 SHA1 84b55971-a3d2-4173-a5bb-0aea113dbc17 totp James SPDX 5OM4WOOGPLQEF6UGN3CPEOOLWU 20 7 SHA256 3deaff2e-f181-4837-80e1-fdf0c54e9363 totp Elijah Airbnb 7ELGJSGXNCCTV3O6LKJWYFV2RA 50 8 SHA512 0a8c0571-ff6f-4b02-aa4b-50553b4fb4fe hotp James Issuu YOOMIXWS5GN6RTBPUFFWKTW5M4 6 1 SHA1 03e572f2-8ebd-44b0-a57e-e958af74815d hotp Benjamin Air Canada KUVJJOM753IHTNDSZVCNKL7GII 7 50 SHA256 b25f8815-007f-40f7-a700-ce058ac05435 hotp Mason WWE 5VAML3X35THCEBVRLV24CGBKOY 8 10300 SHA512 5b11ae3b-6fc3-4d46-8ca7-cf0aea7de920 steam Sophia Boeing JRZCL47CMXVOQMNPZR2F7J4RGI 30 5 SHA1 ``` ### 隐藏不需要的字段 当 `-f / --format` 选项设置为 `csv` 或 `pretty` 时,可以使用 `-e / --except` 选项隐藏不需要的字段。不存在的字段会被静默忽略。 ``` # 当提示时输入上述密码 ruby lib/decrypt.rb test/encrypted_test.json -f pretty -e icon,icon_mime,icon_hash,favorite,note,uuid ``` ``` type name issuer info.secret info.period info.digits info.counter info.algo totp Mason Deno 4SJHB4GSD43FZBAI7C2HLRJGPQ 30 6 SHA1 totp James SPDX 5OM4WOOGPLQEF6UGN3CPEOOLWU 20 7 SHA256 totp Elijah Airbnb 7ELGJSGXNCCTV3O6LKJWYFV2RA 50 8 SHA512 hotp James Issuu YOOMIXWS5GN6RTBPUFFWKTW5M4 6 1 SHA1 hotp Benjamin Air Canada KUVJJOM753IHTNDSZVCNKL7GII 7 50 SHA256 hotp Mason WWE 5VAML3X35THCEBVRLV24CGBKOY 8 10300 SHA512 steam Sophia Boeing JRZCL47CMXVOQMNPZR2F7J4RGI 30 5 SHA1 ``` ## 测试 ``` gem install bundler bundle install bundle exec rspec -r spec_helper ``` ## 打包捆绑的 Gem ``` rm -rf vendor/ gem unpack csv -v 3.3.3 --target=vendor/gems/ ``` 然后在 Gemfile 中更新 gem 版本,并运行 `bundle install`。
标签:Aegis Authenticator, HTTP 参数枚举, OpenSSL, Ruby, TOTP, 双因素认证, 备份恢复, 备份解密, 安全, 安全测试工具, 密码学, 手动系统调用, 数据恢复, 知识库, 解密, 认证, 超时处理