MCPcopy Index your code
hub / github.com/ELMERIKH/PyinMemoryPE / __unpack__

Method __unpack__

pythonmemorymodule/pefile.py:1006–1027  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

1004 return self.__format_length__
1005
1006 def __unpack__(self, data):
1007
1008 data = b(data)
1009
1010 if len(data) > self.__format_length__:
1011 data = data[: self.__format_length__]
1012
1013 # OC Patch:
1014 # Some malware have incorrect header lengths.
1015 # Fail gracefully if this occurs
1016 # Buggy malware: a29b0118af8b7408444df81701ad5a7f
1017 #
1018 elif len(data) < self.__format_length__:
1019 raise PEFormatError("Data length less than expected header length.")
1020
1021 if count_zeroes(data) == len(data):
1022 self.__all_zeroes__ = True
1023
1024 self.__unpacked_data_elms__ = struct.unpack(self.__format__, data)
1025 for idx, val in enumerate(self.__unpacked_data_elms__):
1026 for key in self.__keys__[idx]:
1027 setattr(self, key, val)
1028
1029 def __pack__(self):
1030

Callers 5

__unpack_data__Method · 0.95
__unpack__Method · 0.45
unpack_in_stagesMethod · 0.45
initializeMethod · 0.45
parse_sectionsMethod · 0.45

Calls 4

bFunction · 0.85
PEFormatErrorClass · 0.85
count_zeroesFunction · 0.85
unpackMethod · 0.45

Tested by

no test coverage detected