Description
Greetings EventHorizon maintainers,
I've been diving into the framework codebase in preparation for GSoC, and I noticed the run.sh script used to manage the protocol tarpits could use a bit of an upgrade to match the robustness of the C server logic.
Right now, the stop and status commands in the bash script are marked as # TODO. Furthermore, bash argument parsing is a bit brittle without explicit type validation (e.g., accidentally missing a port argument).
Since the primary users and researchers of EventHorizon are working in Python, it makes sense for the deployment tooling to be Python-native too!
Proposed Fix: Introduce manage.py
I've already developed and tested a robust Python replacement script (manage.py) that cleanly supersedes run.sh:
- Replaced Bash with Python
argparse: Swapped fragile bash regex parsing with strict, type-safe Python arguments (e.g., forcing ports to be integers).
-
- Implemented
# TODO: stopServer: Leveraging psutil, the stop command now gracefully targets and sends SIGTERM exclusively to running EventHorizon binaries without disrupting the host OS.
-
- Implemented
# TODO: status: Built a clean, dynamic status table identifying active protocols, their strict PIDs, and running uptimes in seconds.
-
- Optimized Execution: Uses
os.execv to perform a clean OS-level process handoff to the target C binaries, leaving zero Python overhead running around the trapped connections.
Bonus: This seamlessly drops into the current docker-compose.yml and docker/tarpits/Dockerfile workflow merely by adding python3.
Testing & Verification
I have full pytest coverage built out with unittest.mock proving it correctly routes to the binaries inside Docker scenarios securely.
# Example usage:
python3 manage.py start telnet 23 100 4096
python3 manage.py status
python3 manage.py stop telnet
I would love to hear your thoughts on this approach! I am more than happy to discuss any architectural feedback or changes you'd like to see. If this looks like a valuable addition to the framework, I would be thrilled to have this issue assigned to me so I can finalize the PR.
Description
Greetings EventHorizon maintainers,
I've been diving into the framework codebase in preparation for GSoC, and I noticed the
run.shscript used to manage the protocol tarpits could use a bit of an upgrade to match the robustness of the C server logic.Right now, the
stopandstatuscommands in the bash script are marked as# TODO. Furthermore, bash argument parsing is a bit brittle without explicit type validation (e.g., accidentally missing a port argument).Since the primary users and researchers of EventHorizon are working in Python, it makes sense for the deployment tooling to be Python-native too!
Proposed Fix: Introduce
manage.pyI've already developed and tested a robust Python replacement script (
manage.py) that cleanly supersedesrun.sh:argparse: Swapped fragile bash regex parsing with strict, type-safe Python arguments (e.g., forcing ports to be integers).# TODO: stopServer: Leveragingpsutil, thestopcommand now gracefully targets and sendsSIGTERMexclusively to running EventHorizon binaries without disrupting the host OS.# TODO: status: Built a clean, dynamic status table identifying active protocols, their strict PIDs, and running uptimes in seconds.os.execvto perform a clean OS-level process handoff to the target C binaries, leaving zero Python overhead running around the trapped connections.Bonus: This seamlessly drops into the current
docker-compose.ymlanddocker/tarpits/Dockerfileworkflow merely by addingpython3.Testing & Verification
I have full
pytestcoverage built out withunittest.mockproving it correctly routes to the binaries inside Docker scenarios securely.# Example usage: python3 manage.py start telnet 23 100 4096 python3 manage.py status python3 manage.py stop telnetI would love to hear your thoughts on this approach! I am more than happy to discuss any architectural feedback or changes you'd like to see. If this looks like a valuable addition to the framework, I would be thrilled to have this issue assigned to me so I can finalize the PR.