Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: how to Decode Hexdata got from Pcap

by gman (Friar)
on May 05, 2010 at 01:46 UTC ( [id://838426]=note: print w/replies, xml ) Need Help??


in reply to how to Decode Hexdata got from Pcap

hello, can you show your output from a tcp packet?

this is what I get after adding NetPacket::UDP which was missing from your code posted, but assuming it was there in you actual code, as I get error without it.

BTW, Thanks for this post, I learned a lot from it


packet: len=170, caplen=170, tv_sec=1273023698, tv_usec=716581 IP:TCP 32.96.130.64:22 -> 10.10.0.51:8761 (ack,psh) 0x0000 : CD B1 79 B3 46 37 28 19 71 6C 2C FB 61 FB CE B7 : ..y.F7(.q +l,.a... 0x0010 : 44 70 10 69 32 F7 C0 FF 7F 25 FA 75 53 44 F6 FC : Dp.i2.... +%.uSD.. 0x0020 : 13 FF F2 E1 A9 20 72 20 8A EB 25 A7 76 89 67 A3 : ......r.. +.%.v.g. 0x0030 : 28 65 F0 EA EF 02 A0 E3 BE F6 91 B1 AF 27 15 A2 : (e....... +....'.. 0x0040 : ED 64 57 6B E6 16 34 F9 22 CA AA C4 73 89 F5 1F : .dWk..4." +...s... 0x0050 : 0F 8C 9C DD 5B 90 7B C7 29 0C 32 4C 3C 16 5B 90 : ....[.{.) +.2L<.[. 0x0060 : 7F 76 8B 6E 18 74 7C 48 E6 93 DE 58 C2 DC 5F 76 : .v.n.t|H. +..X.._v 0x0070 : ED BD CC 3D : ...=
packet: len=231, caplen=231, tv_sec=1273023856, tv_usec=195874 IP:TCP 10.10.0.180:631 -> 10.10.0.255:631 () 0x0000 : 62 30 31 65 20 33 20 69 70 70 3A 2F 2F 31 30 2E : b01e.3.ip +p://10. 0x0010 : 31 30 2E 30 2E 31 38 30 3A 36 33 31 2F 70 72 69 : 10.0.180: +631/pri 0x0020 : 6E 74 65 72 73 2F 4F 66 66 69 63 65 4A 65 74 2D : nters/Off +iceJet- 0x0030 : 50 72 6F 2D 4B 38 35 30 20 22 22 20 22 4F 66 66 : Pro-K850. +""."Off 0x0040 : 69 63 65 4A 65 74 2D 50 72 6F 2D 4B 38 35 30 22 : iceJet-Pr +o-K850" 0x0050 : 20 22 48 50 20 4F 66 66 69 63 65 4A 65 74 20 50 : ."HP.Offi +ceJet.P 0x0060 : 72 6F 20 4B 38 35 30 20 46 6F 6F 6D 61 74 69 63 : ro.K850.F +oomatic 0x0070 : 2F 68 70 69 6A 73 20 28 72 65 63 6F 6D 6D 65 6E : /hpijs.(r +ecommen 0x0080 : 64 65 64 29 20 2D 20 48 50 4C 49 50 20 31 2E 36 : ded).-.HP +LIP.1.6 0x0090 : 2E 31 30 22 20 6A 6F 62 2D 73 68 65 65 74 73 3D : .10".job- +sheets= 0x00A0 : 6E 6F 6E 65 2C 6E 6F 6E 65 20 6C 65 61 73 65 2D : none,none +.lease- 0x00B0 : 64 75 72 61 74 69 6F 6E 3D 33 30 30 0A : duration= +300.

Replies are listed 'Best First'.
Re^2: how to Decode Hexdata got from Pcap
by Kanishka.black0 (Scribe) on May 05, 2010 at 07:15 UTC
    0x0000 : 36 31 39 31 32 22 20 74 69 74 6C 65 3D 22 47 72 : 61912".titl +e="Gr 0x0010 : 61 6E 64 46 61 74 68 65 72 27 73 20 68 6F 6D 65 : andFather +'s.home 0x0020 : 20 6E 6F 64 65 2E 20 4D 65 6D 62 65 72 20 6F 66 : .node..Me +mber.of 0x0030 : 3A 20 6A 61 6E 69 74 6F 72 73 2C 20 70 6D 64 65 : :.janitor +s,.pmde 0x0040 : 76 2E 22 3E 47 72 61 6E 64 46 61 74 68 65 72 3C : v.">Grand +Father< 0x0050 : 2F 61 3E 3C 62 72 20 2F 3E 3C 2F 73 70 61 6E 3E : /a><br./> +</span> 0x0060 : 3C 2F 73 70 61 6E 3E 3C 2F 73 70 61 6E 3E 3C 2F : </span></ +span></ 0x0070 : 73 70 61 6E 3E 0A 3C 73 70 61 6E 20 63 6C 61 73 : span>.<sp +an.clas 0x0080 : 73 3D 27 6F 64 64 2D 72 6F 77 27 3E 3C 73 70 61 : s='odd-ro +w'><spa 0x0090 : 6E 20 63 6C 61 73 73 3D 27 69 74 65 6D 2D 30 30 : n.class=' +item-00 0x00A0 : 31 27 3E 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 : 1'><span. +class=' 0x00B0 : 75 73 65 72 2D 6C 65 76 65 6C 2D 31 39 27 3E 3C : user-leve +l-19'>< 0x00C0 : 73 70 61 6E 20 63 6C 61 73 73 3D 27 75 73 65 72 : span.clas +s='user 0x00D0 : 2D 33 32 34 37 36 33 27 3E 3C 61 20 68 72 65 66 : -324763'> +<a.href 0x00E0 : 3D 22 3F 6E 6F 64 65 5F 69 64 3D 33 32 34 37 36 : ="?node_i +d=32476 0x00F0 : 33 22 20 74 69 74 6C 65 3D 22 6D 61 72 74 6F 27 : 3".title= +"marto' 0x0100 : 73 20 68 6F 6D 65 20 6E 6F 64 65 22 3E 6D 61 72 : s.home.no +de">mar 0x0110 : 74 6F 3C 2F 61 3E 3C 62 72 20 2F 3E 3C 2F 73 70 : to</a><br +./></sp 0x0120 : 61 6E 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 70 61 6E : an></span +></span 0x0130 : 3E 3C 2F 73 70 61 6E 3E 0A 3C 73 70 61 6E 20 63 : ></span>. +<span.c 0x0140 : 6C 61 73 73 3D 27 65 76 65 6E 2D 72 6F 77 27 3E : lass='eve +n-row'> 0x0150 : 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 69 74 65 : <span.cla +ss='ite 0x0160 : 6D 2D 30 30 32 27 3E 3C 73 70 61 6E 20 63 6C 61 : m-002'><s +pan.cla 0x0170 : 73 73 3D 27 75 73 65 72 2D 6C 65 76 65 6C 2D 31 : ss='user- +level-1 0x0180 : 39 27 3E 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 : 9'><span. +class=' 0x0190 : 75 73 65 72 2D 33 36 38 31 38 39 27 3E 3C 61 20 : user-3681 +89'><a. 0x01A0 : 68 72 65 66 3D 22 3F 6E 6F 64 65 5F 69 64 3D 33 : href="?no +de_id=3 0x01B0 : 36 38 31 38 39 22 20 74 69 74 6C 65 3D 22 77 66 : 68189".ti +tle="wf 0x01C0 : 73 70 27 73 20 68 6F 6D 65 20 6E 6F 64 65 22 3E : sp's.home +.node"> 0x01D0 : 77 66 73 70 3C 2F 61 3E 3C 62 72 20 2F 3E 3C 2F : wfsp</a>< +br./></ 0x01E0 : 73 70 61 6E 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 70 : span></sp +an></sp 0x01F0 : 61 6E 3E 3C 2F 73 70 61 6E 3E 0A 3C 73 70 61 6E : an></span +>.<span 0x0200 : 20 63 6C 61 73 73 3D 27 6F 64 64 2D 72 6F 77 27 : .class='o +dd-row' 0x0210 : 3E 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 69 74 : ><span.cl +ass='it 0x0220 : 65 6D 2D 30 30 33 27 3E 3C 73 70 61 6E 20 63 6C : em-003'>< +span.cl 0x0230 : 61 73 73 3D 27 75 73 65 72 2D 6C 65 76 65 6C 2D : ass='user +-level- 0x0240 : 31 37 27 3E 3C 73 70 61 6E 20 63 6C 61 73 73 3D : 17'><span +.class= 0x0250 : 27 75 73 65 72 2D 37 30 39 32 39 27 3E 3C 61 20 : 'user-709 +29'><a. 0x0260 : 68 72 65 66 3D 22 3F 6E 6F 64 65 5F 69 64 3D 37 : href="?no +de_id=7 0x0270 : 30 39 32 39 22 20 74 69 74 6C 65 3D 22 61 74 63 : 0929".tit +le="atc 0x0280 : 72 6F 66 74 27 73 20 68 6F 6D 65 20 6E 6F 64 65 : roft's.ho +me.node 0x0290 : 22 3E 61 74 63 72 6F 66 74 3C 2F 61 3E 3C 62 72 : ">atcroft +</a><br 0x02A0 : 20 2F 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 70 61 6E : ./></span +></span 0x02B0 : 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 70 61 6E 3E 0A : ></span>< +/span>. 0x02C0 : 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 65 76 65 : <span.cla +ss='eve 0x02D0 : 6E 2D 72 6F 77 27 3E 3C 73 70 61 6E 20 63 6C 61 : n-row'><s +pan.cla 0x02E0 : 73 73 3D 27 69 74 65 6D 2D 30 30 34 27 3E 3C 73 : ss='item- +004'><s 0x02F0 : 70 61 6E 20 63 6C 61 73 73 3D 27 75 73 65 72 2D : pan.class +='user- 0x0300 : 6C 65 76 65 6C 2D 31 35 27 3E 3C 73 70 61 6E 20 : level-15' +><span. 0x0310 : 63 6C 61 73 73 3D 27 75 73 65 72 2D 37 33 34 34 : class='us +er-7344 0x0320 : 31 27 3E 3C 61 20 68 72 65 66 3D 22 3F 6E 6F 64 : 1'><a.hre +f="?nod 0x0330 : 65 5F 69 64 3D 37 33 34 34 31 22 20 74 69 74 6C : e_id=7344 +1".titl 0x0340 : 65 3D 22 68 65 72 76 65 75 73 27 73 20 68 6F 6D : e="herveu +s's.hom 0x0350 : 65 20 6E 6F 64 65 22 3E 68 65 72 76 65 75 73 3C : e.node">h +erveus< 0x0360 : 2F 61 3E 3C 62 72 20 2F 3E 3C 2F 73 70 61 6E 3E : /a><br./> +</span> 0x0370 : 3C 2F 73 70 61 6E 3E 3C 2F 73 70 61 6E 3E 3C 2F : </span></ +span></ 0x0380 : 73 70 61 6E 3E 0A 3C 73 70 61 6E 20 63 6C 61 73 : span>.<sp +an.clas 0x0390 : 73 3D 27 6F 64 64 2D 72 6F 77 27 3E 3C 73 70 61 : s='odd-ro +w'><spa 0x03A0 : 6E 20 63 6C 61 73 73 3D 27 69 74 65 6D 2D 30 30 : n.class=' +item-00 0x03B0 : 35 27 3E 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 : 5'><span. +class=' 0x03C0 : 75 73 65 72 2D 6C 65 76 65 6C 2D 31 34 27 3E 3C : user-leve +l-14'>< 0x03D0 : 73 70 61 6E 20 63 6C 61 73 73 3D 27 75 73 65 72 : span.clas +s='user 0x03E0 : 2D 36 39 34 39 31 34 27 3E 3C 61 20 68 72 65 66 : -694914'> +<a.href 0x03F0 : 3D 22 3F 6E 6F 64 65 5F 69 64 3D 36 39 34 39 31 : ="?node_i +d=69491 0x0400 : 34 22 20 74 69 74 6C 65 3D 22 64 48 61 72 72 79 : 4".title= +"dHarry 0x0410 : 27 73 20 68 6F 6D 65 20 6E 6F 64 65 22 3E 64 48 : 's.home.n +ode">dH 0x0420 : 61 72 72 79 3C 2F 61 3E 3C 62 72 20 2F 3E 3C 2F : arry</a>< +br./></ 0x0430 : 73 70 61 6E 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 70 : span></sp +an></sp 0x0440 : 61 6E 3E 3C 2F 73 70 61 6E 3E 0A 3C 73 70 61 6E : an></span +>.<span 0x0450 : 20 63 6C 61 73 73 3D 27 65 76 65 6E 2D 72 6F 77 : .class='e +ven-row 0x0460 : 27 3E 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 69 : '><span.c +lass='i 0x0470 : 74 65 6D 2D 30 30 36 27 3E 3C 73 70 61 6E 20 63 : tem-006'> +<span.c 0x0480 : 6C 61 73 73 3D 27 75 73 65 72 2D 6C 65 76 65 6C : lass='use +r-level 0x0490 : 2D 31 34 27 3E 3C 73 70 61 6E 20 63 6C 61 73 73 : -14'><spa +n.class 0x04A0 : 3D 27 75 73 65 72 2D 34 39 35 36 31 37 27 3E 3C : ='user-49 +5617'>< 0x04B0 : 61 20 68 72 65 66 3D 22 3F 6E 6F 64 65 5F 69 64 : a.href="? +node_id 0x04C0 : 3D 34 39 35 36 31 37 22 20 74 69 74 6C 65 3D 22 : =495617". +title=" 0x04D0 : 50 75 6E 69 74 68 61 27 73 20 68 6F 6D 65 20 6E : Punitha's +.home.n 0x04E0 : 6F 64 65 22 3E 50 75 6E 69 74 68 61 3C 2F 61 3E : ode">Puni +tha</a> 0x04F0 : 3C 62 72 20 2F 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 : <br./></s +pan></s 0x0500 : 70 61 6E 3E 3C 2F 73 70 61 6E 3E 3C 2F 73 70 61 : pan></spa +n></spa 0x0510 : 6E 3E 0A 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 : n>.<span. +class=' 0x0520 : 6F 64 64 2D 72 6F 77 27 3E 3C 73 70 61 6E 20 63 : odd-row'> +<span.c 0x0530 : 6C 61 73 73 3D 27 69 74 65 6D 2D 30 30 37 27 3E : lass='ite +m-007'> 0x0540 : 3C 73 70 61 6E 20 63 6C 61 73 73 3D 27 75 73 65 : <span.cla +ss='use 0x0550 : 72 2D 6C 65 76 65 6C 2D 31 34 27 3E 3C 73 70 61 : r-level-1 +4'><spa 0x0560 : 6E 20 63 6C 61 73 73 3D 27 75 73 65 72 2D 32 37 : n.class=' +user-27 0x0570 : 32 36 38 32 27 3E 3C 61 20 68 72 65 66 3D 22 3F : 2682'><a. +href="? 0x0580 : 6E 6F 64 65 5F 69 64 3D : node_id= IP:TCP 209.197.123.153:80 -> 10.0.0.2:51950 (ack) data61912" title="GrandFather's home node. Member of: janitors, pmdev. +">GrandFather</a><br /></span></span></span></span> <span class='odd-row'><span class='item-001'><span class='user-level-1 +9'><span class='user-324763'><a href="?node_id=324763" title="marto's + home node">marto</a><br /></span></span></span></span> <span class='even-row'><span class='item-002'><span class='user-level- +19'><span class='user-368189'><a href="?node_id=368189" title="wfsp's + home node">wfsp</a><br /></span></span></span></span> <span class='odd-row'><span class='item-003'><span class='user-level-1 +7'><span class='user-70929'><a href="?node_id=70929" title="atcroft's + home node">atcroft</a><br /></span></span></span></span> <span class='even-row'><span class='item-004'><span class='user-level- +15'><span class='user-73441'><a href="?node_id=73441" title="herveus' +s home node">herveus</a><br /></span></span></span></span> <span class='odd-row'><span class='item-005'><span class='user-level-1 +4'><span class='user-694914'><a href="?node_id=694914" title="dHarry' +s home node">dHarry</a><br /></span></span></span></span> <span class='even-row'><span class='item-006'><span class='user-level- +14'><span class='user-495617'><a href="?node_id=495617" title="Punith +a's home node">Punitha</a><br /></span></span></span></span> <span class='odd-row'><span class='item-007'><span class='user-level-1 +4'><span class='user-272682'><a href="?node_id=
    This is my TCP OUtput ... First one was the Hex output .... but below one was the normal out out with out Hexcode ... TCP is woorks good ... UDP is making probelm here is the UDP output in normal form and Hex output ... Hexput was bit complex .....
    IP:UDP 10.0.0.2:34214 -> 8.8.8.8:53 () 0x0000 : D0 E6 01 00 00 01 00 00 00 00 00 00 06 67 6F 6F : ......... +....goo 0x0010 : 67 6C 65 02 63 6F 02 69 6E 00 00 01 00 01 : gle.co.in +..... data&#65533;&#65533;googlecoin IP:UDP 8.8.8.8:53 -> 10.0.0.2:34214 () 0x0000 : D0 E6 81 80 00 01 00 01 00 00 00 00 06 67 6F 6F : ......... +....goo 0x0010 : 67 6C 65 02 63 6F 02 69 6E 00 00 01 00 01 C0 0C : gle.co.in +....... 0x0020 : 00 01 00 01 00 00 01 2C 00 04 D1 55 E7 68 : .......,. +..U.h data&#65533;&#24640;googlecoin&#65533; ,&#65533;U&#65533;h
    this is a DNS query ...

      Wouldn't that stem from the type of data in the packet?

      What I mean is, your TCP output is clearly HTML plain ascii, your UDP contains control characters, for every non-printable char the hexdump prints a '.'. When you try to print the raw data your terminal is going to interpret this.


      Maybe running it through something like unix strings, or sanitizing it in perl before you print it?

        For DNS i got the NET::DNS module .. and i tried to use Net::Packet for others .....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://838426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found