come da titolo
PS: sarete tutti in vacanza...spero che ci sia qualcuno che soddisfi la mia curiosità!
come da titolo
PS: sarete tutti in vacanza...spero che ci sia qualcuno che soddisfi la mia curiosità!
2) RAW socket questions:
*
2.1) What is a RAW socket?
The BSD socket API allows one to open a raw socket and bypass layers in the TCP/IP stack. Be warned that if an OS doesn't support correct BSD semantics (correct is used loosely here), you're going to have a hard time making it work. Below, an attempt is made to address some of the bugs or surprises you're in store for. On almost all sane systems only root (superuser) can open a raw socket.
*
2.2) How do I use a raw socket?
o
2.2.1) How do I send a TCP/IP packet through a raw socket?
Depending on what you want to send, you initially open a socket and give it its type.
sockd = socket(AF_INET,SOCK_RAW,<protocol>);
You can choose from any protocol including IPPROTO_RAW. The protocol number goes into the IP header verbatim. IPPROTO_RAW places 0 in the IP header.
Most systems have a socket option IP_HDRINCL which allows you to include your own IP header along with the rest of the packet. If your system doesn't have this option, you may or may not be able to include your own IP header. If it is available, you should use it as such:
char on = 1;
setsockopt(sockd,IPPROTO_IP,IP_HDRINCL,&on,sizeof( on));
Of course, if you don't want to include an IP header, you can always specify a protocol in the creation of the socket and slip your transport level header under it.
You then build the packet and use a normal sendto().
@_=(115,-17,6);print+map{chr$_[$.=$_-$_]*$_**$.+++$_[$.]*$_**$.+++$_[$.]*$_**$.}$.-$...$#_