diff --git a/intercepting-communication/dos-1/run b/intercepting-communication/dos-1/run index ca4c247..e7d9d6e 100755 --- a/intercepting-communication/dos-1/run +++ b/intercepting-communication/dos-1/run @@ -27,10 +27,10 @@ class ServerHost(Host): class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: with socket.create_connection(("10.0.0.2", 31337), timeout=1) as client_socket: client_socket.sendall(b"Hello, World!\n") - time.sleep(1) except (TimeoutError, socket.timeout): print(flag, flush=True) break diff --git a/intercepting-communication/firewall-1/run b/intercepting-communication/firewall-1/run index 7449ccc..94814c4 100755 --- a/intercepting-communication/firewall-1/run +++ b/intercepting-communication/firewall-1/run @@ -40,10 +40,10 @@ class ServerHost(Host): class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: with socket.create_connection(("10.0.0.1", 31337)) as client_socket: client_socket.sendall(b"Hello, World!\n") - time.sleep(1) except (OSError, ConnectionError, TimeoutError): continue diff --git a/intercepting-communication/firewall-2/run b/intercepting-communication/firewall-2/run index 37c5adb..8cf1b3e 100755 --- a/intercepting-communication/firewall-2/run +++ b/intercepting-communication/firewall-2/run @@ -44,10 +44,10 @@ class ServerHost(Host): class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: with socket.create_connection(("10.0.0.1", 31337)) as client_socket: client_socket.sendall(b"Hello, World!\n") - time.sleep(1) except (OSError, ConnectionError, TimeoutError): continue diff --git a/intercepting-communication/level-13/run b/intercepting-communication/level-13/run index f4b5ce1..da36415 100755 --- a/intercepting-communication/level-13/run +++ b/intercepting-communication/level-13/run @@ -13,12 +13,12 @@ parent_process = psutil.Process(os.getppid()) class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: client_socket = socket.socket() client_socket.connect(("10.0.0.3", 31337)) client_socket.sendall(flag.encode()) client_socket.close() - time.sleep(1) except (OSError, ConnectionError, TimeoutError): continue diff --git a/intercepting-communication/level-2/run b/intercepting-communication/level-2/run index 0969a8a..3d637d8 100755 --- a/intercepting-communication/level-2/run +++ b/intercepting-communication/level-2/run @@ -13,12 +13,12 @@ parent_process = psutil.Process(os.getppid()) class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) 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 diff --git a/intercepting-communication/level-5/run b/intercepting-communication/level-5/run index c815c0f..dae3344 100755 --- a/intercepting-communication/level-5/run +++ b/intercepting-communication/level-5/run @@ -13,12 +13,12 @@ parent_process = psutil.Process(os.getppid()) class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: client_socket = socket.socket() client_socket.connect(("10.0.0.2", 31337)) client_socket.sendall(flag.encode()) client_socket.close() - time.sleep(1) except (ConnectionError, TimeoutError): continue diff --git a/intercepting-communication/level-6/run b/intercepting-communication/level-6/run index 3584399..a20ad67 100755 --- a/intercepting-communication/level-6/run +++ b/intercepting-communication/level-6/run @@ -13,6 +13,7 @@ parent_process = psutil.Process(os.getppid()) class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: client_socket = socket.socket() client_socket.connect(("10.0.0.2", 31337)) @@ -20,7 +21,6 @@ class ClientHost(Host): client_socket.sendall(c.encode()) time.sleep(1) client_socket.close() - time.sleep(1) except (ConnectionError, TimeoutError): continue diff --git a/intercepting-communication/level-7/run b/intercepting-communication/level-7/run index 52a681b..319b70c 100755 --- a/intercepting-communication/level-7/run +++ b/intercepting-communication/level-7/run @@ -13,12 +13,12 @@ parent_process = psutil.Process(os.getppid()) class ClientHost(Host): def entrypoint(self): while True: + time.sleep(1) try: client_socket = socket.socket() client_socket.connect(("10.0.0.3", 31337)) client_socket.sendall(flag.encode()) client_socket.close() - time.sleep(1) except (OSError, ConnectionError, TimeoutError): continue diff --git a/intercepting-communication/udp-spoof-host-2/run b/intercepting-communication/udp-spoof-host-2/run index 2d24e41..967e2d0 100755 --- a/intercepting-communication/udp-spoof-host-2/run +++ b/intercepting-communication/udp-spoof-host-2/run @@ -27,14 +27,13 @@ class ClientHost(Host): client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) client_socket.bind(("0.0.0.0", 31338)) while True: + time.sleep(1) try: client_socket.sendto(b"ACTION?", ("10.0.0.3", 31337)) message, (peer_host, peer_port) = client_socket.recvfrom(1024) if peer_port == 31337 and message.startswith(b"FLAG"): _, flag_host, flag_port = message.strip().split(b":") client_socket.sendto(flag.encode(), (flag_host, int(flag_port))) - - time.sleep(1) except (ConnectionError, ValueError): continue diff --git a/intercepting-communication/udp-spoof-host-3/run b/intercepting-communication/udp-spoof-host-3/run index ae71a91..ff19c1f 100755 --- a/intercepting-communication/udp-spoof-host-3/run +++ b/intercepting-communication/udp-spoof-host-3/run @@ -26,14 +26,13 @@ class ClientHost(Host): def entrypoint(self): client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while True: + time.sleep(1) try: client_socket.sendto(b"ACTION?", ("10.0.0.3", 31337)) message, (peer_host, peer_port) = client_socket.recvfrom(1024) if peer_port == 31337 and message.startswith(b"FLAG"): _, flag_host, flag_port = message.strip().split(b":") client_socket.sendto(flag.encode(), (flag_host, int(flag_port))) - - time.sleep(1) except (ConnectionError, ValueError): continue diff --git a/intercepting-communication/udp-spoof-host-4/run b/intercepting-communication/udp-spoof-host-4/run index f7fff88..09979e7 100755 --- a/intercepting-communication/udp-spoof-host-4/run +++ b/intercepting-communication/udp-spoof-host-4/run @@ -26,14 +26,13 @@ class ClientHost(Host): def entrypoint(self): client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while True: + time.sleep(1) try: client_socket.sendto(b"ACTION?", ("10.0.0.3", 31337)) message, (peer_host, peer_port) = client_socket.recvfrom(1024) if peer_host == "10.0.0.3" and peer_port == 31337 and message.startswith(b"FLAG"): _, flag_host, flag_port = message.strip().split(b":") client_socket.sendto(flag.encode(), (flag_host, int(flag_port))) - - time.sleep(1) except (ConnectionError, ValueError): continue