#! The/usr/bin/env python
# - * - coding: utf-8 - * -
The import socket
Host=socket. Gethostbyname (sockets gethostname ())
S=socket. The socket (socket. AF_INET, socket. SOCK_RAW socket. IPPROTO_IP)
S.b ind ((host, 0))
S.s etsockopt (socket. IPPROTO_IP, socket IP_HDRINCL, 1)
S.i octl (socket. SIO_RCVALL, socket RCVALL_ON)
While True:
Data=https://bbs.csdn.net/topics/s.recvfrom (65565) [0]
Code is written according to others, so understanding is not too deep, so may code has a problem
CodePudding user response:
Your network adapter is set to promiscuous mode? To baidu, the Python implementation of sniffer, I didn't touch this for a long time, their written in Python sniffer is essential tool for many hackers, so can catch of Ethernet frameCodePudding user response:
Ok, thank you, I go to check, thanksCodePudding user response: