python - Scapy - how to get the statistics? -
i need write network sniffer , have decided use python it. know performances not best, , kind of software should use c or c++, prototype me. have been working libpcap library python 2.7 , info needed such as: ip source , destination, relative ports, timestamp , packet length. problem noticed high traffic there huge packet dropping.
it must said these info inserted mysql database during whole process.
so before go further scapy i understand if there way measure how many packets loose during elaboration.
thank you
i have fixed in indirect way. using
tcpdump -g 3600 -i interface -n -w %h-capture.pcap
from here collect statistics discarded packets , filtered , on. please mind minimize percentage of discarded packet option -n
vital since says not resolve each host in packets captured -g
instead tells cycle on 3600 seconds creating i.e. file each hour.
after go scapy cli , in scapy following:
x = rdpcap("myfile") len_x = len(x) in x: if tcp in i: i.show()
this show tcp packets. if want can filter udp or icmp , on in same way.
Comments
Post a Comment