Skip to content

Instantly share code, notes, and snippets.

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