def Script(self): print("Starting Memory dump...") script = self.session.create_script("""'use strict'; rpc.exports = { enumerateRanges: function (prot) { return Process.enumerateRangesSync(prot); }, readMemory: function (address, size) { return Memory.readByteArray(ptr(address), size); } }; """) script.on("message", utils.on_message) script.load() agent = script.exports print(self.Perms) ranges = agent.enumerate_ranges(self.Perms) if self.Max_Size is not None: MAX_SIZE = self.Max_Size i = 0 l = len(ranges) # Performing the memory dump for range in ranges: base = range["base"] size = range["size"] logging.debug("Base Address: " + str(base)) logging.debug("") logging.debug("Size: " + str(size)) if size > MAX_SIZE: logging.debug("Too big, splitting the dump into chunks") self.mem_access_viol = dumper.splitter(agent, base, size, MAX_SIZE, self.mem_access_viol, self.Directory) continue self.mem_access_viol = dumper.dump_to_file(agent, base, size, self.mem_access_viol, self.Directory) i += 1 utils.printProgress(i, l, prefix='Progress:', suffix='Complete', bar=50) print("") if self.Strings: self.String()
i = 0 l = len(ranges) # Performing the memory dump for range in ranges: base = range["base"] size = range["size"] logging.debug("Base Address: " + str(base)) logging.debug("") logging.debug("Size: " + str(size)) if size > MAX_SIZE: logging.debug("Too big, splitting the dump into chunks") mem_access_viol = dumper.splitter(agent, base, size, MAX_SIZE, mem_access_viol, DIRECTORY) continue mem_access_viol = dumper.dump_to_file(agent, base, size, mem_access_viol, DIRECTORY) i += 1 utils.printProgress(i, l, prefix='Progress:', suffix='Complete', bar=50) print("") # Run Strings if selected if STRINGS: files = os.listdir(DIRECTORY) i = 0 l = len(files) print("Running strings on all files:") for f1 in files:
ranges = agent.enumerate_ranges(PERMS) if arguments.max_size is not None: MAX_SIZE = arguments.max_size i = 0 l = len(ranges) # Performing the memory dump for range in ranges: logging.debug("Base Address: " + str(range["base"])) logging.debug("") logging.debug("Size: " + str(range["size"])) if range["size"] > MAX_SIZE: logging.debug("Too big, splitting the dump into chunks") mem_access_viol = dumper.splitter(agent, range["base"], range["size"], MAX_SIZE, mem_access_viol, DIRECTORY) continue mem_access_viol = dumper.dump_to_file(agent, range["base"], range["size"], mem_access_viol, DIRECTORY) i += 1 utils.printProgress(i, l, prefix='Progress:', suffix='Complete', bar=50) # Run Strings if selected if STRINGS: files = os.listdir(DIRECTORY) i = 0 l = len(files) print("Running strings on all files:") for f1 in files: utils.strings(f1, DIRECTORY)
if arguments.max_size is not None: MAX_SIZE = arguments.max_size i = 0 l = len(Memories) # Performing the memory dump for memory in Memories: base = memory.base_address logging.debug("Base Address: " + str(hex(base))) logging.debug("") size = memory.size logging.debug("Size: " + str(size)) if size > MAX_SIZE: logging.debug("Too big, splitting the dump into chunks") mem_access_viol = dumper.splitter(session, base, size, MAX_SIZE, mem_access_viol, DIRECTORY) continue mem_access_viol = dumper.dump_to_file(session, base, size, mem_access_viol, DIRECTORY) i += 1 utils.printProgress(i, l, prefix='Progress:', suffix='Complete', bar=50) print # Run Strings if selected if STRINGS: files = os.listdir(DIRECTORY) i = 0 l = len(files) print "Running strings on all files:" for f1 in files: utils.strings(f1, DIRECTORY)