Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Solving RC3 CTF 2017, Knocker
import os, math
from pwn import *
from word2number import w2n
def checker(process_string):
check_digit = process_string.replace("\n","").isdigit()
if check_digit:
return process_string #just number
else:
try:
process_strings = "math."+process_string #solving math problem
try:
return int(eval(process_strings))
except:
return int(eval(process_string))
except:
return w2n.word_to_num(process_string.replace(",","")) #convert word to number
result = ""
a = remote("18.216.59.235",7747)
print a.recv()
print a.recv()
a.sendline()
result += a.recvline().split("\n")[0]
port = checker(a.recvline())
while 1:
a = remote("18.216.59.235",port)
result += a.recvline().split("\n")[0]
print result
port = checker(a.recvline())
# RC3-2017{i-am-the-0ne-wh0-kn0ckz}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment