Skip to content

Instantly share code, notes, and snippets.

@taco-shellcode
Created December 15, 2020 02:21
Show Gist options
  • Save taco-shellcode/a4a5136ff4d60d69aaf46be574600c8e to your computer and use it in GitHub Desktop.
Save taco-shellcode/a4a5136ff4d60d69aaf46be574600c8e to your computer and use it in GitHub Desktop.
from socket import *
from struct import unpack
import sys
INTERFACE = "eth0"
TARGET = "8.8.8.8"
if __name__ == "__main__":
sock = socket(AF_PACKET, SOCK_DGRAM, 0x0800)
sock.bind((INTERFACE, 0x0800))
while True:
data = sock.recvfrom(1500, 0)[0]
ip = inet_ntop(AF_INET, data[12:16])
if ip == TARGET:
print "GOT TARGET"
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment