Skip to content

Instantly share code, notes, and snippets.

@lttn1204
Created April 9, 2021 15:14
Show Gist options
  • Save lttn1204/80cab47cdaec49150bc47e66b3148550 to your computer and use it in GitHub Desktop.
Save lttn1204/80cab47cdaec49150bc47e66b3148550 to your computer and use it in GitHub Desktop.
from sock import Sock
from string import printable
so = Sock('crypto.2021.chall.actf.co:21112')
len_flag=25
def recv(x):
so.read_until(b"give input: ")
so.send_line(x)
res = so.read_line().strip()
return res
flag=''
while True:
i=1
len_flag=len_flag-i
res=recv((b'a'*(23+len_flag)+b'{}').hex())[32:96]
for char in printable:
#print(char)
ans=recv((b'a'*(23+len_flag)+flag.encode()+char.encode()+b'{}').hex())[32:96]
if ans==res:
flag+=char
print(flag)
i+=1
break
if len(flag)==25:
break
print(flag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment