运行开膛手约翰的Python脚本

时间:2018-10-19 03:46:39

标签: python bash subprocess john-the-ripper

我正在做一个学校项目,我必须以python脚本的方式运行John Ripper。

当前,我正在运行这样的命令。

subprocess.run(['john --wordlist=/usr/share/john/password.lst --format=sha512crypt /root/Desktop/passwd '], shell=True)

我的问题是,它在命令终端中打印了很多过程,而终端中却没有任何显示。无论如何,我可以做到这一点,以便它在终端上什么也不打印吗?

谢谢

1 个答案:

答案 0 :(得分:0)

您要重定向打印,以便将其转储到文件中,而不是在终端上打印。 您可能想要在代码后添加类似内容。

f = open("test.py", "w+")
print(output.stdout,f.write(output.stdout))

如果您执行cat test.py,应该会看到输出。