我有程序提取PCAP ARP src\u ip和Dest\u ip并保存在CSV文件中。我需要代码如何计算Src\u IP请求dest\u IP的次数(例如192.168.0.1 Src\u IP尝试与dest\u IP连接10次)。那么如何计算列中的重复IP。或如何计算src到dest IP或任何其他想法计数重复IP在一列请
下面的代码我需要计算的次数src的目标
for ts, buf in pcap:
eth = dpkt.ethernet.Ethernet(buf)
# If the packet is not arp
if eth.type != 2054:
continue
try:
arp = eth.arp
except Exception as e:
continue
packet_time = datetime.datetime.utcfromtimestamp(ts).strftime("%m/%d/%Y,%H:%M:%S")
src = dpkt.socket.inet_ntoa(arp.spa)
tgt = dpkt.socket.inet_ntoa(arp.tpa)
使用csv将所需IP加载到列表中,然后执行以下操作:
相关问题 更多 >
编程相关推荐