Sniffing Package Using Raw Sockets on Linux in C

I need to write a Linux packet sniffer that detects an HTTPS packet that is sent and saves the URL from the request. I found the code for this in security-freak and ran it. This code works and only sniffs the received packet, but I need to get the sent packet to the sniffer. How to receive the sent packet in this code?

I cannot use any library like libcap (forbidden). Code: sniffer.c

+3
source share
3 answers

You should use ETH_P_ALL instead of ETH_P_IP as a protocol. ETH_P_IP only listens for incoming IP packets.

+7
source

Why can't you use any library? Homework?

It is difficult to answer without having examples from your code, for example, how you installed sll_pkttype.

The urlsnarf tool in the dnsiff Suite may be worth a look.

+3
source

libpcap DNET ( - 5) ( ). .

.

0

All Articles