Intercepting Network Packets
Posted on 2001-07-12
I need to write a programme that 'filters' all data that goes through ports of a machine.
In Linux, I could achieve it by doing
int sock = socket(PF_PACKET, SOCK_RAW, htons(0x0003));
that way, I will be able to read any data that comes in from any port by just doing a
byte_recv = recv(sock, buf, 10000, 0);
However, doing it in Windows, I get an error "Protocol not supported"
Are there any other ways to do it? Surely there will be, otherwise firewalls programmes cannot be written, no?