January 2019
Beginner to intermediate
776 pages
19h 58m
English
This recipe relies on the pcapObject() class from the pcap library to create an instance of sniffer. In the main() method, an instance of this class is created, and a filter is set using the setfilter() method so that only the HTTP packets are captured. Finally, the dispatch() method starts sniffing and sends the sniffed packet to the print_packet() function for postprocessing.
In the print_packet() function, if a packet has data, the payload is extracted using the ip_stack.parse() method from the construct library. This library is useful for low-level data processing.
Read now
Unlock full access