From e771dc9d93ceb2c7fb98d3d6ece5ddb0d78a77a3 Mon Sep 17 00:00:00 2001 From: MKAntiGrind Date: Mon, 20 May 2019 08:14:03 -0700 Subject: [PATCH] Initial Version of data_grabber.py --- data_grabber.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 data_grabber.py diff --git a/data_grabber.py b/data_grabber.py new file mode 100644 index 0000000..806dda2 --- /dev/null +++ b/data_grabber.py @@ -0,0 +1,47 @@ +import argparse +import re +import os + +def check_runtime_folder(): + if os.path.dirname(os.path.abspath(__file__)) == os.getcwd(): + return True + else: + return False +def check_for_dump_file(): + return os.path.isfile(r'%s' % args.dump_location) + +if __name__ == "__main__": + + parser = argparse.ArgumentParser(description = 'Data Grabber for MK11Unlocker', add_help = False) + parser.description = "Stop asking for help, here you have it !" + required = parser.add_argument_group('Required arguments') + required.add_argument('-d', '--dump_location', required = True) + optional = parser.add_argument_group('Optional arguments') + optional.add_argument("-h", "--help", action = "help") + args = parser.parse_args() + + if check_runtime_folder()!= True: + print("\nPlease start the script from its directory.") + exit() + if check_for_dump_file()!= True: + print("\nWe could not locate your dump file.") + exit() + + input_data = open(args.dump_location, 'rb') + data_raw = open("data_raw", "w") + + print("\nThe script is now extracting data from your dump file.") + print("Don't panic if it looks stuck, this will take a while to finish.") + + for line in input_data: + result = re.findall(rb'(?<=\x00)([A-F0-9]{32})(?=\x00)', line) + for item in result: + data_raw.write(item.decode("ascii")) + data_raw.write("\n") + + input_data.close() + data_raw.close() + + open("data_sorted",'w').writelines(set(open("data_raw",'r').readlines())) + + print("\nJob finished")