Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_buff(buffer):
mf = MinidumpFile()
mf.file_handle = buffer
mf._parse()
return mf
def parse_bytes(data):
return MinidumpFile.parse_buff(io.BytesIO(data))
def parse_minidump_external(handle):
"""
Parses LSASS minidump file based on the file object.
File object can really be any object as longs as
it implements read, seek, tell functions with the
same parameters as a file object would.
handle: file like object
"""
minidump = MinidumpFile.parse_external(handle)
reader = minidump.get_reader().get_buffered_reader()
sysinfo = KatzSystemInfo.from_minidump(minidump)
mimi = pypykatz(reader, sysinfo)
mimi.start()
return mimi
def parse_external(file_handle, filename = ''):
"""
External file handle must be an object that exposes basic file IO functionality
that you'd get by python's file buffer (read, seek, tell etc.)
"""
mf = MinidumpFile()
mf.filename = filename
mf.file_handle = file_handle
mf._parse()
return mf
def parse(filename):
mf = MinidumpFile()
mf.filename = filename
mf.file_handle = open(filename, 'rb')
mf._parse()
return mf