Skip to content

Instantly share code, notes, and snippets.

Last active March 28, 2022 19:01
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment