June 2018
Intermediate to advanced
398 pages
9h
English
Finally, we can write our sniffed packets to a standard pcap file and open it with Wireshark as usual. This happens via a simple wrpcap() function that writes the list of packets to a pcap file. The wrpcap() function accepts two arguments—the first one is the full path to a file location, and the second is the packet list captured before using the sniff() function:
from scapy.all import *print("Begin capturing all packets from all interfaces. send ctrl+c to terminate and print summary")pkts = sniff(iface="eth0", filter="icmp")wrpcap("/root/icmp_packets_eth0.pcap",pkts)
Read now
Unlock full access