This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ossp/firewall-server/form_message.py
AKP 2b91931c34 Use a comma instead of a null byte for separating IPs and ports
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.
2023-11-11 19:49:41 +00:00

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()