Skip to content

Commit

Permalink
Update network configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorNelson committed Feb 21, 2025
1 parent 8dc685f commit a400a0a
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 7 deletions.
5 changes: 2 additions & 3 deletions dojo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ modules:
- id: level-2
name: Listen
- id: level-3
name: Scan
name: Scan 1
- id: level-4
name: Scan 2
- id: level-5
name: Monitor 1
- id: level-6
name: Monitor 2
- id: level-7
name: level7
description: Hijack traffic from a remote host by configuring your network interface
name: Network Configuration
- id: level-8
name: level8
description: Manually send an Ethernet packet
Expand Down
2 changes: 1 addition & 1 deletion intercepting-communication/level-5/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Monitor traffic from a remote host.
Your host is already receiving traffic on port `31337`.
Your host is already receiving traffic on port `31337`.
2 changes: 1 addition & 1 deletion intercepting-communication/level-6/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Monitor slow traffic from a remote host.
Your host is already receiving traffic on port `31337`.
Your host is already receiving traffic on port `31337`.
1 change: 0 additions & 1 deletion intercepting-communication/level-7/.config

This file was deleted.

1 change: 1 addition & 0 deletions intercepting-communication/level-7/.init
2 changes: 2 additions & 0 deletions intercepting-communication/level-7/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hijack traffic from a remote host by configuring your network interface.
The remote host at `10.0.0.2` is communicating with the remote host at `10.0.0.3` on port `31337`.
1 change: 0 additions & 1 deletion intercepting-communication/level-7/run

This file was deleted.

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

import os
import socket
import subprocess
import time
from dojjail import Host, Network

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

class ClientHost(Host):
def entrypoint(self):
if os.fork() == 0:
while True:
subprocess.run(["/bin/ip", "neigh", "flush", "all"],
check=True,
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
time.sleep(1)
while True:
try:
client_socket = socket.socket()
client_socket.connect(("10.0.0.3", 31337))
client_socket.sendall(flag.encode())
client_socket.close()
time.sleep(10)
except (ConnectionError, TimeoutError):
continue

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.recv(1024)
connection.close()
except ConnectionError:
continue

user_host = Host("ip-10-0-0-1")
client_host = ClientHost("ip-10-0-0-2")
server_host = ServerHost("ip-10-0-0-3")
network = Network(hosts={user_host: "10.0.0.1", client_host: "10.0.0.2", server_host: "10.0.0.3"}, subnet="10.0.0.0/24")
network.run()

user_host.interact()

0 comments on commit a400a0a

Please sign in to comment.