Skip to content

Commit

Permalink
Update Ethernet/IP/TCP challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorNelson committed Feb 22, 2025
1 parent 2b850f4 commit 1af80f6
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 12 deletions.
9 changes: 3 additions & 6 deletions dojo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@ modules:
- id: level-7
name: Network Configuration
- id: level-8
name: level8
description: Manually send an Ethernet packet
name: Ethernet
- id: level-9
name: level9
description: Manually send an Internet Protocol packet
name: IP
- id: level-10
name: level10
description: Manually send a Transmission Control Protocol packet
name: TCP
- id: level-11
name: level11
description: Manually perform a Transmission Control Protocol handshake
Expand Down
1 change: 0 additions & 1 deletion intercepting-communication/level-10/.config

This file was deleted.

1 change: 1 addition & 0 deletions intercepting-communication/level-10/.init
3 changes: 3 additions & 0 deletions intercepting-communication/level-10/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manually send a Transmission Control Protocol packet.
The packet should have `TCP sport=31337, dport=31337, seq=31337, ack=31337, flags=APRSF`.
The packet should be sent to the remote host at `10.0.0.2`.
1 change: 0 additions & 1 deletion intercepting-communication/level-10/run

This file was deleted.

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

from dojjail import Host, Network
import scapy.all as scapy

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

class RawPacketHost(Host):
def entrypoint(self):
scapy.conf.ifaces.reload()
scapy.sniff(prn=self.handle_packet, iface="eth0")

def handle_packet(self, packet):
if "TCP" not in packet:
return
if (packet["TCP"].sport == 31337 and packet["TCP"].dport == 31337 and
packet["TCP"].seq == 31337 and packet["TCP"].ack == 31337 and
packet["TCP"].flags == "APRSF"):
print(flag, flush=True)

user_host = Host("ip-10-0-0-1")
raw_packet_host = RawPacketHost("ip-10-0-0-2")
network = Network(hosts={user_host: "10.0.0.1", raw_packet_host: "10.0.0.2"}, subnet="10.0.0.0/24")
network.run()

user_host.interact()
1 change: 0 additions & 1 deletion intercepting-communication/level-8/.config

This file was deleted.

1 change: 1 addition & 0 deletions intercepting-communication/level-8/.init
3 changes: 3 additions & 0 deletions intercepting-communication/level-8/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manually send an Ethernet packet.
The packet should have `Ether type=0xFFFF`.
The packet should be sent to the remote host at `10.0.0.2`.
1 change: 0 additions & 1 deletion intercepting-communication/level-8/run

This file was deleted.

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

from dojjail import Host, Network
import scapy.all as scapy

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

class RawPacketHost(Host):
def entrypoint(self):
scapy.conf.ifaces.reload()
scapy.sniff(prn=self.handle_packet, iface="eth0")

def handle_packet(self, packet):
if "Ether" not in packet:
return
if packet["Ether"].type == 0xFFFF:
print(flag, flush=True)

user_host = Host("ip-10-0-0-1")
raw_packet_host = RawPacketHost("ip-10-0-0-2")
network = Network(hosts={user_host: "10.0.0.1", raw_packet_host: "10.0.0.2"}, subnet="10.0.0.0/24")
network.run()

user_host.interact()
1 change: 0 additions & 1 deletion intercepting-communication/level-9/.config

This file was deleted.

1 change: 1 addition & 0 deletions intercepting-communication/level-9/.init
3 changes: 3 additions & 0 deletions intercepting-communication/level-9/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manually send an Internet Protocol packet.
The packet should have `IP proto=0xFF`.
The packet should be sent to the remote host at `10.0.0.2`.
1 change: 0 additions & 1 deletion intercepting-communication/level-9/run

This file was deleted.

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

from dojjail import Host, Network
import scapy.all as scapy

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

class RawPacketHost(Host):
def entrypoint(self):
scapy.conf.ifaces.reload()
scapy.sniff(prn=self.handle_packet, iface="eth0")

def handle_packet(self, packet):
if "IP" not in packet:
return
if packet["IP"].proto == 0xFF:
print(flag, flush=True)

user_host = Host("ip-10-0-0-1")
raw_packet_host = RawPacketHost("ip-10-0-0-2")
network = Network(hosts={user_host: "10.0.0.1", raw_packet_host: "10.0.0.2"}, subnet="10.0.0.0/24")
network.run()

user_host.interact()

0 comments on commit 1af80f6

Please sign in to comment.