mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 11:07:53 -08:00
colton: developing ghidra backend tests
This commit is contained in:
@@ -1333,6 +1333,7 @@ def ghidra_main():
|
||||
|
||||
globl_features: List[Tuple[Feature, Address]] = []
|
||||
globl_features.extend(capa.features.extractors.ghidra.global_.extract_os())
|
||||
globl_features.extend(capa.features.extractors.ghidra.global_.extract_arch())
|
||||
print(globl_features)
|
||||
|
||||
|
||||
|
||||
25
tests/test_ghidra_features.py
Normal file
25
tests/test_ghidra_features.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import logging
|
||||
|
||||
import fixtures
|
||||
from fixtures import *
|
||||
|
||||
import capa.main
|
||||
|
||||
logger = logging.getLogger(__file__)
|
||||
|
||||
# We need to skip the ghidra test if we cannot import ghidra modules, e.g., in GitHub CI.
|
||||
ghidra_present: bool = False
|
||||
try:
|
||||
import ghidra.program.flatapi as flatapi
|
||||
ghidraapi = flatapi.FlatProgramAPI(currentProgram)
|
||||
|
||||
try:
|
||||
current_program_test = ghidraapi.getCurrentProgram()
|
||||
except RuntimeError as e:
|
||||
logger.warning("Ghidra runtime not detected")
|
||||
else:
|
||||
ghidra_present = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user