0

i've make a sniff script but i've problem with socket i get like this socket.error

my code like this

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) 

and error

e par ses autorisations dÆaccÞs a ÚtÚ tentÚ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
Jonathan Leffler
  • 666,971
  • 126
  • 813
  • 1,185
  • Possible duplicate of [socket.error: \[Errno 10013\] An attempt was made to access a socket in a way forbidden by its access permissions](http://stackoverflow.com/questions/2778840/socket-error-errno-10013-an-attempt-was-made-to-access-a-socket-in-a-way-forb) – Gabor Lengyel Nov 23 '16 at 22:39
  • i try but it's not work – Mahdi Bahri Nov 23 '16 at 22:43

0 Answers0