mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
cape: make some pe fields optional
closes #2632 but, pe.imagebase is required, so keeping that (so test field will continue to fail).
This commit is contained in:
committed by
Willi Ballenthin
parent
fa90aae3dc
commit
c1c71613a9
@@ -54,7 +54,8 @@ class CapeExtractor(DynamicFeatureExtractor):
|
||||
|
||||
def get_base_address(self) -> Union[AbsoluteVirtualAddress, _NoAddress, None]:
|
||||
# value according to the PE header, the actual trace may use a different imagebase
|
||||
assert self.report.static is not None and self.report.static.pe is not None
|
||||
assert self.report.static is not None
|
||||
assert self.report.static.pe is not None
|
||||
return AbsoluteVirtualAddress(self.report.static.pe.imagebase)
|
||||
|
||||
def extract_global_features(self) -> Iterator[tuple[Feature, Address]]:
|
||||
|
||||
@@ -188,15 +188,15 @@ class PE(FlexibleModel):
|
||||
# timestamp: str
|
||||
|
||||
# list[ImportedDll], or dict[basename(dll), ImportedDll]
|
||||
imports: Union[list[ImportedDll], dict[str, ImportedDll]]
|
||||
imports: list[ImportedDll] | dict[str, ImportedDll] = Field(default_factory=list) # type: ignore
|
||||
# imported_dll_count: Optional[int] = None
|
||||
# imphash: str
|
||||
|
||||
# exported_dll_name: Optional[str] = None
|
||||
exports: list[ExportedSymbol]
|
||||
exports: list[ExportedSymbol] = Field(default_factory=list)
|
||||
|
||||
# dirents: list[DirectoryEntry]
|
||||
sections: list[Section]
|
||||
sections: list[Section] = Field(default_factory=list)
|
||||
|
||||
# ep_bytes: Optional[HexBytes] = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user