forked from PoomSmart/MGKeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-mapping.py
24 lines (22 loc) · 989 Bytes
/
gen-mapping.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
from deobfuscated_keys import *
from unknown_keys_with_desc import *
mapping = {}
with open('hashes.txt', 'r') as hashes:
with open('mapping.h', 'w') as out:
for raw_hash in hashes:
hash = raw_hash.strip()
if hash in deobfuscated_keys:
mapping[hash] = f'"{deobfuscated_keys[hash]}",'
elif hash in unknown_with_desc:
mapping[hash] = f'NULL, // {unknown_with_desc[hash]}'
else:
mapping[hash] = 'NULL,'
total = len(mapping)
deobfuscated = len(deobfuscated_keys)
out.write('#include "struct.h"\n\n')
out.write(f'// Total: {total} keys\n')
out.write(f'// Deobfuscated: {deobfuscated} keys ({round((deobfuscated / total) * 100, 2)}%)\n\n')
out.write('static const struct tKeyMapping keyMappingTable[] = {\n')
for hash in mapping:
out.write(f' "{hash}", {mapping[hash]}\n')
out.write(' NULL, NULL\n};\n')