mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
vmray: improve logging
This commit is contained in:
@@ -39,7 +39,7 @@ class VMRayAnalysis:
|
||||
|
||||
if self.flog.analysis.log_version not in SUPPORTED_FLOG_VERSIONS:
|
||||
raise UnsupportedFormatError(
|
||||
"VMRay feature extractor does not support flog version %s", self.flog.analysis.log_version
|
||||
"VMRay feature extractor does not support flog version %s" % self.flog.analysis.log_version
|
||||
)
|
||||
|
||||
self.exports: Dict[int, str] = {}
|
||||
@@ -57,14 +57,14 @@ class VMRayAnalysis:
|
||||
self._find_sample_file()
|
||||
|
||||
if self.sample_file_name is None or self.sample_file_analysis is None:
|
||||
raise UnsupportedFormatError("VMRay archive does not contain sample file (file_type: %s)", self.file_type)
|
||||
raise UnsupportedFormatError("VMRay archive does not contain sample file (file_type: %s)" % self.file_type)
|
||||
|
||||
if not self.sample_file_static_data:
|
||||
raise UnsupportedFormatError("VMRay archive does not contain static data (file_type: %s)", self.file_type)
|
||||
raise UnsupportedFormatError("VMRay archive does not contain static data (file_type: %s)" % self.file_type)
|
||||
|
||||
if not self.sample_file_static_data.pe and not self.sample_file_static_data.elf:
|
||||
raise UnsupportedFormatError(
|
||||
"VMRay feature extractor only supports PE and ELF at this time (file_type: %s)", self.file_type
|
||||
"VMRay feature extractor only supports PE and ELF at this time (file_type: %s)" % self.file_type
|
||||
)
|
||||
|
||||
# VMRay does not store static strings for the sample file so we must use the source file
|
||||
|
||||
@@ -35,8 +35,7 @@ def extract_arch(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
||||
elif "x86-64" in file_type:
|
||||
yield Arch(ARCH_AMD64), NO_ADDRESS
|
||||
else:
|
||||
logger.warning("unrecognized arch: %s", file_type)
|
||||
raise ValueError(f"unrecognized arch from the VMRay report: {file_type}")
|
||||
raise ValueError("unrecognized arch from the VMRay report: %s" % file_type)
|
||||
|
||||
|
||||
def extract_format(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
||||
@@ -46,8 +45,7 @@ def extract_format(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]
|
||||
elif analysis.sample_file_static_data.elf:
|
||||
yield Format(FORMAT_ELF), NO_ADDRESS
|
||||
else:
|
||||
logger.warning("unrecognized file format: %s", analysis.file_type)
|
||||
raise ValueError(f"unrecognized file format from the VMRay report: {analysis.file_type}")
|
||||
raise ValueError("unrecognized file format from the VMRay report: %s" % analysis.file_type)
|
||||
|
||||
|
||||
def extract_os(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
||||
@@ -58,8 +56,7 @@ def extract_os(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
||||
elif "linux" in file_type.lower():
|
||||
yield OS(OS_LINUX), NO_ADDRESS
|
||||
else:
|
||||
logger.warning("unrecognized OS: %s", file_type)
|
||||
raise ValueError(f"unrecognized OS from the VMRay report: {file_type}")
|
||||
raise ValueError("unrecognized OS from the VMRay report: %s" % file_type)
|
||||
|
||||
|
||||
def extract_features(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
||||
|
||||
Reference in New Issue
Block a user