linux - 使用脚本暴力破解 GPG 密码

标签 linux bash ubuntu gnupg brute-force

<分区>

我忘记了我在 Linux 上的 gpg key 的密码。有人可以帮我写一个简单的脚本来使用暴力破解 key 吗?我记得密码短语中可能包含的一些单词,所以希望我的计算机不会花很长时间来暴力破解它。

如果我无法恢复密码,一切都不会丢失,这只是意味着在接下来的 10 天内我将无法处理我的项目,直到我回去工作以获取文件的另一个副本,但是这使用新 key 的时间,我会记得为其输入密码。

但是,如果能够在这 10 天内处理我的项目,那就太好了。

最佳答案

也许是这样的:

#!/bin/bash
#

# try all word in words.txt
for word in $(cat words.txt); do 

  # try to decrypt with word
  echo "${word}" | gpg --passphrase-fd 0 --no-tty --decrypt somegpgfile.gpg --output somegpgfile;

  # if decrypt is successfull; stop
  if [ $? -eq 0 ]; then

    echo "GPG passphrase is: ${word}";
    exit 0;

  fi

done;

exit 1;

关于linux - 使用脚本暴力破解 GPG 密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4531253/

相关文章:

c - 从 stdin 读取时子进程被孤立时的奇怪行为

c++ - 如何使用 CMake 在 ubuntu 上找到已安装的 Boost 库?

linux - 打包一个自己开发的linux app

linux - 路径必须在表达式 Linux find 之前

linux - ./MakeOVPN.sh : line 12: [! -fDanielIphone.crt]:找不到命令

python - 从 python 在后台运行 "linux" sleep

perl - 如何在 shell 脚本中处理 Perl 数组元素?

docker - Canonical LXD 容器软件和 docker 容器软件之间的主要区别是什么?

java - 我们如何在 ubuntu 上使用 java 检索与 getfacl 和 setfacl 函数相同的信息?

node.js - 无法在 Ubuntu 18.04 Bionic 上安装/删除 mongodb-org - "mongodb-org-tools : Depends: mongodb-database-tools but it is not installed"