Skip to content

Instantly share code, notes, and snippets.

@kkrypt0nn
Created April 3, 2022 18:22
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/0d4f658978524fb3a7c77e2395ca341f to your computer and use it in GitHub Desktop.
Save kkrypt0nn/0d4f658978524fb3a7c77e2395ca341f to your computer and use it in GitHub Desktop.
Solution for challenge Cape Kennedy at the Space Heroes 2022 CTF
import random
from string import ascii_letters
pwds = []
def solve():
while True:
s = ["A"]*8
s[0] = random.choice(ascii_letters)
s[1] = random.choice(ascii_letters)
s[2] = random.choice(ascii_letters)
s[5] = s[2]
s[3] = random.choice(ascii_letters)
s[4] = s[3]
s[6] = random.choice(ascii_letters)
s[7] = s[6]
builder = 0
password = "".join(s)
for c in password:
builder += ord(c)
if (builder == 713 and len(password) == 8 and (ord(password[2]) == ord(password[5]))):
if (ord(password[3]) == ord(password[4])) and ((ord(password[6])) == ord(password[7])):
if password not in pwds:
pwds.append(password)
with open("moon2.txt", "a") as f:
f.write(password + "\n")
solve()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment