I hope somebody will be able to help me... The problem is with merging multiple .pcap files. Recently - like a week ago I've used a mergecap to merge mutiple pcap files into one. Everything worked fine.
Here is how i do it:
mergecap -w 28_30.11.dump.pcap testdump.pcap17 testdump.pcap19 testdump.pcap21 testdump.pcap23 testdump.pcap25
Here is the head
of the output file (Notice the ASCII in the right hand side column):
00000000 D4 C3 B2 A1 02 00 04 00 00 00 00 00 00 00 00 00 FF FF 00 00 01 00 00 00 32 38 B3 50 7F 11 09 00 ........................28.P....
00000020 3C 00 00 00 3C 00 00 00 00 1F D0 03 A4 9C 00 25 9C 8B F5 3E 08 06 00 01 08 00 06 04 00 01 00 25 <...<..........%...>...........%
00000040 9C 8B F5 3E 01 00 00 01 00 00 00 00 00 00 01 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...>............................
00000060 00 00 00 00 32 38 B3 50 89 11 09 00 2A 00 00 00 2A 00 00 00 00 25 9C 8B F5 3E 00 1F D0 03 A4 9C ....28.P....*...*....%...>......
00000080 08 06 00 01 08 00 06 04 00 02 00 1F D0 03 A4 9C 01 00 00 02 00 25 9C 8B F5 3E 01 00 00 01 39 38 .....................%...>....98
000000A0 B3 50 C6 78 05 00 57 00 00 00 57 00 00 00 00 25 9C 8B F5 3E 00 1F D0 03 A4 9C 08 00 45 00 00 49 .P.x..W...W....%...>........E..I
000000C0 8F 7F 40 00 40 11 81 50 01 00 00 02 3E E9 E9 E9 A1 5A 00 35 00 35 44 D5 9A FF 01 00 00 01 00 00 ..@[email protected]....>....Z.5.5D.........
All great. But... now when i do the same for any captured files and use command:
mergecap -w test3.pcap testdump.pcap133 testdump.pcap134 testdump.pcap135
The output file contains additional info on the at the top of the file (clearly visible in ASCII column on the right):
00000000 0A 0D 0D 0A 98 00 00 00 4D 3C 2B 1A 01 00 00 00 FF FF FF FF FF FF FF FF 01 00 65 00 46 69 6C 65 ........M<+...............e.File
00000020 20 63 72 65 61 74 65 64 20 62 79 20 6D 65 72 67 69 6E 67 3A 20 0A 46 69 6C 65 31 3A 20 74 65 73 created by merging: .File1: tes
00000040 74 64 75 6D 70 2E 70 63 61 70 31 33 33 20 0A 46 69 6C 65 32 3A 20 74 65 73 74 64 75 6D 70 2E 70 tdump.pcap133 .File2: testdump.p
00000060 63 61 70 31 33 34 20 0A 46 69 6C 65 33 3A 20 74 65 73 74 64 75 6D 70 2E 70 63 61 70 31 33 35 20 cap134 .File3: testdump.pcap135
00000080 0A 00 00 00 04 00 08 00 6D 65 72 67 65 63 61 70 00 00 00 00 98 00 00 00 01 00 00 00 20 00 00 00 ........mergecap............ ...
Guys, I'm completely clueless - any advise (excluding cutting the first few bytes from the file) will be much appreciated.
The OS: Backtrack 5 R2 (Ubuntu derivative)
uname: Linux z 3.2.6 #1 SMP Fri Feb 17 10:40:05 EST 2012 i686 GNU/Linux
tcpdump version 4.3.0
libpcap version 1.0.0
Additional info:
ls /usr/local/bin/mergecap
-rwxr-xr-x 1 root root 37572 2012-10-31 08:09 /usr/local/bin/mergecap
~ > md5sum /usr/local/bin/mergecap
e7dde01867c1e3f84dc48e5dae266f67 /usr/local/bin/mergecap
Why this a problem for me?
Because i'm no longer able to read the merged file with tcpdump -r
. Tcpdump is returning an error that the dump file is in bad format.
tcpdump
easily using thetcpdump -r mergedfile.pcap
now, with this additional info the tcpdump is returning an error :tcpdump: bad dump file format
tcpdump -h
print? Astcpdump
can't read the pcap-ng file thatmergecap
produced, it probably doesn't reportlibpcap version 1.1.0
, or a later version of libpcap, as 1.1.0 and later can read some pcap-ng files, so atcpdump
using 1.1.0 or later can read them.