Thus far, I have been unable to successfully write packets parsed from dpkt.pcapng to a new pcapng file. The timestamps are corrrectly rewritten as expected, but the packet payload is being overwritten to a generic(?) value which i cannot trace back to
(i cannot post pictures, but i will try and upload one to a shared site and link it here)
I've tried to follow the unit test file writing sequence but haven been unable to determine if the error arises when reading the packets or when writing them.
in_file = open(file, 'rb')
out_file = open(other_file, 'rb')
pcap_file = dpkt.pcapng.Reader(in_file)
output_file = dpkt.pcapng.Writer(out_file)
# I already have information about the capture, i just need to write the raw bytes to a new file
for i in range(len(capture_)):
current_packet = pcap_file.next()
epb = dpkt.pcapng.EnhancedPacketBlockLE(pkt_data=(current_packet[1]))
output_file.writepkt(epb, ts=timestamp)
any help would be appreciated!