mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 11:07:53 -08:00
make more fields optional for more flexible model
tmp
This commit is contained in:
@@ -36,8 +36,8 @@ class VMRayMonitorProcess:
|
||||
monitor_id: int # unique ID assigned to process by VMRay
|
||||
origin_monitor_id: int # unique VMRay ID of parent process
|
||||
image_name: str
|
||||
filename: str
|
||||
cmd_line: str
|
||||
filename: Optional[str] = ""
|
||||
cmd_line: Optional[str] = ""
|
||||
|
||||
|
||||
class VMRayAnalysis:
|
||||
@@ -151,8 +151,9 @@ class VMRayAnalysis:
|
||||
for pefile_section in self.sample_file_static_data.pe.sections:
|
||||
self.sections[pefile_section.virtual_address] = pefile_section.name
|
||||
elif self.sample_file_static_data.elf:
|
||||
for elffile_section in self.sample_file_static_data.elf.sections:
|
||||
self.sections[elffile_section.header.sh_addr] = elffile_section.header.sh_name
|
||||
if self.sample_file_static_data.elf.sections:
|
||||
for elffile_section in self.sample_file_static_data.elf.sections:
|
||||
self.sections[elffile_section.header.sh_addr] = elffile_section.header.sh_name
|
||||
|
||||
def _compute_monitor_processes(self):
|
||||
for process in self.sv2.processes.values():
|
||||
|
||||
@@ -276,7 +276,7 @@ class ElfFileHeader(BaseModel):
|
||||
|
||||
class ElfFile(BaseModel):
|
||||
# file_header: ElfFileHeader
|
||||
sections: list[ElfFileSection]
|
||||
sections: Optional[list[ElfFileSection]] = None
|
||||
|
||||
|
||||
class StaticData(BaseModel):
|
||||
@@ -316,9 +316,9 @@ class Process(BaseModel):
|
||||
# monitor_reason: str
|
||||
origin_monitor_id: int # VMRay ID of parent process
|
||||
os_pid: int
|
||||
filename: SanitizedString
|
||||
filename: Optional[SanitizedString] = ""
|
||||
image_name: str
|
||||
cmd_line: SanitizedString
|
||||
cmd_line: Optional[SanitizedString] = ""
|
||||
ref_parent_process: Optional[GenericReference] = None
|
||||
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@ def test_vmray_model_elffile():
|
||||
"""
|
||||
)
|
||||
|
||||
assert elffile.sections[0].header.sh_name == "abcd1234"
|
||||
assert elffile.sections[0].header.sh_addr == 2863311530
|
||||
assert elffile.sections and elffile.sections[0].header.sh_name == "abcd1234"
|
||||
assert elffile.sections and elffile.sections[0].header.sh_addr == 2863311530
|
||||
|
||||
|
||||
def test_vmray_model_pefile():
|
||||
|
||||
Reference in New Issue
Block a user