views:

642

answers:

4

I'm trying to send a packet via Perl, I sniffed the traffic of the packet I want to send and the packet from wireshark is:

0000  00 19 e0 98 17 e8 00 1a  92 41 32 13 08 00 45 00   ........ .A2...E.
0010  00 a7 03 56 40 00 80 06  7f 5d c0 a8 01 64 5e 67   ...V@... .]...d^g
0020  57 2a ea a8 08 be 41 03  2a a1 5e 12 bf 5f 50 18   W*....A. *.^.._P.
0030  01 00 25 2e 00 00 aa 01  ad de 13 f0 54 65 73 74   ..%..... ....Test
0040  00 00 00 00 00 00 00 00  31 32 33 34 00 00 00 00   ........ 1234....
0050  00 00 00 00 65 6e 67 6c  53 bd d4 2b bf 5f a7 6f   ....engl S..+._.o
0060  a1 56 d3 4d 56 8d 53 f3  f3 e8 f0 60 f5 20 f3 62   .V.MV.S. ...`. .b
0070  d1 20 bc 3d d1 21 e8 bd  27 3b 1b 8d 22 6b aa 5b   . .=.!.. ';.."k.[
0080  d2 05 d3 38 48 6e 50 43  ba 2a 09 73 8c 9c 63 4a   ...8HnPC .*.s..cJ
0090  ba d4 14 62 8e b2 34 2f  ae 50 c8 2b 4c 06 06 fd   ...b..4/ .P.+L...
00a0  9e 51 f1 a9 89 dd f2 aa  6c 87 b2 8d 77 63 6c 02   .Q...... l...wcl.
00b0  a6 91 5c 02 00           ..\..

Could anyone give me some pointers on where to go from here? What to research, etc.

+1  A: 

I suggest that you look into the libpcap library.

Btw doing network IO at such a low-level requires root privileges. You should really be doing this at a higher level.

Kalmi
+3  A: 

What are you trying to accomplish, and why? If you need directions, you have to tell us where you want to go.

If you want to communicate directly with one of the network layers from Perl, you just have to send the right data through the right device. Unless you're doing some very low level stuff, you probably don't want to mess around at that level.

If you're trying to construct proper packets, you're probably looking for on of the Net modules, like Net::Packet or Net::Frame.

If you're just need to use a defined protocol, there's probably already a Perl module that will do that for you.

brian d foy
+1  A: 

There isn't enough information to give a proper answer. "Packet" and "Protocol" can mean a lot of things depending on the context

I suggest you familiarize yourself with the OSI Model then re-ask this question

http://en.wikipedia.org/wiki/OSI%5Fmodel

Packets can mean primarily

Transport layer

  • TCP Packets/Stream segments
  • UDP Datagrams

Network layer

  • IP Packets

Physical Layer

  • Ethernet frames

Protocol can mean in the general sense any language that is spoken at the particular level you are interested in.

Mike
A: 

Create a IO::Socket::INET instance and call send($data) on it

Roman
That already makes quite a few decisions for you. If you want to work at that level in the networking stack, one of the sockets modules is probably the way to go. If you want to work at a lower level, it doesn't work.
brian d foy