Skip to content

Instantly share code, notes, and snippets.

@rafaelcbc
Created July 12, 2023 18:54
Show Gist options
  • Select an option

  • Save rafaelcbc/003a20f910b3d03a30d6db8a329ef5a6 to your computer and use it in GitHub Desktop.

Select an option

Save rafaelcbc/003a20f910b3d03a30d6db8a329ef5a6 to your computer and use it in GitHub Desktop.
Utility to send binary data represented in hexadecimal over TCP connection
#!/usr/bin/env python3
import socket
import sys
host, port = sys.argv[1].split(':')
s = socket.socket()
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