# Using scapy
$ scapy
Welcome to Scapy (2.2.0)
>>> pkts= rdpcap("ch6.pcap")
>>> payload_echo_request=[ p[ICMP].load for p in pkts if(p[ICMP].type ==8 and p[ICMP].code == 0)]
>>> outfile= open('ICMP_payload.dump', 'wt')
>>> outfile.write("".join(payload_echo_request))
>>> outfile.close()
# Using Python#!/usr/bin/pythonfromscapy.allimport*importyencpkts=rdpcap("./echo_request.pcap")fichier=open("./donnees","w")foriinrange(0,len(pkts)):fichier.write(pkts[i].load)printyenc.decode("./donnees","./résultat")