mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
vmray: fix flake8 lints
This commit is contained in:
@@ -59,7 +59,7 @@ class VMRayAnalysis:
|
|||||||
self.exports[export.address] = export.api.name
|
self.exports[export.address] = export.api.name
|
||||||
|
|
||||||
def _compute_imports(self):
|
def _compute_imports(self):
|
||||||
# TODO (meh)
|
# TODO (meh): https://github.com/mandiant/capa/issues/2148
|
||||||
...
|
...
|
||||||
|
|
||||||
def _compute_sections(self):
|
def _compute_sections(self):
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
# Copyright (C) 2024 Mandiant, Inc. All Rights Reserved.
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at: [package root]/LICENSE.txt
|
||||||
|
# Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||||
|
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and limitations under the License.
|
||||||
import logging
|
import logging
|
||||||
from typing import Tuple, Iterator
|
from typing import Tuple, Iterator
|
||||||
|
|
||||||
@@ -21,7 +28,7 @@ def extract_call_features(ph: ProcessHandle, th: ThreadHandle, ch: CallHandle) -
|
|||||||
yields: Feature, address; where Feature is either: API, Number, or String.
|
yields: Feature, address; where Feature is either: API, Number, or String.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO update for new models
|
# TODO (meh): update for new models https://github.com/mandiant/capa/issues/2148
|
||||||
# print(ch)
|
# print(ch)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class VMRayExtractor(DynamicFeatureExtractor):
|
|||||||
yield from capa.features.extractors.vmray.file.get_processes(self.analysis)
|
yield from capa.features.extractors.vmray.file.get_processes(self.analysis)
|
||||||
|
|
||||||
def extract_process_features(self, ph: ProcessHandle) -> Iterator[Tuple[Feature, Address]]:
|
def extract_process_features(self, ph: ProcessHandle) -> Iterator[Tuple[Feature, Address]]:
|
||||||
# TODO (meh)
|
# TODO (meh): https://github.com/mandiant/capa/issues/2148
|
||||||
yield from []
|
yield from []
|
||||||
|
|
||||||
def get_process_name(self, ph) -> str:
|
def get_process_name(self, ph) -> str:
|
||||||
@@ -89,7 +89,7 @@ class VMRayExtractor(DynamicFeatureExtractor):
|
|||||||
yield from capa.features.extractors.vmray.call.extract_features(ph, th, ch)
|
yield from capa.features.extractors.vmray.call.extract_features(ph, th, ch)
|
||||||
|
|
||||||
def get_call_name(self, ph, th, ch) -> str:
|
def get_call_name(self, ph, th, ch) -> str:
|
||||||
# TODO (meh)
|
# TODO (meh): https://github.com/mandiant/capa/issues/2148
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def get_processes(analysis: VMRayAnalysis) -> Iterator[ProcessHandle]:
|
|||||||
processes: Dict[str, Process] = analysis.sv2.processes
|
processes: Dict[str, Process] = analysis.sv2.processes
|
||||||
|
|
||||||
for _, process in processes.items():
|
for _, process in processes.items():
|
||||||
# TODO (meh) should we use the OS process ID or vmray-assigned ID?
|
# TODO (meh): should we use the OS process ID or vmray-assigned ID? https://github.com/mandiant/capa/issues/2148
|
||||||
pid = process.monitor_id
|
pid = process.monitor_id
|
||||||
ppid = processes[process.ref_parent_process.path[1]].monitor_id if process.ref_parent_process else 0
|
ppid = processes[process.ref_parent_process.path[1]].monitor_id if process.ref_parent_process else 0
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ def extract_export_names(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Add
|
|||||||
|
|
||||||
|
|
||||||
def extract_import_names(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
def extract_import_names(analysis: VMRayAnalysis) -> Iterator[Tuple[Feature, Address]]:
|
||||||
# TODO (meh)
|
# TODO (meh): https://github.com/mandiant/capa/issues/2148
|
||||||
yield from []
|
yield from []
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from typing import Dict, List, Optional
|
|||||||
from pydantic import Field, BaseModel
|
from pydantic import Field, BaseModel
|
||||||
|
|
||||||
|
|
||||||
### models flog.xml files
|
# models flog.xml files
|
||||||
class FunctionCall(BaseModel):
|
class FunctionCall(BaseModel):
|
||||||
ts: str
|
ts: str
|
||||||
fncall_id: str
|
fncall_id: str
|
||||||
@@ -42,7 +42,7 @@ class Flog(BaseModel):
|
|||||||
analysis: Analysis
|
analysis: Analysis
|
||||||
|
|
||||||
|
|
||||||
### models for summary_v2.json files
|
# models for summary_v2.json files
|
||||||
class GenericReference(BaseModel):
|
class GenericReference(BaseModel):
|
||||||
path: List[str]
|
path: List[str]
|
||||||
source: str
|
source: str
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ def print_dynamic_features(processes, extractor: DynamicFeatureExtractor):
|
|||||||
for p in processes:
|
for p in processes:
|
||||||
print(f"proc: {extractor.get_process_name(p)} (ppid={p.address.ppid}, pid={p.address.pid})")
|
print(f"proc: {extractor.get_process_name(p)} (ppid={p.address.ppid}, pid={p.address.pid})")
|
||||||
|
|
||||||
for feature, addr in extractor.extract_process_features(p):
|
for feature, _ in extractor.extract_process_features(p):
|
||||||
if is_global_feature(feature):
|
if is_global_feature(feature):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user