Skip to content

Instantly share code, notes, and snippets.

@calmh
Created November 29, 2016 14:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save calmh/283a598ba41edb49cea26249b8b2e2c8 to your computer and use it in GitHub Desktop.
Save calmh/283a598ba41edb49cea26249b8b2e2c8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import socket
hex = ""
for line in sys.stdin.readlines():
first_space = line.index(' ')
if first_space > 2:
line = line[first_space:]
hex += line.replace(' ', '').strip()
data = hex.decode('hex')
host, port = sys.argv[1].split(':')
port = int(port)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(data, (host, port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment