我为 Kali Linux GONE 64 (Debian 7) 写了一个 python 程序。我写它是为了让它用下面的命令运行 metasploit 数据库。问题是我在不同的 shell 中打开了所有这些命令。我想在一个 shell 中一一运行它们。我如何在 python 中执行此操作?
import os
os.system("service postgresql start")
os.system("wait")
os.system("service metasploit start")
os.system("wait")
os.system("armitage")
最佳答案
import subprocess
subprocess.call("service postgresql start ; wait ; service metasploit start ; wait ; armitagedate", shell=True)
关于Python操作系统命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20938293/