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_content(self):
"""Build structures corresponding to current content"""
# Header
offset = 0
self.minidumpHDR = mp.MinidumpHDR.unpack(self._content, offset, self)
assert self.minidumpHDR.Magic == 0x504d444d
# Streams
base_offset = self.minidumpHDR.StreamDirectoryRva.rva
empty_stream = mp.StreamDirectory(StreamType=0,
Location=mp.LocationDescriptor(DataSize=0,
Rva=mp.Rva(rva=0)
)
)
streamdir_size = len(empty_stream)
for i in xrange(self.minidumpHDR.NumberOfStreams):
stream_offset = base_offset + i * streamdir_size
stream = mp.StreamDirectory.unpack(self._content, stream_offset, self)
self.streams.append(stream)
# Launch specific action depending on the stream
datasize = stream.Location.DataSize
offset = stream.Location.Rva.rva
if stream.StreamType == mp.streamType.ModuleListStream:
self.modulelist = mp.ModuleList.unpack(self._content, offset, self)
elif stream.StreamType == mp.streamType.MemoryListStream:
# Header
offset = 0
self.minidumpHDR = mp.MinidumpHDR.unpack(self._content, offset, self)
assert self.minidumpHDR.Magic == 0x504d444d
# Streams
base_offset = self.minidumpHDR.StreamDirectoryRva.rva
empty_stream = mp.StreamDirectory(StreamType=0,
Location=mp.LocationDescriptor(DataSize=0,
Rva=mp.Rva(rva=0)
)
)
streamdir_size = len(empty_stream)
for i in xrange(self.minidumpHDR.NumberOfStreams):
stream_offset = base_offset + i * streamdir_size
stream = mp.StreamDirectory.unpack(self._content, stream_offset, self)
self.streams.append(stream)
# Launch specific action depending on the stream
datasize = stream.Location.DataSize
offset = stream.Location.Rva.rva
if stream.StreamType == mp.streamType.ModuleListStream:
self.modulelist = mp.ModuleList.unpack(self._content, offset, self)
elif stream.StreamType == mp.streamType.MemoryListStream:
self.memorylist = mp.MemoryList.unpack(self._content, offset, self)
elif stream.StreamType == mp.streamType.Memory64ListStream:
self.memory64list = mp.Memory64List.unpack(self._content, offset, self)
elif stream.StreamType == mp.streamType.MemoryInfoListStream:
self.memoryinfolist = mp.MemoryInfoList.unpack(self._content, offset, self)
elif stream.StreamType == mp.streamType.SystemInfoStream:
self.systeminfo = mp.SystemInfo.unpack(self._content, offset, self)