ITADN
elliotwutingfeng/aegis-backup-decryptor
elliotwutingfeng/aegis-backup-decryptor · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈

Aegis 备份解密器

Ruby Coveralls GitHub license

用于解密从 Aegis Authenticator 应用 导出的备份文件的 CLI 工具。

本应用与 Beem Development 或 Aegis Authenticator 均无关联。

要求

  • Ruby: 2.5+/3.0+,无需外部 gems

  • OpenSSL: 1.1+/3.0+

    • 在终端中,运行以下命令以查看您的 Ruby 解释器的 OpenSSL 版本

      ruby -e "require 'openssl'; puts OpenSSL::OPENSSL_LIBRARY_VERSION"
      # Example output
      # OpenSSL 3.4.0 22 Oct 2024
  • LibreSSL 不受支持

  • 操作系统: Windows、macOS 或 Linux

安全性

[!CAUTION] 此程序会将备份文件内容以明文形式写入标准输出。默认情况下,这意味着内容将显示在屏幕上。

建议的预防措施:

  • 请勿在公共区域,或在不可信人员及监控摄像头附近解密您的备份文件。
  • 请勿在疑似感染恶意软件的机器上解密您的备份文件。
  • 请确保您的终端会话输出未被意外保存或记录。

示例

文件: test/encrypted_test.json

密码: test

# Enter the above password when prompted
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

# Enter the above password when prompted
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,

美观

# Enter the above password when prompted
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 选项设置为 csvpretty 时,您可以使用 -e / --except 选项来隐藏不需要的字段。不存在的字段将被静默忽略。

# Enter the above password when prompted
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 的 Vendoring

rm -rf vendor/
gem unpack csv -v 3.3.3 --target=vendor/gems/

然后更新 Gemfile 中的 gem 版本,并运行 bundle install