Skip to content

Instantly share code, notes, and snippets.

@kkrypt0nn
Last active January 7, 2025 15:09
Show Gist options
  • Save kkrypt0nn/ecd624597e00424bd462e2de583bc6f3 to your computer and use it in GitHub Desktop.
Save kkrypt0nn/ecd624597e00424bd462e2de583bc6f3 to your computer and use it in GitHub Desktop.
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()

Comments are disabled for this gist.