我正在尝试破解忘记的 luks 分区密码。我生成了一个组合列表,现在我尝试从 Perl 脚本解密该卷。
问题是从脚本本身输入提示符,因为: system('cryptsetup', ('open', '/dev/sdd1', 'crypt-vol', '--type=luks '))
只是吐出输入/dev/sdd1 的密码
并等待我手动输入。
我该如何解决这个问题?
非常感谢您的帮助。
* 这是我的卷,我还没有完全忘记密码,所以我创建了组合列表,前提是我记得一些细节。它有 >6k 种可能性,所以破解它应该是可行的。
最佳答案
不要,在 cryptsetup 中使用“ key 文件”。 key 文件可以是 STDIN。
所以:
echo "passphrase_here" | cryptsetup -d - <other options>
在 Perl 中,您可以使用 IPC::Run2
来实现此目的,它允许您读取/写入 FH,但如果您只需要返回代码来测试密码,则不需要。
例如https://blog.sleeplessbeastie.eu/2019/03/27/how-to-test-luks-passphrase/
所以:
open ( my $crypter, '|-', "cryptsetup luksOpen -d - --test-passphrase " )
print {$crypter} "Your passphrase";
close ( $crypter );
print "Got return code of $?"
关于perl - 如何从 Perl 脚本输入/应答终端提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64076882/