Bash Python 中的命令不向终端输出任何内容
Bash command inPython not outputting anything to terminal
我正在尝试 运行 bash 命令来启动 Nikto 并在终端中显示输出,但是程序没有返回任何内容。非常感谢任何帮助,谢谢。
命令 运行 在输入到 python 程序之前在终端中没问题
import subprocess
import os
def bash(command):
return subprocess.check_output(['bash', '-c', command])
def niktoScan():
res = bash('nikto -Display 1234EP -o report.html -Format htm -Tuning 123bde -host 127.0.0.1').splitlines()
print(res)
到目前为止,您只定义了函数,但还没有调用它们。如果我没理解错,你可以在最后加上niktoScan()
:
import subprocess
import os
def bash(command):
return subprocess.check_output(['bash', '-c', command])
def niktoScan():
res = bash('nikto -Display 1234EP -o report.html -Format htm -Tuning 123bde -host 127.0.0.1').splitlines()
print(res)
niktoScan()
我正在尝试 运行 bash 命令来启动 Nikto 并在终端中显示输出,但是程序没有返回任何内容。非常感谢任何帮助,谢谢。
命令 运行 在输入到 python 程序之前在终端中没问题
import subprocess
import os
def bash(command):
return subprocess.check_output(['bash', '-c', command])
def niktoScan():
res = bash('nikto -Display 1234EP -o report.html -Format htm -Tuning 123bde -host 127.0.0.1').splitlines()
print(res)
到目前为止,您只定义了函数,但还没有调用它们。如果我没理解错,你可以在最后加上niktoScan()
:
import subprocess
import os
def bash(command):
return subprocess.check_output(['bash', '-c', command])
def niktoScan():
res = bash('nikto -Display 1234EP -o report.html -Format htm -Tuning 123bde -host 127.0.0.1').splitlines()
print(res)
niktoScan()