

Now this feature of winsock is available on all 2000/XP and higher windows. recvfrom gets the packet in the string buffer.

Put the socket in an infinite loop of recvfrom.ĥ. Call WSAIoctl() on the socket with SIO_RCVALL option to give it sniffing powers.Ĥ. Bind the socket to the local IP over which the traffic is to be sniffed.ģ. Hence to make a sniffer in Winsock he simple steps are. Since windows 2000, the winsock api got some features that allowed it to sniff packets moving in and out the network interface.Įver since windows 2000/XP when IP_HDRINCL became a valid option for setsockopt(), WSAIoctl() had another option called SIO_RCVALL which enabled a raw socket to sniff all incoming traffic over the selected interface to whose IP the socket was bound. In this post we are going to write a very simple packet sniffer using sockets with the winsock api on windows. A sniffer is able to pickup these individual packets and read them.
