0
接收输出时
我的代码应该追查的数据包,Scapy的闻了闻,并检查该程序发送/接收数据包,把“未知”如果程序没有找到蟒蛇 - 错误试图从check_output
代码:
source_software = check_output(["netstat", "-nb"], shell = True).decode()
source_software = source_software[source_software.find(str(packet_dictionary["Port"])) : ]
source_software = source_software[source_software.find("\n") + 2 : source_software.find("]")]
if "Can not" not in source_software and len(source_software) > MINIMUM_LENGTH:
packet_dictionary["Software"] = source_software
else:
packet_dictionary["Software"] = "Unknown"
错误:
File "Client.py", line 44, in add_to_list
source_software = check_output(["netstat", "-nb"], shell = True).decode()
File "C:\Python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Python36\lib\subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['netstat', '-nb']' returned non-zero
exit status 1.
我忘了调试它,我在几个星期前编码这段代码和今天又回来了,忘了我必须以管理员身份运行它 – NeXoR