Skip to content

Instantly share code, notes, and snippets.

@kkrypt0nn
Last active Mar 28, 2022
Embed
What would you like to do?
Solution for challenge GDBug at the Insomni'hack 2022 CTF
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