diff --git a/docker-compose.yml b/docker-compose.yml index 413dcc3..367244a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" diff --git a/scanners/capa/config.py b/scanners/capa/config.py index 1cffe4f..2cfae14 100644 --- a/scanners/capa/config.py +++ b/scanners/capa/config.py @@ -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): diff --git a/scanners/capa/routes/capa.py b/scanners/capa/routes/capa.py index 9e73cd7..6b96ed6 100644 --- a/scanners/capa/routes/capa.py +++ b/scanners/capa/routes/capa.py @@ -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)