python - Error while capturing packets from raw socket -
I am trying to run the following line of program:
import socket import structure Import Binascii sock = socket.socket (socket.PF_PACKET, socket.SOCK_RAW, socket.htons (0x800)) print sock
I get the following error: Message file name line status - Traceback
C: \ user \ d \ document \ rawsocket.py 1
Attribute: 'module' object has no attribute 'PF_PACKET'
I use Pyscripter, Python 2.7 on Windows 8.1 A Am
Thank you!
You should use AF_INET
for windows Opening a raw socket :
sock = socket.socket (socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
Comments
Post a Comment