
Google Authenticator 支持设备间转移和 google 云备份,但是在软件内不能直接查看到密钥,不能很方便的进行密钥的本地保存和备份,或者是迁移到其它 2FA 平台。这里介绍一个从 Google Authenticator 解密获取到 2FA 密钥的工具和使用方法。
转移账号导出账号这里我们会看到一个二维码,截图保存为文件,比如ga.jpg。
为了方便整个过程,我写了一个命令行工具 decodeGoogleOTP ,前往Github 下载页面,根据自己的平台,下载最新版本的工具。
下载后解压,为了方便操作可以重命名一下,比如 windows 平台重命名为decodeGoogleOTP.exe,然后和ga.jpg放在一个文件夹下。
decodeGoogleOTP 支持将结果导出为 csv 文件、json 文件、txt 文件或者二维码图片等多种格式。如果我们需要将结果导出为 json 文件,运行如下命令即可
decodeGoogleOTP -i ga.jpg -c output.json 输出的结果格式如下:
[ { "issuer": "", "name": "xx", "secret": "AAAAAAAAAAA", "type": "totp", "counter": 0, "url": "otpauth://totp/xx?secret=AAAAAAAAAAA" } ] 其中secret字段就是 2FA 密钥,有了密钥就可以方便的转移到其它平台。而url可以用来生成二维码供其它 2FA 软件扫描导入,也可以使用 decodeGoogleOTP 直接导出二维码图片供扫描
更详细的使用方法参考下面的说明
$ decodeGoogleOTP -h decodeGoogleOTP is a command line tool to decode Google OTP QR codes. Output can be json, csv, qrcode or plain text. Usage: decodeGoogleOTP [flags] decodeGoogleOTP [command] Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command version Print current version of the application Flags: -c, --csv string Output in CSV format and specify the output file -d, --debug Enable debug mode -h, --help help for decodeGoogleOTP -i, --input string Input file path -j, --json string Output in JSON format and specify the output file -p, --print-qr Print QR code to terminal -q, --qrcode string Output in QR code image format and specify the output directory -s, --silent Enable silent mode -t, --text string Output url list in plain text format and specify the output file -u, --url string Output in URL format and specify the output file -v, --version Print version information Use "decodeGoogleOTP [command] --help" for more information about a command. 1 YGHMXFAL 2024-05-12 01:12:25 +08:00 不如改变习惯: 每次添加 2FA,先使用 https://f-droid.org/packages/com.atharok.barcodescanner/ 这个开源离线 APP 来解码成字符串并且保存,再正常走 2FA 绑定流程 |
2 xiaobai332 2024-05-12 03:20:18 +08:00 via Android 或许可以下载开源软件 2fas ,扫码导入谷歌验证器中的所有 2fa ,直接看各个密钥(缺点大概是得一个一个看!?) |
3 uuhhme 2024-05-12 08:41:13 +08:00 via Android 直接转到 ente auth 就可以了。之后随时可以看 |
4 ltkun 2024-05-12 10:04:29 +08:00 via Android 个开源的用比如 aegis |
5 hnliuzesen 2024-05-12 10:04:44 +08:00 @xiaobai332 2FAS 如果有 root 权限还可以直接从谷歌验证器导入 |
6 xxbing 2024-05-12 11:07:35 +08:00 @YGHMXFAL #1 我也是这么做的,我单独下载一个二维码扫码的 app,绑 2FA 前先用 扫码 APP 扫一下,再用 google auth 扫描绑定. 二维码 APP 还有扫码历史记录 |
8 Achophiark 2024-05-12 11:57:31 +08:00 keepass 等已经集成了,很方便了,为什么不用 |
10 mahaoqu 2024-05-12 12:42:18 +08:00 MS Authenticator 怎么办 |
11 Andim 2024-05-12 12:50:04 +08:00 @mahaoqu 不管 google 还是 ms 都可以解除现有 2FA ,然后重新绑定,记得保存那个二维码,用时不会超过 2 分钟,还不会有外泄风险 |
12 cioccamilosch697 2024-05-12 13:03:20 +08:00 @YGHMXFAL 你是真不怕密钥泄露,不如买个硬件安全密钥存里面双备份即可 |
13 YGHMXFAL 2024-05-12 13:47:37 +08:00 @cioccamilosch697 怎么泄露?安装扫码器就禁止它联网了,解码成字符串就加密同步到电脑 |
14 BeautifulSoap 2024-05-12 13:49:34 +08:00 via Android 全交给 bitwarden 了至少没那么麻烦 包括谷歌认证在内一堆 app 连导出都麻烦的一批,谁爱用谁用 |
15 6bsLo69Qdu3RPY4c 2024-05-13 10:01:51 +08:00 和 Google 比我不相信你们的产品。反正我用谷歌,你们爱用不用 |
16 dislazy2023 2024-05-13 11:44:12 +08:00 我自建了 bitwarden rust 版本 用了好几年了 |
17 dfdd1811 2024-05-17 09:15:11 +08:00 阿里云的 mfa 能不能解成密钥,他那个导出出来的密钥没法导入别的软件,真狗啊… |
19 huchenz1in 2024-12-19 22:35:06 +08:00 现在貌似导出的时候有两个二维码了 |