python error socket.error:[Errno 10013] UnetentativedÆaccÞsÓunsocketdemaniÞreinterdte par sesautorisationsdÆaccÞsaÚttocitÚe

时间:2016-11-23 22:34:15

标签: python python-2.7 sockets packet-sniffers

我制作了一个嗅探脚本,但我遇到套接字的问题我得到这样socket.error

我的代码就像这样

import socket
import os
# host to listen on
host = "192.168.1.1"
# create a raw socket and bind it to the public interface
if os.name == "nt":
    socket_protocol = socket.IPPROTO_IP
else:
    socket_protocol = socket.IPPROTO_ICMP
sniffer = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket_protocol)

sniffer.bind((host, 0))
# we want the IP headers included in the capture
sniffer.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
# if we're using Windows, we need to send an IOCTL
# to set up promiscuous mode
if os.name == "nt":
    sniffer.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
# read in a single packet
print sniffer.recvfrom(65565)
# if we're using Windows, turn off promiscuous mode
if os.name == "nt":
    sniffer.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF) 

和错误

e par sesautorisationsdÆaccÞsaÚttotetÚe

c:\Users\noredine\Desktop\project0112deep>sniff.py
raceback (most recent call last):
 File "C:\Users\noredine\Desktop\backdoor\sniff.py", line 10, in <module>
   sniffer = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket_protocol)
 File "C:\Python27\lib\socket.py", line 191, in __init__
   _sock = _realsocket(family, type, proto)
ocket.error: [Errno 10013] Une tentative dÆaccÞs Ó un socket de maniÞre interdi
e par ses autorisations dÆaccÞs a ÚtÚ tentÚe

0 个答案:

没有答案