Created
January 17, 2015 18:49
-
-
Save anch0vy/ebeaf88599c8042ab969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import os | |
| s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP) | |
| if os.name=='nt': | |
| HOST = socket.gethostbyname(socket.gethostname()) | |
| s.bind((HOST, 0)) | |
| s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) | |
| s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON) | |
| while True: | |
| RawPacketData,(ip,port)=s.recvfrom(65565) | |
| print ip,port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment