Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know of a program that can "carve" (look for) TCP IP Packets from raw binary data. The results it presents are the source and destination MAC addresses, the source and destination IP addresses and a few other bits and pieces (port numbers etc).

I'm curious to know what bits of data act as a signature\flag to identify such data amidst a mass of other binary data? The example below is one of my own IP packets from a test. First 6 bytes = Destination MAC address. Next 6 bytes, Source MAC address. 0800 is some kind of marker that I now forget. 45 AB F7 25 is one IP address, C0 A8 6F A0 one of my internal IP addresses etc.

But there's nothing before it or after it to say "Hey - this is TCP IP data". And there are hundreds of other similar examples. So how has the software found it and the others when the starting data is simply a MAC address - not something that you can easily code a program to look for (which is what I want to do myself)?

Any thoughts?

Offset       0  1  2  3  4  5  6  7   8  9 10 11 12 13 14 15

000000000   00 0C 29 31 24 41 00 50  56 ED A5 46 08 00 45 00     )1$A PVí¥F  E 
000000016   00 28 C0 A8 00 00 80 06  0D 0E 45 AB F7 25 C0 A8    (À¨  €   E«÷%À¨
000000032   6F A0 01 BB 06 AF 7C 3E  0B 51 35 87 6B 87 50 10   o  » ¯|> Q5‡k‡P 
000000048   FA F0 16 C2 00 00 00 00  00 00 00 00 00 00 00 00   úð Â            
000000064   FD 0C AC 83 FB 0A B0 41  B3 B3 F8 71 88 1F 4C 8C   ý ¬ƒû °A³³øqˆ LŒ
share|improve this question
    
are you looking for initialization vectors? –  user213584 Apr 3 '13 at 22:21
    
If by initialization vectors, you mean the cryptographic kind, then no. I'm basically looking for a magic marker\signature for these data packets. –  Gizmo_the_Great Apr 3 '13 at 22:24
    
Are you asking how the program "knows" the MAC address to look for? The NIC presents its MAC address to the system; the program likely reads this and then displays related packets. –  Rain Apr 3 '13 at 22:44

1 Answer 1

My suggestion, download and capture some data with Wireshark. Make sure you have the packet list, packet details and packet bytes view options enabled and start click on packets. in the packet detail section, you can click on the L2, L3, and L4 sections of the packet and it will highlight the bytes that correlate to whatever you have selected.

Then start by doing some searching online to learn about ethernet headers/encapsulation, IP headers, TCP headers and the like. Wikipedia is often a good jumping off point for topics like this but there are hundreds of resources online. I did a quick search looking for an image that represents how the ethernet frame is ultimately built and found this one that is pretty good: http://www.tcpipguide.com/free/t_IPDatagramEncapsulation.htm

Haven't read the content, but between resources like that and starting to play with the parts of the frame in a tool like Wireshark, you will find there is a definite structure to the binary data and it becomes fairly easy to tell apart.

share|improve this answer
    
From the bit of "raw binary data" it does seem like it was captured with Wireshark. –  Darius Apr 3 '13 at 22:55
    
Clearly, and I didn't say to use his existing data with Wireshark, however if the OP wants to learn how to read the raw data, they need to start somewhere. Wireshark is a great tool to start learning this and to see how the parts are put together. –  YLearn Apr 3 '13 at 23:23
    
Agreed... Wireshark is very good tool. I wish I knew it better :) –  Darius Apr 3 '13 at 23:25
    
Thanks. I have already read the various papers on TCP\IP packet strcuture and I am familiar with the hex breakdown, as stated above. What I need to know is how these packets can be "spotted" amidst raw captured data when you don't know in advance the MAC addresses, the IP addresses etc. It is obviously possible as it is done by the software used to present that hex shot above. I want to work out how they do it. –  Gizmo_the_Great Apr 4 '13 at 15:04
    
To answer what you are asking, you need to get down to the mechanics of L1 signalling and this is different for each L1 medium. Once you get to L2, a frame is a frame. For example, it doesn't matter to L2 Ethernet if the L1 medium was fiber or copper or RF, as long as when it puts sends a frame down to L1 that the L1 on the other side delivers a frame to L2. Network traffic is not just random binary data, it is very structured binary data. –  YLearn Apr 4 '13 at 16:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.