September 2018
Intermediate to advanced
426 pages
10h 46m
English
With the rdpcap() function, we can read a pcap file and get a list of packages that can be handled directly from Python:
scapy> file=rdpcap('<path_file.pcap>')
We also have the possibility of similar packet capture from the reading of a pcap file:
scapy> pkts = sniff(offline="file.pcap")
Scapy supports the BPF (Beerkeley Packet Filters) format, it is a standard format for applying filters over network packets. These filters can be applied on a set of specific packages or directly on an active capture:
>>> sniff (filter = "ip and host 195.221.189.155", count = 2)<Sniffed TCP: 2 UDP: 0 ICMP: 0 Other: 0>
We can format the output of sniff() in such a way that it adapts just to the data we want to see and ...
Read now
Unlock full access