mirror of
https://github.com/mandiant/capa.git
synced 2025-12-06 04:41:00 -08:00
cape: linux: handle no environ
This commit is contained in:
@@ -324,8 +324,8 @@ class Process(FlexibleModel):
|
||||
# module_path: str
|
||||
# first_seen: str
|
||||
calls: list[Call]
|
||||
environ: dict[str, str]
|
||||
threads: list[int] | None = None # this can be None for CAPE for Linux, which doesn't track threads.
|
||||
environ: dict[str, str] = Field(default_factory=dict) # type: ignore
|
||||
|
||||
|
||||
"""
|
||||
|
||||
@@ -49,6 +49,9 @@ def extract_environ_strings(ph: ProcessHandle) -> Iterator[tuple[Feature, Addres
|
||||
"""
|
||||
process: Process = ph.inner
|
||||
|
||||
if not process.environ:
|
||||
return
|
||||
|
||||
for value in (value for value in process.environ.values() if value):
|
||||
yield String(value), ph.address
|
||||
|
||||
|
||||
Reference in New Issue
Block a user