0
Hello! I’m trying to create a script that monitors the network, I’m trying to learn so if there’s something wrong I’m sorry.
The code I have
import socket
import struct
import binascii
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.htonl(3))
while True:
packet = s.recvfrom(2048)
ethernet_header = packet[0][0:14]
eth_header = struct.unpack('!6s6s2s', ethernet_header)
print('Mac de Destino: ', binascii.hexlify(eth_header[0]), ' Source Mac: ', binascii.hexlify(eth_header[1]), ' Type: ', binascii.hexlify(eth_header[2]))
ipheader = packet[0][14:34]
ip_header = struct.unpack('!12s4s4s', ipheader)
print('Source IP: ', socket.inet_ntoa(ip_header[1]), ' IP de Destino: ', socket.inet_ntoa(ip_header[2]))
The error I’m getting is:
Oserror: [Winerror 10043] The requested protocol was not configured in the system or there is no implementation for it
Ped, good morning! It looks like you’re trying to access something that doesn’t exist for S.What you’re using. Do a search on Npcap and Scapy. Ncap gives Windows the ability to sniffing packages and scapy is used to work with ncap + python. Hug!
– lmonferrari