1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| import whereThel1b import itertools
flag_template = 'a'*42
target_encryption = [108, 117, 72, 80, 64, 49, 99, 19, 69, 115, 94, 93, 94, 115, 71, 95, 84, 89, 56, 101, 70, 2, 84, 75, 127, 68, 103, 85, 105, 113, 80, 103, 95, 67, 81, 7, 113, 70, 47, 73, 92, 124, 93, 120, 104, 108, 106, 17, 80, 102, 101, 75, 93, 68, 121, 26]
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-@_{}'
for i in range(0, 41, 3): found = False for combo in itertools.product(charset, repeat=3): test_flag_list = list(flag_template) test_flag_list[i:i + 3] = combo test_flag = ''.join(test_flag_list) test_flag_bytes = test_flag.encode()
whereThel1b.whereistheflag(test_flag_bytes) result = whereThel1b.trytry(test_flag_bytes)
if result[int((i+3)/3-1)*4:(int((i+3)/3-1)*4)+4] == target_encryption[int((i+3)/3-1)*4:(int((i+3)/3-1)*4)+4]: found = True flag_template = test_flag print(f"Match found for position {i}-{i + 2}: {''.join(combo)}") break
if not found: print(f"No matching flag part found for position {i}-{i + 2}.") break
print("Final flag:", flag_template)
|