This commit is contained in:
Michael Zhang 2017-03-12 04:21:00 -05:00
parent c2555cdf41
commit 183332cd92
2 changed files with 13 additions and 9 deletions

View file

@ -1 +1 @@
This binary has a rather unhelpful message, can you find what it's hiding? [easy-re](easy_re)
This binary has a rather unhelpful message, can you find what it's hiding? [easy-re](${easy_re})

View file

@ -1,18 +1,22 @@
from cStringIO import StringIO
def gen_flag(random, length):
x = ''
for i in range(0,length):
x += random.choice(list('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQSTUVWXYZ0123456789'))
return x
x = ''
for i in range(0, length):
x += random.choice(list('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQSTUVWXYZ0123456789'))
return x
def grade(random, key):
if key.find(gen_flag(random, 14)) != -1:
return True, "Correct!"
return False, "Nope."
def generate(random):
dat = b'\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01\x00\x00\x00\x91\x80\x04\x084\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x004\x00 \x00\x02\x00(\x00\x00\x00\x00\x00\x01\x00\x00\x00t\x00\x00\x00t\x80\x04\x08t\x80\x04\x08G\x00\x00\x00G\x00\x00\x00\x07\x00\x00\x00\x00\x10\x00\x00\x01\x00\x00\x00\xbb\x00\x00\x00\xbb\x90\x04\x08\xbb\x90\x04\x080\x00\x00\x000\x00\x00\x00\x06\x00\x00\x00\x00\x10\x00\x00\x89\xc8\x808\x00t\x03@\xeb\xf8\x89\xc2)\xca\xb8\x04\x00\x00\x00\xbb\x01\x00\x00\x00\x89\xc9\xcd\x80\xc3\xb9\xbb\x90\x04\x08\xe8\xd9\xff\xff\xff\xbb\x00\x00\x00\x00\xb8\x01\x00\x00\x00\xcd\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Can you find the flag?\n\x00easyctf{abcdef__123456}\x00'
output = bytearray(dat[:0xdb])
flag = gen_flag(random,14)
output = bytearray(dat[:0xdb])
flag = gen_flag(random, 14)
output.extend(flag.encode('utf-8'))
output.extend(dat[0xdb+14:])
return dict(files={"hexable":output})
output.extend(dat[0xdb + 14:])
return dict(files={"hexable": (lambda r: StringIO(output))})