-
-
Save kkrypt0nn/ecd624597e00424bd462e2de583bc6f3 to your computer and use it in GitHub Desktop.
Solution for challenge GDBug at the Insomni'hack 2022 CTF
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
from string import ascii_uppercase | |
import itertools | |
def iter(): | |
for s in itertools.product(ascii_uppercase, repeat=24): | |
s = list(s) | |
s[4] = "-" | |
s[9] = "-" | |
s[14] = "-" | |
s[19] = "-" | |
yield "".join(s) | |
def solve(): | |
while True: | |
for serial in iter(): | |
x = 0x539 # Setup the variables | |
i = 0 | |
while (True): | |
if (i >= len(serial)): # Go over the length of the string | |
break | |
x += ord(serial[i]) # Append the hexadecimal value of the current character to 'x' | |
i += 1 | |
print(f"Trying {serial}", end="\r") | |
if (hex(0xb38)==hex(x)): # Check if the serial is a valid serial or not | |
print(f"Found: INS{{{serial}}}") | |
return # Remove this to see all possible flags | |
solve() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment