简体   繁体   中英

Packet Sniffing Error

I'm running the following script:

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)

while True:
  print s.recvfrom(65565)

However, I get this error:

Traceback (most recent call last):
  File "supersecretfilepath/error.py", line 6, in <module>
    print s.recvfrom(65565)
error: [Errno 10022] An invalid argument was supplied

I'm running Python 2.7 on Windows. Thank you.

s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)

Perhaps your operating system doesn't support raw IPv4 sockets with TCP specified as the protocol.

What is it you're trying to do here?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM