Created
September 2, 2018 02:04
-
-
Save JohnHammond/00967a1f630f058d021a102da1f7e4c4 to your computer and use it in GitHub Desktop.
Codefest CTF 2018 "Polyglot" get_flag Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
h = open('secret.c') | |
lines = [ x[:-1] for x in h.readlines() ] # remove newline char | |
h.close() | |
flag = [] | |
for line in lines: | |
num =''.join(re.findall(r'\s+', line)).replace('\t','1').replace(' ','0') | |
if num: | |
try: | |
flag.append(chr(int(num,2))) | |
except: | |
pass | |
print re.findall(r'CodefestCTF{.*}', ''.join(flag)[::-1])[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment