0
from scapy.all import *
def print_summary(pkt):
for i in pkt:
sport=[pkt[TCP].sport]
if (sport[i]!=sport[i+1]):
packet=sport
print packet
sniff(offline="/root/ip2.pcap",prn = print_summary)
你能写一些你想要的描述或输出,或者至少有一些错误吗? –
从scapy.all进口* 一个= [] DEF print_summary(PKT): 运动= [PKT [TCP]。运动] 对于i中的运动: a.append(运动) 打印一个 嗅( offline =“/ root/ip2.pcap”,prn = print_summary,count = 5) – 445
对于上述代码,我得到的输出为[0128] [49792],[60476]] [[27887],[49792],[60476],[52345]] [[27887],[49792],[60476],[52345], – 445