keygenme-py
Problem
keygenme-trial.py
Solution
The program contains a variable called
key_part_static1_trialthat has the first part of the flag:picoCTF{1n_7h3_|<3y_of_. The portion of the flag we need to find ifkey_part_dynamic1_trial.When the user chooses option "c", the
enter_licensefunction is called. It callscheck_keywith the user provided key (the flag) andbUsername_trial, which isb"GOUGH".The
check_keyfunctions contains the code that fills in thekey_part_dynamic1_trial. It takes the hexdigest of the sha256 hash ofb"GOUGH"and then selects a certain character by an indexing to a certain point on that string.We can simply find the hexdigest of the sha256 hash of
b"GOUGH"and then get the characters at the positions it checks:"".join([hashlib.sha256(b"GOUGH").hexdigest()[x] for x in [4,5,3,6,2,7,1,8]]). This is the missing section of the flag.We can now complete the flag:
picoCTF{1n_7h3_|<3y_of_xxxxxxxx}-->picoCTF{1n_7h3_|<3y_of_f911a486}
Flag
picoCTF{1n_7h3_|<3y_of_f911a486}
Last updated
Was this helpful?