Skip to content

Commit

Permalink
Update level 2 of intercepting communication
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorNelson committed Feb 21, 2025
1 parent dd8d117 commit 7919d1e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
3 changes: 1 addition & 2 deletions dojo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ modules:
- id: level-1
name: Connect
- id: level-2
name: level2
description: Listen for a connection from a remote host
name: Listen
- id: level-3
name: level3
description: Find and connect to a remote host
Expand Down
2 changes: 1 addition & 1 deletion intercepting-communication/level-1/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
From your host at 10.0.0.1, connect to the target server at 10.0.0.2 on port 31337.
From your host at 10.0.0.1, connect to the remote host at 10.0.0.2 on port 31337.
1 change: 0 additions & 1 deletion intercepting-communication/level-2/.config

This file was deleted.

1 change: 1 addition & 0 deletions intercepting-communication/level-2/.init
1 change: 1 addition & 0 deletions intercepting-communication/level-2/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
From your host at 10.0.0.1, listen on port 31337 for a connection from the remote host at 10.0.0.2.
1 change: 0 additions & 1 deletion intercepting-communication/level-2/run

This file was deleted.

26 changes: 26 additions & 0 deletions intercepting-communication/level-2/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
import time

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

class ClientHost(Host):
def entrypoint(self):
while True:
try:
client_socket = socket.socket()
client_socket.connect(("10.0.0.1", 31337))
client_socket.sendall(flag.encode())
client_socket.close()
time.sleep(1)
except (ConnectionError, TimeoutError):
continue

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

user_host.interact()

0 comments on commit 7919d1e

Please sign in to comment.