-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
import requests | ||
import random | ||
import psutil | ||
import socket | ||
import string | ||
import flask | ||
import time | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../.init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
You've used TCP, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/exec-suid --real -- /usr/bin/python -I | ||
|
||
import psutil | ||
import socket | ||
import os | ||
|
||
from dojjail import Host, Network | ||
|
||
flag = open("/flag").read() | ||
parent_process = psutil.Process(os.getppid()) | ||
|
||
class ServerHost(Host): | ||
def entrypoint(self): | ||
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
server_socket.bind(("0.0.0.0", 31337)) | ||
while True: | ||
try: | ||
client_message, (client_host, client_port) = server_socket.recvfrom(1024) | ||
while True: | ||
if not client_message: | ||
break | ||
if client_message == "Hello, World!\n": | ||
server_socket.sendto(flag.encode(), (client_host, client_port)) | ||
break | ||
except ConnectionError: | ||
continue | ||
|
||
user_host = Host("ip-10-0-0-1", privileged_uid=parent_process.uids().effective) | ||
server_host = ServerHost("ip-10-0-0-2") | ||
network = Network(hosts={user_host: "10.0.0.1", server_host: "10.0.0.2"}, subnet="10.0.0.0/24") | ||
network.run() | ||
|
||
user_host.interactive(environ=parent_process.environ()) |