n/chit-chatu/James · 5개월 전
회원가입 로그인
n/chit-chat · 5개월 전 · 조회 841회
u/James💯레전드

从Google Authenticator解密获取2FA密钥备份教程

启用2FA可以有效的保证账户安全,但一旦手机丢失或者换手机等操作不当丢失2FA密钥就会导致账户可能再也无法找回。Google Authenticator是一个常用的二步验证动态口令生成工具,支持设备间转移和google云备份,但是在软件内不能直接查看到密钥,不能很方便的进行密钥的本地保存和备份,或者是迁移到其它2FA平台。这里介绍一个从Google Authenticator解密获取到2FA密钥的工具和使用方法。

操作过程

导出配置文件二维码

  1. 打开Google Authenticator,点击左上角的三条横线按钮,选择转移账号
  2. 选择导出账号
  3. 勾选需要导出的账号并点击下一步

这里我们会看到一个二维码,截图保存为文件,比如ga.jpg。

使用decodeGoogleOTP工具解码

为了方便整个过程,我写了一个命令行工具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.
17
34
로그인하고 토론에 참여하세요.

답글 34개

정렬
  1. xingyun1000 골드 5개월 전

    支持一下啊

    1
  2. LOL 골드 5개월 전

    这个可以有,喜欢多一层备份的狂喜

    1
  3. Aneirin-supar 골드 5개월 전

    支持一下啊 :xhj001:

    1
  4. Wade 골드 3년 5개월 전

    这个好

    1
  5. Furry 마스터 문성 5개월 전

    有点意思 第一个

    0
  6. bashell 다이아몬드 5개월 전

    感谢分享🙏🏻

    0
  7. linying23333 😇 다이아몬드 2년 5개월 전

    hhh,由于我不用google 2fa,所以本身hotp就是明文的url链接(然后微软2fa的app又不支持导出)
    很遗憾用不上了

    0
  8. Halim_Abdullah 실버 5개월 전

    来学习了

    0
  9. haoqi75 골드 5개월 전

    以后再也不怕账号被丢了,👍支持大佬,已保存。

    0
  10. linxone2895 골드 5개월 전

    支持一下啊! :xhj001:

    0
  11. dearfaint 실버 5개월 전

    Mark~换机使用

    0
  12. tonylive 골드 3년 5개월 전

    支持一下,学习了

    0
  13. NooMI 골드 5개월 전

    这个好啊,转移到bitwarden上面去就很舒服了

    0
  14. James 💯 레전드 글쓴이 관리자 5개월 전

    可以试试 NodeAuth

    1
  15. NooMI 골드 5개월 전

    也是密码管理工具吗

    0
  16. James 💯 레전드 글쓴이 관리자 5개월 전

    是的,站内大佬开发的,我已经用上了,很好用。

    0
  17. duan15 실버 5개월 전

    这个得要授权码啊,

    0
  18. MuYbaby 골드 3년 5개월 전

    看上去是一个很实用的小工具

    0
  19. pmg 골드 3년 5개월 전

    我的常规做法是保留二维码做备份

    0
  20. gzj000p 골드 3년 5개월 전

    感谢,收藏了

    0
  21. jojodat 골드 5개월 전

    看上去是一个很实用的小工具

    0
  22. sb_o 실버 5개월 전

    我第一个用的密码管理器,被阿三的软件设计气到了

    0
  23. sdcfre 다이아몬드 3년 5개월 전

    感谢分享

    0
  24. Arvin_Leung 🚗 글로리 3년 5개월 전

    我一直都是用bitwarden,都很懒去折腾别的。

    0
  25. anlish 골드 5개월 전

    还有个更简便的方法,Google Authenticator导出,显示二维码后,用Aegis(google play里面搜索下载)扫码就可以了,或者把二维码拍下来(一般的手机为了安全这个界面截不了屏),再用Google Authenticator同一个手机的Aegis扫码

    0
  26. Young2095 골드 5개월 전

    支持一下,学习了! :xhj001:

    0
  27. lbj 플래티넘 3년 5개월 전

    可以,正好备份一下

    0
  28. zpxocikkk 골드 5개월 전

    这个很有必要操作

    0
  29. cjohn 끝까지 함께 5개월 전

    學習

    0
  30. MSaZs 골드 5개월 전

    支持

    0
  31. Bridge 골드 5개월 전

    mark备用

    0
  32. yifang 골드 5개월 전
    모더레이터가 삭제한 댓글입니다
  33. Zanimelle 실버 3년 5개월 전

    不错不错,但其实更想把微软的Authenticator里的提取出来

    0
  34. q120656387 골드 5개월 전

    这是实用的玩意,必须支持一下,感谢分享

    0