Skip to content

Instantly share code, notes, and snippets.

@Adarshreddyash
Last active September 7, 2019 02:47
Show Gist options
  • Save Adarshreddyash/3b25f6768d7712ab51cc839f7584c247 to your computer and use it in GitHub Desktop.
Save Adarshreddyash/3b25f6768d7712ab51cc839f7584c247 to your computer and use it in GitHub Desktop.
import socket
HOST = socket.gethostbyname(socket.gethostname())
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
s.bind((HOST, 0))
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
print(s.recvfrom(65565))
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment