mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 23:59:48 -08:00
vmray: clean up VMRayAnalysis
This commit is contained in:
@@ -21,7 +21,7 @@ class VMRayAnalysis:
|
|||||||
|
|
||||||
self.sample_file_name: str
|
self.sample_file_name: str
|
||||||
self.sample_file_analysis: File
|
self.sample_file_analysis: File
|
||||||
self.sample_file_static_data: Optional[StaticData]
|
self.sample_file_static_data: StaticData
|
||||||
|
|
||||||
self._find_sample_file()
|
self._find_sample_file()
|
||||||
self._compute_base_address()
|
self._compute_base_address()
|
||||||
@@ -36,16 +36,16 @@ class VMRayAnalysis:
|
|||||||
self.sample_file_analysis = file_analysis
|
self.sample_file_analysis = file_analysis
|
||||||
|
|
||||||
if file_analysis.ref_static_data:
|
if file_analysis.ref_static_data:
|
||||||
self.sample_file_static_data = self.sv2.static_data.get(file_analysis.ref_static_data.path[1])
|
self.sample_file_static_data = self.sv2.static_data[file_analysis.ref_static_data.path[1]]
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
def _compute_base_address(self):
|
def _compute_base_address(self):
|
||||||
if self.sample_file_static_data and self.sample_file_static_data.pe:
|
if self.sample_file_static_data.pe:
|
||||||
self.base_address = self.sample_file_static_data.pe.basic_info.image_base
|
self.base_address = self.sample_file_static_data.pe.basic_info.image_base
|
||||||
|
|
||||||
def _compute_exports(self):
|
def _compute_exports(self):
|
||||||
if self.sample_file_static_data and self.sample_file_static_data.pe:
|
if self.sample_file_static_data.pe:
|
||||||
for export in self.sample_file_static_data.pe.exports:
|
for export in self.sample_file_static_data.pe.exports:
|
||||||
self.exports[export.address] = export.api.name
|
self.exports[export.address] = export.api.name
|
||||||
|
|
||||||
@@ -54,6 +54,6 @@ class VMRayAnalysis:
|
|||||||
...
|
...
|
||||||
|
|
||||||
def _compute_sections(self):
|
def _compute_sections(self):
|
||||||
if self.sample_file_static_data and self.sample_file_static_data.pe:
|
if self.sample_file_static_data.pe:
|
||||||
for section in self.sample_file_static_data.pe.sections:
|
for section in self.sample_file_static_data.pe.sections:
|
||||||
self.sections[section.virtual_address] = section.name
|
self.sections[section.virtual_address] = section.name
|
||||||
|
|||||||
@@ -55,4 +55,4 @@ if __name__ == "__main__":
|
|||||||
for feat, addr in extractor.extract_file_features():
|
for feat, addr in extractor.extract_file_features():
|
||||||
print(f"{feat} -> {addr}")
|
print(f"{feat} -> {addr}")
|
||||||
|
|
||||||
print(f"base address: {hex(extractor.get_base_address())}")
|
print(f"base address: {hex(extractor.get_base_address())}")
|
||||||
|
|||||||
Reference in New Issue
Block a user