Hey all,
I'm pretty new to electronics and new to this forum, but thought you might find a python port of the FindKeys script useful - I didn't want to mess with visual studio. Disclaimer, it's hacky as hell, barely tested, and skips over the niceties of the original script. But it did successfully pull out all the licenses. Good luck! And feel free to clean it up.
FP = 'YOUR_FILE_PATH'
def crazy_check(byte, l):
return (
(byte < ord('2') or byte > ord('9')) and
((byte < ord('A') + l) or (byte > ord('Z') + l)) and
(byte != ord('L') + l) and (byte != ord('O') + l)
)
parts4 = set()
parts8 = set()
parts12 = set()
keys = set()
def find_keys(fp):
with open(fp, 'rb') as f:
entire_buffer = f.read()
l = 0
for j in range(2):
i = 0
str_start = 0
str_size = 0
for i in range(len(entire_buffer)):
byte = entire_buffer[i]
if crazy_check(byte, l):
b = (str_start % 4096 == 0) or (i % 4096 == 0)
if str_size > 15 or (str_size > 3 and b):
str_end = str_start + str_size
if str_size % 16 == 0:
s = entire_buffer[str_start:str_end].decode('utf8')
while len(s) > 15:
left_string, s = peel_off_string(s, 16)
check_and_add(left_string)
if str_size % 4 == 0 and b:
for x in range(0, 16, 4):
s = entire_buffer[str_start:str_end].decode('utf8')
left_string, s = peel_off_string(s, x)
check_and_add(left_string)
while len(s) > 15:
left_string, s = peel_off_string(s, 16)
check_and_add(left_string)
check_and_add(s)
str_size = 0
str_start = i + 1
else:
str_size += 1
l += 32
keys.union(consolidate_parts(parts8, parts8))
keys.union(consolidate_parts(parts4, parts12))
keys.union(consolidate_parts(parts12, parts4))
for k in keys:
print(k)
def check_and_add(string):
is_ok = string.isupper() and len(string) % 4 == 0 and len(string) > 0
if is_ok:
if len(string) == 4:
parts4.add(string)
if len(string) == 8:
parts8.add(string)
if len(string) == 12:
parts12.add(string)
if len(string) == 16:
keys.add(string)
def peel_off_string(string, i):
left_string = ""
if len(string) >= i:
left_string = string[:i]
string = string[i:]
return left_string, string
def consolidate_parts(p1, p2):
rc = set()
for i, s1 in enumerate(p1):
for j, s2 in enumerate(p2):
if i != j:
s = s1 + s2
rc.add(s)
return rc
if __name__ == '__main__':
find_keys(FP)