-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathprint_flag_original.py
executable file
·38 lines (33 loc) · 1.27 KB
/
print_flag_original.py
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
#!/usr/bin/python3
# The size of the file may reduce after XZRJification
def check_equals(left, right):
# check whether left == right or not
if left != right: exit(1)
def get_code_dict():
# prepare the code dict
code_dict = []
code_dict += ['nymeh1niwemflcir}echhaet']
code_dict += ['a3g7}kidgojernoetlsupe?h']
code_dict += ['ulwe!f5soadrhwnrsnstnoeq']
code_dict += ['ctt{l-findiehaai{oveatas']
code_dict += ['ty9kxborrszstguyd?!blm-p']
check_equals(set(len(s) for s in code_dict), {24})
return ''.join(code_dict)
def decrypt_data(input_codes):
# retrieve the decrypted data
code_dict = get_code_dict()
output_chars = [code_dict[c] for c in input_codes]
return ''.join(output_chars)
if __name__ == '__main__':
# check some obvious things
check_equals('create', 'cre' + 'ate')
check_equals('referrer', 'refer' + 'rer')
# check the flag
flag = decrypt_data([53, 41, 85, 109, 75, 1, 33, 48, 77, 90,
17, 118, 36, 25, 13, 89, 90, 3, 63, 25,
31, 77, 27, 60, 3, 118, 24, 62, 54, 61,
25, 63, 77, 36, 5, 32, 60, 67, 113, 28])
check_equals(flag.index('flag{'), 0)
check_equals(flag.index('}'), len(flag) - 1)
# print the flag
print(flag)