Skip to content

Instantly share code, notes, and snippets.

@rafaelcbc
Last active January 18, 2023 17:04
Show Gist options
  • Save rafaelcbc/fed9569885503a3d1d47894c67adebb3 to your computer and use it in GitHub Desktop.
Save rafaelcbc/fed9569885503a3d1d47894c67adebb3 to your computer and use it in GitHub Desktop.
Utility to send binary data represented in hexadecimal over UDP connection
#!/usr/bin/env python3
import socket
import sys
host, port = sys.argv[1].split(':')
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((host, int(port)))
while True:
print('---')
s.send(bytes.fromhex(input('>>> ')))
print('<<<', bytes.hex(s.recv(1024)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment