(self, data)
| 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 |
no test coverage detected