我正在尝试使用OpenGPG并在尝试解密某些内容时会打开密码提示。现在我正在尝试自动运行,因此无法输入密码。所以我的问题是如何将密码传递给我正在运行的批处理文件的exe打开的这个新提示。我看过gpg2.exe -help,如果有人熟悉OpenGPG,或者如果有一个命令我可以运行将密码传递给新提示,那么就无法传递密码作为参数,这将是很棒的。
gpg2.exe -o output.txt -d series.txt.gpg
答案 0 :(得分:1)
经过多次尝试尝试使用此功能后,我终于在http://linux.die.net/man/1/gpg2检查了gpg2.exe的手册,并在添加命令行参数后 - 应用程序接受了--passphrase。< / p>
不这样做会导致提示用户。
希望这可以帮助将来试图破解的任何人。
答案 1 :(得分:0)
echo password | gpg2.exe -o output.txt -d series.txt.gpg
答案 2 :(得分:0)
GnuPG提供了多种非交互式传递密码的方法。使用参数--passphrase [password]
可能是最简单的参数,具体取决于您的用例,其他参数也可能是您感兴趣的(例如,如果您不想在您的应用程序代码中存储密码)。
来自man gpg
:
--passphrase-fd n
Read the passphrase from file descriptor n. Only the first line will be read
from file descriptor n. If you use 0 for n, the passphrase will be read from
STDIN. This can only be used if only one passphrase is supplied.
--passphrase-file file
Read the passphrase from file file. Only the first line will be read from
file file. This can only be used if only one passphrase is supplied. Obvi-
ously, a passphrase stored in a file is of questionable security if other
users can read this file. Don't use this option if you can avoid it.
--passphrase string
Use string as the passphrase. This can only be used if only one passphrase
is supplied. Obviously, this is of very questionable security on a multi-
user system. Don't use this option if you can avoid it.