base
Info
Details
Exploitation Script
from pwn import *
import re
host = "34.159.240.221"
port = 30632
r = remote(host, port)
while True:
try:
line = r.recvline().decode().strip()
print(f"[RECV] {line}")
if "<<" in line and ">>" in line:
match = re.search(r'<<(.+?)>>', line)
if not match:
continue
value = match.group(1)
if "in hex" in line:
num = int(value)
hex_value = hex(num)
print(f"[SEND] {hex_value}")
r.sendline(hex_value)
elif "in ASCII" in line:
if all(c in "01234567 " for c in value.strip()):
parts = value.split()
try:
ascii_str = ''.join([chr(int(p, 8)) for p in parts])
print(f"[SEND] {ascii_str}")
r.sendline(ascii_str)
except Exception as e:
print(f"[ERROR] Could not decode octal to ASCII: {e}")
break
else:
try:
ascii_str = bytes.fromhex(value).decode()
print(f"[SEND] {ascii_str}")
r.sendline(ascii_str)
except Exception as e:
print(f"[ERROR] Could not decode hex to ASCII: {e}")
break
elif "flag" in line.lower():
print(f"[FLAG] {line}")
break
except Exception as e:
print(f"[ERROR] {e}")
break
r.close()Last updated