Skip to content

Commit

Permalink
Update intercepting communication level 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorNelson committed Feb 20, 2025
1 parent 1e79d57 commit 0a4075a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions intercepting-communication/.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chmod 6755 /challenge/run
rm /challenge/.init
1 change: 0 additions & 1 deletion intercepting-communication/level-1/.config

This file was deleted.

1 change: 1 addition & 0 deletions intercepting-communication/level-1/.init
1 change: 1 addition & 0 deletions intercepting-communication/level-1/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
From your host at 10.0.0.1, connect to the target server at 10.0.0.2 on port 31337.
1 change: 0 additions & 1 deletion intercepting-communication/level-1/run

This file was deleted.

26 changes: 26 additions & 0 deletions intercepting-communication/level-1/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/exec-suid --real -- /usr/bin/python -I

import socket
from dojjail import Host, Network

flag = open("/flag").read()

class ServerHost(Host):
def entrypoint(self):
server_socket = socket.socket()
server_socket.bind(("0.0.0.0", 31337))
server_socket.listen()
while True:
try:
connection, _ = server_socket.accept()
connection.sendall(flag.encode())
connection.close()
except ConnectionError:
continue

user_host = Host("ip-10-0-0-1")
server_host = ServerHost("ip-10-0-0-2")
network = Network(hosts=[user_host, server_host])
network.run()

user_host.interact()

0 comments on commit 0a4075a

Please sign in to comment.