continued work on capa scanner

This commit is contained in:
Johannes Bülow 2025-06-17 17:05:28 +02:00
parent 27d99b0aac
commit 2581f7ed27
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
3 changed files with 8 additions and 3 deletions

View file

@ -11,5 +11,10 @@ services:
- "5000:5000"
volumes:
- "./storage/files:/mnt/storage/files"
capa:
build: ./scanners/capa/Dockerfile
ports:
- "5001:5001"
volumes:
- "./storage/files:/mnt/storage/files"

View file

@ -6,6 +6,7 @@ class Config:
HOST = os.environ.get("HOST", "127.0.0.1")
PORT = int(os.environ.get("PORT", 5000))
DEBUG = os.environ.get("DEBUG", "False").lower() in ("true", "1")
RULES = os.environ.get("RULES", "/usr/local/share/capa-rules/")
# Ensure upload directory exists
if not os.path.exists(Config.FILE_DIRECTORY):

View file

@ -24,8 +24,7 @@ def analyze_capa():
print(f"Error: File not found at '{filepath}'")
abort(400)
rules = capa.rules.get_rules([capa.main.get_default_root()/ "rules"])
rules = capa.rules.get_rules([Path(config.Config.RULES)])
extractor = capa.loader.get_extractor(filepath, FORMAT_AUTO, OS_AUTO, capa.main.BACKEND_VIV, [], should_save_workspace=False, disable_progress=True)
capabilities = capa.capabilities.common.find_capabilities(rules, extractor, disable_progress=True)