Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use raw sockets in Perl?

How can you get a raw socket in Perl, and then what's the best way to built a packet for use with it?

like image 975
raldi Avatar asked Nov 27 '22 19:11

raldi


1 Answers

The same way you do in C... by setting the socket type when creating the socket.

In the example on CPAN use SOCK_RAW rather than SOCK_DGRAM (UDP) or SOCK_STREAM (TCP).

NOTE: creating raw sockets typically requires administrative privileges (i.e. root on UNIX). Windows OS's may have disabled ability to create raw sockets, you'll just have to test it and see.

like image 62
paxos1977 Avatar answered Dec 06 '22 04:12

paxos1977