Browse Source

Initial Version of data_grabber.py

master
MKAntiGrind 2 years ago
parent
commit
e771dc9d93
1 changed files with 47 additions and 0 deletions
  1. 47
    0
      data_grabber.py

+ 47
- 0
data_grabber.py View File

@@ -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")

Loading…
Cancel
Save