I need to read a PCAP file, modify some fields (actually IPv4 source and destination and Ethernet source and destination). The PCAP is pre-filtered to only include IPv4 over Eth
I don't know if there is a way to do that with scapy, but you could also use the very simple PcapFile.py library that lets you read/write pcap files packet by packet (disclaimer: I'm one of the authors). If your needs aren't too complicated (e.g. you don't need to re-generate checksums) you could simply modify the frame's bytestring using Python slicing and Python's struct module.
But I think it should also be possible to get scapy to analyze the frame using p = Ether(packet_bytes)
and convert back to a bytestream for PcapFile.py using str(p)
. This way you can let scapy re-calculate a valid checksum for you.