Skip to content

Instantly share code, notes, and snippets.

@kkrypt0nn
Created April 3, 2022 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkrypt0nn/6bc38756350cb3d7443b3cea831831fd to your computer and use it in GitHub Desktop.
Save kkrypt0nn/6bc38756350cb3d7443b3cea831831fd to your computer and use it in GitHub Desktop.
Solution for challenge Flag in space at the Space Heroes 2022 CTF
import requests
flag = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "}"]
res = ["s", "h", "c", "t", "f", "{"]
for i in range(0, len(flag)):
for j in range (0x21, 0x7d):
char = chr(j)
url = "http://172.105.154.14/?flag=" + "".join(res) + char
r = requests.get(url)
response = "".join(r.text.split())
previous = ""
for k in range(0, len(res)):
previous += "<div>" + res[k] + "</div>"
if f"{previous}<div>{char}</div>" in response:
res += char
print("".join(res), end="\r")
break
print("".join(res))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment