我正在尝试开发一个脚本来读取 pcap 文件并从中提取一些字段,但使用 tshark 作为子进程。但是我收到有关 cmd 的语法错误。谁能帮我解决这个问题?
def srcDestDport (filename):
cmd = r"tshark -o column.format:"Source","%s", "Destination","%d", "dstport"," %uD"' -r %s"%(filename)
subcmd = cmd.split(' ')
lines = subprocess.Popen(subcmd,stdout=subprocess.PIPE)
return lines