I already know how to read a pcap file and get the packets it have.B ut how can I write the packets into a new pcap file? I need this to merge two pcap files into one.
相关问题
- Convert a RTP sequence payload in a .wav file
- Code to analyze pcap file
- Passing a string to a C library from OCaml using C
- How can I parse an ethernet packet using libpcap?
- libpcap: pcap_breakloop() causing memory leak
相关文章
- Could anyone suggest a good packet sniffer class f
- compile gopacket on windows 64bit
- C PCAP library unknown types error
- pcap_dispatch - callback processing questions
- TCP: How are the seq / ack numbers generated?
- c# - how to sniff packets in an app without relyin
- Convert all pcap file to csv with required columns
- Can libpcap reassemble TCP segments
As per my comment, libpcap/WinPcap is a library, not a program, so to use libpcap/WinPcap to merge capture files, you'd have to write your own code to do the merging, using libpcap/WinPcap to read the input files and write the output files.
You could use an existing tool, such as tracemerge or Wireshark's mergecap, to merge the captures.
Assuming the goal is to merge two files' packets by time stamp, then, if you wanted to write your own code, you'd:
pcap_t
s (it doesn't matter which one; all thepcap_t
does is tellpcap_dump_open()
what link-layer header type and snapshot length to use);and have a loop where you:
and then, when you exit the loop, close the dump file. At that point, you're done.
This can be done using
joincap
.To merge
1.pcap
and2.pcap
:I wrote
joincap
to overcome what I believe is bad error handling bymergecap
andtcpslice
.For more details go to https://github.com/assafmo/joincap.