Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import os
- # host to listen on
- host = "192.168.43.162"
- # create a raw socket and bind it to the public interface
- socket_protocol = socket.IPPROTO_ICMP
- sniffer = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket_protocol)
- sniffer.bind((host, 0))
- # we want the IP headers included in the capture
- sniffer.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
- # read in a single packet
- print(sniffer.recvfrom(65565))
Add Comment
Please, Sign In to add comment