Sockets: IPPROTO_IP not supported

Joseph L. Casale jcasale at activenetwerx.com
Mon Jan 16 05:17:06 EST 2017


> Trying to sniff Ethernet packets, I do this:
>
>    s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
>
> but it results in this:
>
>     $ sudo python3 sniff_survey.py 
>     Traceback (most recent call last):
>       File "sniff_survey.py", line 118, in <module>
>         s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
>       File "/usr/lib/python3.2/socket.py", line 94, in __init__
>         _socket.socket.__init__(self, family, type, proto, fileno)
>     socket.error: [Errno 93] Protocol not supported
>
> Anybody know what I'm doing wrong?  (Python 3.2.3 under Debian 3.2.84-1.)

Have a look at the bottom of this SO question:
http://stackoverflow.com/questions/5385312/ipproto-ip-vs-ipproto-tcp-ipproto-udp




More information about the Python-list mailing list