This was making the client difficult to write as it's not possible to use any of the string functions to copy the full payload across.
19 lines
340 B
Python
19 lines
340 B
Python
#!/usr/bin/env python3
|
|
import struct
|
|
import sys
|
|
import time
|
|
|
|
op = sys.argv[1]
|
|
rest = sys.argv[2:]
|
|
|
|
if op == "C":
|
|
payload = ",".join(rest)
|
|
else:
|
|
payload = " ".join(rest)
|
|
|
|
# print(payload.encode(), file=sys.stderr)
|
|
|
|
sys.stdout.write(op)
|
|
sys.stdout.write(struct.pack("b", len(payload)).decode())
|
|
sys.stdout.write(payload)
|
|
sys.stdout.flush()
|