Home > other >  Python socket caught
Python socket caught

Time:11-26

Python socket caught hold the etheric, and seemingly TCP packet also can't catch,

 
#! 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 frame

CodePudding user response:

Ok, thank you, I go to check, thanks

CodePudding user response:

reference 1st floor Johan_Joe_King response:
your nic set to mixed 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 the Ethernet frame is can catch ha

S.i octl (socket. SIO_RCVALL, socket RCVALL_ON) open this line is mixed, seems to be no
  • Related