2025-08-08 20:36:44 -07:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
"""
|
2025-10-29 06:14:08 +03:00
|
|
|
Strix Agent Interface
|
2025-08-08 20:36:44 -07:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
import asyncio
|
2026-06-08 00:11:49 +03:00
|
|
|
import contextlib
|
2025-08-15 13:02:39 -07:00
|
|
|
import shutil
|
2025-08-08 20:36:44 -07:00
|
|
|
import sys
|
2026-04-26 15:01:35 -07:00
|
|
|
from datetime import UTC, datetime
|
2025-08-08 20:36:44 -07:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
2026-04-26 14:04:32 -07:00
|
|
|
from agents.model_settings import ModelSettings
|
|
|
|
|
from agents.models.interface import ModelTracing
|
|
|
|
|
from agents.models.multi_provider import MultiProvider
|
2025-08-08 20:36:44 -07:00
|
|
|
from docker.errors import DockerException
|
|
|
|
|
from rich.console import Console
|
|
|
|
|
from rich.panel import Panel
|
|
|
|
|
from rich.text import Text
|
|
|
|
|
|
2026-04-26 14:04:32 -07:00
|
|
|
from strix.config import (
|
|
|
|
|
apply_config_override,
|
|
|
|
|
load_settings,
|
|
|
|
|
persist_current,
|
|
|
|
|
)
|
|
|
|
|
from strix.config.models import configure_sdk_model_defaults, normalize_model_name
|
2026-04-26 15:01:35 -07:00
|
|
|
from strix.core.paths import run_dir_for, runtime_state_dir
|
2026-04-25 16:05:40 -07:00
|
|
|
from strix.interface.cli import run_cli
|
|
|
|
|
from strix.interface.tui import run_tui
|
|
|
|
|
from strix.interface.utils import (
|
2025-11-01 01:25:07 +02:00
|
|
|
assign_workspace_subdirs,
|
2025-11-25 13:06:20 +01:00
|
|
|
build_final_stats_text,
|
2025-11-01 01:25:07 +02:00
|
|
|
check_docker_connection,
|
|
|
|
|
clone_repository,
|
|
|
|
|
collect_local_sources,
|
|
|
|
|
generate_run_name,
|
|
|
|
|
image_exists,
|
|
|
|
|
infer_target_type,
|
2026-04-25 16:05:40 -07:00
|
|
|
is_whitebox_scan,
|
2025-11-01 01:25:07 +02:00
|
|
|
process_pull_line,
|
2026-03-31 14:53:49 -04:00
|
|
|
resolve_diff_scope_context,
|
2026-01-07 11:45:07 -08:00
|
|
|
rewrite_localhost_targets,
|
2026-01-20 16:39:35 -08:00
|
|
|
validate_config_file,
|
2025-11-01 01:25:07 +02:00
|
|
|
)
|
2026-04-26 14:28:50 -07:00
|
|
|
from strix.report.state import get_global_report_state
|
2026-04-26 15:01:35 -07:00
|
|
|
from strix.report.writer import read_run_record, write_run_record
|
2026-05-25 23:22:01 -07:00
|
|
|
from strix.telemetry import posthog, scarf
|
2026-04-26 14:04:32 -07:00
|
|
|
from strix.telemetry.logging import configure_dependency_logging
|
2026-04-25 09:30:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
HOST_GATEWAY_HOSTNAME = "host.docker.internal"
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
|
2026-04-25 23:43:19 -07:00
|
|
|
import logging # noqa: E402
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
|
2026-04-25 09:30:23 -07:00
|
|
|
def validate_environment() -> None:
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.info("Validating environment")
|
2025-08-08 20:36:44 -07:00
|
|
|
console = Console()
|
|
|
|
|
missing_required_vars = []
|
|
|
|
|
missing_optional_vars = []
|
|
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
settings = load_settings()
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
if not settings.llm.model:
|
|
|
|
|
missing_required_vars.append("STRIX_LLM")
|
2025-09-24 22:32:58 +03:00
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
if not settings.llm.api_key:
|
2025-12-07 02:07:28 +02:00
|
|
|
missing_optional_vars.append("LLM_API_KEY")
|
2025-09-24 22:32:58 +03:00
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
if not settings.llm.api_base:
|
2025-09-24 22:32:58 +03:00
|
|
|
missing_optional_vars.append("LLM_API_BASE")
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
if not settings.integrations.perplexity_api_key:
|
2025-08-08 20:36:44 -07:00
|
|
|
missing_optional_vars.append("PERPLEXITY_API_KEY")
|
|
|
|
|
|
|
|
|
|
if missing_required_vars:
|
|
|
|
|
error_text = Text()
|
|
|
|
|
error_text.append("MISSING REQUIRED ENVIRONMENT VARIABLES", style="bold red")
|
|
|
|
|
error_text.append("\n\n", style="white")
|
|
|
|
|
|
|
|
|
|
for var in missing_required_vars:
|
|
|
|
|
error_text.append(f"• {var}", style="bold yellow")
|
|
|
|
|
error_text.append(" is not set\n", style="white")
|
|
|
|
|
|
|
|
|
|
if missing_optional_vars:
|
2025-09-24 22:32:58 +03:00
|
|
|
error_text.append("\nOptional environment variables:\n", style="dim white")
|
2025-08-08 20:36:44 -07:00
|
|
|
for var in missing_optional_vars:
|
|
|
|
|
error_text.append(f"• {var}", style="dim yellow")
|
|
|
|
|
error_text.append(" is not set\n", style="dim white")
|
|
|
|
|
|
|
|
|
|
error_text.append("\nRequired environment variables:\n", style="white")
|
2025-09-24 22:32:58 +03:00
|
|
|
for var in missing_required_vars:
|
|
|
|
|
if var == "STRIX_LLM":
|
|
|
|
|
error_text.append("• ", style="white")
|
|
|
|
|
error_text.append("STRIX_LLM", style="bold cyan")
|
|
|
|
|
error_text.append(
|
2026-04-26 14:04:32 -07:00
|
|
|
" - Model name to use (e.g., 'gpt-5.4' or 'claude-sonnet-4-6')\n",
|
2025-09-24 22:32:58 +03:00
|
|
|
style="white",
|
|
|
|
|
)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
if missing_optional_vars:
|
|
|
|
|
error_text.append("\nOptional environment variables:\n", style="white")
|
2025-09-24 22:32:58 +03:00
|
|
|
for var in missing_optional_vars:
|
|
|
|
|
if var == "LLM_API_KEY":
|
|
|
|
|
error_text.append("• ", style="white")
|
|
|
|
|
error_text.append("LLM_API_KEY", style="bold cyan")
|
2025-12-07 02:07:28 +02:00
|
|
|
error_text.append(
|
2025-12-07 17:54:32 +02:00
|
|
|
" - API key for the LLM provider "
|
|
|
|
|
"(not needed for local models, Vertex AI, AWS, etc.)\n",
|
2025-12-07 02:07:28 +02:00
|
|
|
style="white",
|
|
|
|
|
)
|
2025-09-24 22:32:58 +03:00
|
|
|
elif var == "LLM_API_BASE":
|
|
|
|
|
error_text.append("• ", style="white")
|
|
|
|
|
error_text.append("LLM_API_BASE", style="bold cyan")
|
|
|
|
|
error_text.append(
|
|
|
|
|
" - Custom API base URL if using local models (e.g., Ollama, LMStudio)\n",
|
|
|
|
|
style="white",
|
|
|
|
|
)
|
|
|
|
|
elif var == "PERPLEXITY_API_KEY":
|
|
|
|
|
error_text.append("• ", style="white")
|
|
|
|
|
error_text.append("PERPLEXITY_API_KEY", style="bold cyan")
|
|
|
|
|
error_text.append(
|
|
|
|
|
" - API key for Perplexity AI web search (enables real-time research)\n",
|
|
|
|
|
style="white",
|
|
|
|
|
)
|
2026-01-09 19:35:01 -08:00
|
|
|
elif var == "STRIX_REASONING_EFFORT":
|
|
|
|
|
error_text.append("• ", style="white")
|
|
|
|
|
error_text.append("STRIX_REASONING_EFFORT", style="bold cyan")
|
|
|
|
|
error_text.append(
|
2026-01-09 20:17:46 -08:00
|
|
|
" - Reasoning effort level: none, minimal, low, medium, high, xhigh "
|
|
|
|
|
"(default: high)\n",
|
2026-01-09 19:35:01 -08:00
|
|
|
style="white",
|
|
|
|
|
)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
error_text.append("\nExample setup:\n", style="white")
|
2026-04-26 14:04:32 -07:00
|
|
|
error_text.append("export STRIX_LLM='gpt-5.4'\n", style="dim white")
|
2025-09-24 22:32:58 +03:00
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
if missing_optional_vars:
|
2025-09-24 22:32:58 +03:00
|
|
|
for var in missing_optional_vars:
|
|
|
|
|
if var == "LLM_API_KEY":
|
|
|
|
|
error_text.append(
|
2025-12-07 17:54:32 +02:00
|
|
|
"export LLM_API_KEY='your-api-key-here' "
|
|
|
|
|
"# not needed for local models, Vertex AI, AWS, etc.\n",
|
2025-09-24 22:32:58 +03:00
|
|
|
style="dim white",
|
|
|
|
|
)
|
|
|
|
|
elif var == "LLM_API_BASE":
|
|
|
|
|
error_text.append(
|
2025-10-10 02:41:42 -07:00
|
|
|
"export LLM_API_BASE='http://localhost:11434' "
|
|
|
|
|
"# needed for local models only\n",
|
2025-09-24 22:32:58 +03:00
|
|
|
style="dim white",
|
|
|
|
|
)
|
|
|
|
|
elif var == "PERPLEXITY_API_KEY":
|
|
|
|
|
error_text.append(
|
|
|
|
|
"export PERPLEXITY_API_KEY='your-perplexity-key-here'\n", style="dim white"
|
|
|
|
|
)
|
2026-01-09 19:35:01 -08:00
|
|
|
elif var == "STRIX_REASONING_EFFORT":
|
|
|
|
|
error_text.append(
|
|
|
|
|
"export STRIX_REASONING_EFFORT='high'\n",
|
|
|
|
|
style="dim white",
|
|
|
|
|
)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
panel = Panel(
|
|
|
|
|
error_text,
|
2026-01-19 16:42:38 -08:00
|
|
|
title="[bold white]STRIX",
|
|
|
|
|
title_align="left",
|
2025-08-08 20:36:44 -07:00
|
|
|
border_style="red",
|
|
|
|
|
padding=(1, 2),
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.error("Missing required env vars: %s", missing_required_vars)
|
2025-08-08 20:36:44 -07:00
|
|
|
console.print("\n")
|
|
|
|
|
console.print(panel)
|
|
|
|
|
console.print()
|
|
|
|
|
sys.exit(1)
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.info(
|
|
|
|
|
"Environment OK (optional missing: %s)",
|
|
|
|
|
missing_optional_vars or "none",
|
|
|
|
|
)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
|
2025-08-11 18:00:24 -07:00
|
|
|
def check_docker_installed() -> None:
|
|
|
|
|
if shutil.which("docker") is None:
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.error("Docker CLI not found in PATH")
|
2025-08-11 18:00:24 -07:00
|
|
|
console = Console()
|
|
|
|
|
error_text = Text()
|
|
|
|
|
error_text.append("DOCKER NOT INSTALLED", style="bold red")
|
|
|
|
|
error_text.append("\n\n", style="white")
|
|
|
|
|
error_text.append("The 'docker' CLI was not found in your PATH.\n", style="white")
|
2025-08-15 13:02:39 -07:00
|
|
|
error_text.append(
|
|
|
|
|
"Please install Docker and ensure the 'docker' command is available.\n\n", style="white"
|
|
|
|
|
)
|
2025-08-11 18:00:24 -07:00
|
|
|
|
|
|
|
|
panel = Panel(
|
|
|
|
|
error_text,
|
2026-01-19 16:42:38 -08:00
|
|
|
title="[bold white]STRIX",
|
|
|
|
|
title_align="left",
|
2025-08-11 18:00:24 -07:00
|
|
|
border_style="red",
|
|
|
|
|
padding=(1, 2),
|
|
|
|
|
)
|
|
|
|
|
console.print("\n", panel, "\n")
|
|
|
|
|
sys.exit(1)
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.debug("Docker CLI present")
|
2025-08-11 18:00:24 -07:00
|
|
|
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
async def warm_up_llm() -> None:
|
|
|
|
|
console = Console()
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.info("Warming up LLM connection")
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
try:
|
2026-04-26 14:04:32 -07:00
|
|
|
settings = load_settings()
|
|
|
|
|
configure_sdk_model_defaults(settings)
|
|
|
|
|
llm = settings.llm
|
|
|
|
|
|
|
|
|
|
model = MultiProvider().get_model(normalize_model_name(llm.model or ""))
|
|
|
|
|
await asyncio.wait_for(
|
|
|
|
|
model.get_response(
|
|
|
|
|
system_instructions="You are a helpful assistant.",
|
|
|
|
|
input="Reply with just 'OK'.",
|
|
|
|
|
model_settings=ModelSettings(),
|
|
|
|
|
tools=[],
|
|
|
|
|
output_schema=None,
|
|
|
|
|
handoffs=[],
|
|
|
|
|
tracing=ModelTracing.DISABLED,
|
|
|
|
|
previous_response_id=None,
|
|
|
|
|
conversation_id=None,
|
|
|
|
|
prompt=None,
|
|
|
|
|
),
|
|
|
|
|
timeout=llm.timeout,
|
|
|
|
|
)
|
|
|
|
|
logger.info("LLM warm-up succeeded for model %s", normalize_model_name(llm.model or ""))
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-25 09:30:23 -07:00
|
|
|
except Exception as e:
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.exception("LLM warm-up failed")
|
2025-08-08 20:36:44 -07:00
|
|
|
error_text = Text()
|
|
|
|
|
error_text.append("LLM CONNECTION FAILED", style="bold red")
|
|
|
|
|
error_text.append("\n\n", style="white")
|
|
|
|
|
error_text.append("Could not establish connection to the language model.\n", style="white")
|
|
|
|
|
error_text.append("Please check your configuration and try again.\n", style="white")
|
|
|
|
|
error_text.append(f"\nError: {e}", style="dim white")
|
|
|
|
|
|
2026-06-08 00:11:49 +03:00
|
|
|
raw_model = ""
|
|
|
|
|
resolved = ""
|
|
|
|
|
with contextlib.suppress(Exception):
|
|
|
|
|
raw_model = (load_settings().llm.model or "").strip()
|
|
|
|
|
resolved = normalize_model_name(raw_model)
|
|
|
|
|
err_lc = str(e).lower()
|
|
|
|
|
unprefixed = bool(resolved) and "/" not in resolved
|
|
|
|
|
looks_openai = "platform.openai.com" in err_lc or "openai" in err_lc
|
|
|
|
|
if unprefixed and looks_openai:
|
|
|
|
|
error_text.append(
|
|
|
|
|
f"\n\nHint: '{raw_model}' has no provider prefix, so the SDK "
|
|
|
|
|
f"routed it through OpenAI by default. For non-OpenAI providers "
|
|
|
|
|
f"use the '<provider>/<model>' form, e.g. "
|
|
|
|
|
f"'deepseek/deepseek-chat', 'groq/llama-3.1-70b', "
|
|
|
|
|
f"'anthropic/claude-3-5-sonnet'.",
|
|
|
|
|
style="yellow",
|
|
|
|
|
)
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
panel = Panel(
|
|
|
|
|
error_text,
|
2026-01-19 16:42:38 -08:00
|
|
|
title="[bold white]STRIX",
|
|
|
|
|
title_align="left",
|
2025-08-08 20:36:44 -07:00
|
|
|
border_style="red",
|
|
|
|
|
padding=(1, 2),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
console.print("\n")
|
|
|
|
|
console.print(panel)
|
|
|
|
|
console.print()
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
2025-12-07 14:35:08 +02:00
|
|
|
def get_version() -> str:
|
|
|
|
|
try:
|
|
|
|
|
from importlib.metadata import version
|
|
|
|
|
|
|
|
|
|
return version("strix-agent")
|
2026-04-25 09:30:23 -07:00
|
|
|
except Exception:
|
2025-12-07 14:35:08 +02:00
|
|
|
return "unknown"
|
|
|
|
|
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
def parse_arguments() -> argparse.Namespace:
|
|
|
|
|
parser = argparse.ArgumentParser(
|
2025-10-29 06:14:08 +03:00
|
|
|
description="Strix Multi-Agent Cybersecurity Penetration Testing Tool",
|
2025-08-08 20:36:44 -07:00
|
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
|
|
|
epilog="""
|
|
|
|
|
Examples:
|
2025-10-29 06:14:08 +03:00
|
|
|
# Web application penetration test
|
2025-08-08 20:36:44 -07:00
|
|
|
strix --target https://example.com
|
|
|
|
|
|
|
|
|
|
# GitHub repository analysis
|
|
|
|
|
strix --target https://github.com/user/repo
|
|
|
|
|
strix --target git@github.com:user/repo.git
|
|
|
|
|
|
|
|
|
|
# Local code analysis
|
|
|
|
|
strix --target ./my-project
|
|
|
|
|
|
2025-10-29 06:14:08 +03:00
|
|
|
# Domain penetration test
|
2025-08-08 20:36:44 -07:00
|
|
|
strix --target example.com
|
|
|
|
|
|
2025-11-14 01:35:27 +04:00
|
|
|
# IP address penetration test
|
|
|
|
|
strix --target 192.168.1.42
|
|
|
|
|
|
2025-11-01 01:25:07 +02:00
|
|
|
# Multiple targets (e.g., white-box testing with source and deployed app)
|
|
|
|
|
strix --target https://github.com/user/repo --target https://example.com
|
|
|
|
|
strix --target ./my-project --target https://staging.example.com --target https://prod.example.com
|
|
|
|
|
|
2025-11-23 00:41:37 +04:00
|
|
|
# Custom instructions (inline)
|
2025-08-08 20:36:44 -07:00
|
|
|
strix --target example.com --instruction "Focus on authentication vulnerabilities"
|
2025-11-23 00:41:37 +04:00
|
|
|
|
|
|
|
|
# Custom instructions (from file)
|
2025-12-08 20:23:51 +01:00
|
|
|
strix --target example.com --instruction-file ./instructions.txt
|
|
|
|
|
strix --target https://app.com --instruction-file /path/to/detailed_instructions.md
|
2025-08-08 20:36:44 -07:00
|
|
|
""",
|
|
|
|
|
)
|
|
|
|
|
|
2025-12-07 14:35:08 +02:00
|
|
|
parser.add_argument(
|
|
|
|
|
"-v",
|
|
|
|
|
"--version",
|
|
|
|
|
action="version",
|
|
|
|
|
version=f"strix {get_version()}",
|
|
|
|
|
)
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
parser.add_argument(
|
2025-11-01 01:25:07 +02:00
|
|
|
"-t",
|
2025-08-08 20:36:44 -07:00
|
|
|
"--target",
|
|
|
|
|
type=str,
|
2025-11-01 01:25:07 +02:00
|
|
|
action="append",
|
2025-11-14 01:35:27 +04:00
|
|
|
help="Target to test (URL, repository, local directory path, domain name, or IP address). "
|
2026-04-26 00:43:22 -07:00
|
|
|
"Can be specified multiple times for multi-target scans. "
|
|
|
|
|
"Required for fresh runs; loaded from disk when ``--resume`` is set.",
|
2025-08-08 20:36:44 -07:00
|
|
|
)
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--instruction",
|
|
|
|
|
type=str,
|
2025-10-29 06:14:08 +03:00
|
|
|
help="Custom instructions for the penetration test. This can be "
|
2025-08-08 20:36:44 -07:00
|
|
|
"specific vulnerability types to focus on (e.g., 'Focus on IDOR and XSS'), "
|
|
|
|
|
"testing approaches (e.g., 'Perform thorough authentication testing'), "
|
|
|
|
|
"test credentials (e.g., 'Use the following credentials to access the app: "
|
|
|
|
|
"admin:password123'), "
|
2025-12-08 20:23:51 +01:00
|
|
|
"or areas of interest (e.g., 'Check login API endpoint for security issues').",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--instruction-file",
|
|
|
|
|
type=str,
|
|
|
|
|
help="Path to a file containing detailed custom instructions for the penetration test. "
|
|
|
|
|
"Use this option when you have lengthy or complex instructions saved in a file "
|
|
|
|
|
"(e.g., '--instruction-file ./detailed_instructions.txt').",
|
2025-08-08 20:36:44 -07:00
|
|
|
)
|
|
|
|
|
|
2025-10-29 06:14:08 +03:00
|
|
|
parser.add_argument(
|
|
|
|
|
"-n",
|
|
|
|
|
"--non-interactive",
|
|
|
|
|
action="store_true",
|
|
|
|
|
help=(
|
|
|
|
|
"Run in non-interactive mode (no TUI, exits on completion). "
|
|
|
|
|
"Default is interactive mode with TUI."
|
|
|
|
|
),
|
2025-08-08 20:36:44 -07:00
|
|
|
)
|
|
|
|
|
|
2025-12-14 19:05:00 -08:00
|
|
|
parser.add_argument(
|
|
|
|
|
"-m",
|
|
|
|
|
"--scan-mode",
|
|
|
|
|
type=str,
|
|
|
|
|
choices=["quick", "standard", "deep"],
|
|
|
|
|
default="deep",
|
|
|
|
|
help=(
|
|
|
|
|
"Scan mode: "
|
|
|
|
|
"'quick' for fast CI/CD checks, "
|
|
|
|
|
"'standard' for routine testing, "
|
|
|
|
|
"'deep' for thorough security reviews (default). "
|
|
|
|
|
"Default: deep."
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-31 14:53:49 -04:00
|
|
|
parser.add_argument(
|
|
|
|
|
"--scope-mode",
|
|
|
|
|
type=str,
|
|
|
|
|
choices=["auto", "diff", "full"],
|
|
|
|
|
default="auto",
|
|
|
|
|
help=(
|
|
|
|
|
"Scope mode for code targets: "
|
|
|
|
|
"'auto' enables PR diff-scope in CI/headless runs, "
|
|
|
|
|
"'diff' forces changed-files scope, "
|
|
|
|
|
"'full' disables diff-scope."
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--diff-base",
|
|
|
|
|
type=str,
|
|
|
|
|
help=(
|
|
|
|
|
"Target branch or commit to compare against (e.g., origin/main). "
|
|
|
|
|
"Defaults to the repository's default branch."
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2026-01-20 10:18:42 +01:00
|
|
|
parser.add_argument(
|
|
|
|
|
"--config",
|
|
|
|
|
type=str,
|
2026-01-20 16:39:35 -08:00
|
|
|
help="Path to a custom config file (JSON) to use instead of ~/.strix/cli-config.json",
|
2026-01-20 10:18:42 +01:00
|
|
|
)
|
|
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
parser.add_argument(
|
|
|
|
|
"--resume",
|
|
|
|
|
type=str,
|
|
|
|
|
metavar="RUN_NAME",
|
|
|
|
|
help=(
|
|
|
|
|
"Resume a prior scan by its run name (the dir under ./strix_runs/). "
|
|
|
|
|
"Picks up the root + every non-terminal subagent's full LLM history "
|
2026-04-26 09:30:13 -07:00
|
|
|
"and agent topology. Skips fresh run-name generation."
|
2026-04-26 00:43:22 -07:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
2025-12-08 20:23:51 +01:00
|
|
|
if args.instruction and args.instruction_file:
|
2025-12-14 10:16:02 -08:00
|
|
|
parser.error(
|
|
|
|
|
"Cannot specify both --instruction and --instruction-file. Use one or the other."
|
|
|
|
|
)
|
2025-12-08 20:23:51 +01:00
|
|
|
|
|
|
|
|
if args.instruction_file:
|
|
|
|
|
instruction_path = Path(args.instruction_file)
|
|
|
|
|
try:
|
|
|
|
|
with instruction_path.open(encoding="utf-8") as f:
|
|
|
|
|
args.instruction = f.read().strip()
|
|
|
|
|
if not args.instruction:
|
|
|
|
|
parser.error(f"Instruction file '{instruction_path}' is empty")
|
2026-04-25 09:30:23 -07:00
|
|
|
except Exception as e:
|
2025-12-08 20:23:51 +01:00
|
|
|
parser.error(f"Failed to read instruction file '{instruction_path}': {e}")
|
2025-11-23 00:41:37 +04:00
|
|
|
|
2026-04-26 00:57:52 -07:00
|
|
|
args.user_explicit_instruction = args.instruction if args.resume else None
|
|
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
if args.resume:
|
|
|
|
|
if args.target:
|
|
|
|
|
parser.error(
|
|
|
|
|
"Cannot combine --resume with --target. --resume picks up where "
|
|
|
|
|
"the prior run left off, including the original target list."
|
2025-08-08 20:36:44 -07:00
|
|
|
)
|
2026-04-26 00:43:22 -07:00
|
|
|
_load_resume_state(args, parser)
|
2026-04-26 15:01:35 -07:00
|
|
|
agents_path = runtime_state_dir(run_dir_for(args.resume)) / "agents.json"
|
2026-04-26 09:30:13 -07:00
|
|
|
if not agents_path.exists():
|
2026-04-26 00:57:52 -07:00
|
|
|
parser.error(
|
2026-04-26 09:30:13 -07:00
|
|
|
f"--resume {args.resume}: missing {agents_path}. The run was "
|
|
|
|
|
f"persisted but never reached its first agent snapshot — "
|
2026-04-26 00:57:52 -07:00
|
|
|
f"there's nothing to resume from. Pick a fresh --run-name "
|
|
|
|
|
f"or remove --resume to start over with the same targets."
|
|
|
|
|
)
|
2026-04-26 00:43:22 -07:00
|
|
|
else:
|
|
|
|
|
if not args.target:
|
|
|
|
|
parser.error(
|
|
|
|
|
"the following arguments are required: -t/--target "
|
|
|
|
|
"(or use --resume <run_name> to continue a prior scan)"
|
|
|
|
|
)
|
|
|
|
|
args.targets_info = []
|
|
|
|
|
for target in args.target:
|
|
|
|
|
try:
|
|
|
|
|
target_type, target_dict = infer_target_type(target)
|
|
|
|
|
|
|
|
|
|
if target_type == "local_code":
|
|
|
|
|
display_target = target_dict.get("target_path", target)
|
|
|
|
|
else:
|
|
|
|
|
display_target = target
|
|
|
|
|
|
|
|
|
|
args.targets_info.append(
|
|
|
|
|
{"type": target_type, "details": target_dict, "original": display_target}
|
|
|
|
|
)
|
|
|
|
|
except ValueError:
|
|
|
|
|
parser.error(f"Invalid target '{target}'")
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
assign_workspace_subdirs(args.targets_info)
|
|
|
|
|
rewrite_localhost_targets(args.targets_info, HOST_GATEWAY_HOSTNAME)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2025-11-01 01:25:07 +02:00
|
|
|
return args
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
|
2026-04-26 15:01:35 -07:00
|
|
|
def _persist_run_record(args: argparse.Namespace) -> None:
|
|
|
|
|
run_dir = run_dir_for(args.run_name)
|
2026-04-26 00:43:22 -07:00
|
|
|
run_dir.mkdir(parents=True, exist_ok=True)
|
2026-04-26 15:01:35 -07:00
|
|
|
run_record = {
|
|
|
|
|
"run_id": args.run_name,
|
|
|
|
|
"run_name": args.run_name,
|
|
|
|
|
"status": "running",
|
|
|
|
|
"start_time": datetime.now(UTC).isoformat(),
|
|
|
|
|
"end_time": None,
|
2026-04-26 00:43:22 -07:00
|
|
|
"targets_info": args.targets_info,
|
|
|
|
|
"scan_mode": args.scan_mode,
|
|
|
|
|
"instruction": args.instruction,
|
|
|
|
|
"non_interactive": args.non_interactive,
|
|
|
|
|
"local_sources": getattr(args, "local_sources", []),
|
|
|
|
|
"diff_scope": getattr(args, "diff_scope", {"active": False}),
|
|
|
|
|
"scope_mode": args.scope_mode,
|
|
|
|
|
"diff_base": args.diff_base,
|
|
|
|
|
}
|
2026-04-26 15:01:35 -07:00
|
|
|
write_run_record(run_dir, run_record)
|
2026-04-26 00:43:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def _load_resume_state(args: argparse.Namespace, parser: argparse.ArgumentParser) -> None:
|
2026-04-26 15:01:35 -07:00
|
|
|
"""Populate ``args.targets_info`` and friends from a prior run's run.json."""
|
|
|
|
|
run_dir = run_dir_for(args.resume)
|
|
|
|
|
state_path = run_dir / "run.json"
|
2026-04-26 00:43:22 -07:00
|
|
|
if not state_path.exists():
|
|
|
|
|
parser.error(
|
|
|
|
|
f"--resume {args.resume}: no such run "
|
|
|
|
|
f"(missing {state_path}; remove --resume for a fresh start)"
|
|
|
|
|
)
|
|
|
|
|
try:
|
2026-04-26 15:01:35 -07:00
|
|
|
state = read_run_record(run_dir)
|
|
|
|
|
except RuntimeError as exc:
|
|
|
|
|
parser.error(f"--resume {args.resume}: run.json unreadable: {exc}")
|
2026-04-26 00:43:22 -07:00
|
|
|
|
|
|
|
|
args.targets_info = state.get("targets_info") or []
|
|
|
|
|
if not args.targets_info:
|
2026-04-26 15:01:35 -07:00
|
|
|
parser.error(f"--resume {args.resume}: run.json has no targets_info")
|
2026-04-26 00:43:22 -07:00
|
|
|
|
2026-04-26 00:57:52 -07:00
|
|
|
for target in args.targets_info:
|
|
|
|
|
if not isinstance(target, dict):
|
|
|
|
|
continue
|
|
|
|
|
details = target.get("details") or {}
|
|
|
|
|
if target.get("type") != "repository":
|
|
|
|
|
continue
|
|
|
|
|
cloned = details.get("cloned_repo_path")
|
|
|
|
|
if not cloned:
|
|
|
|
|
continue
|
|
|
|
|
if not Path(cloned).expanduser().exists():
|
|
|
|
|
parser.error(
|
|
|
|
|
f"--resume {args.resume}: cloned repo at {cloned} is missing. "
|
|
|
|
|
f"It was deleted between runs. Pick a fresh --run-name to "
|
|
|
|
|
f"re-clone, or restore the directory before resuming."
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
if args.instruction is None:
|
|
|
|
|
args.instruction = state.get("instruction")
|
|
|
|
|
if state.get("local_sources"):
|
|
|
|
|
args.local_sources = state.get("local_sources")
|
|
|
|
|
if state.get("diff_scope"):
|
|
|
|
|
args.diff_scope = state.get("diff_scope")
|
|
|
|
|
persisted_scan_mode = state.get("scan_mode")
|
|
|
|
|
if persisted_scan_mode and args.scan_mode == "deep":
|
|
|
|
|
args.scan_mode = persisted_scan_mode
|
|
|
|
|
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
def display_completion_message(args: argparse.Namespace, results_path: Path) -> None:
|
|
|
|
|
console = Console()
|
2026-04-26 14:36:58 -07:00
|
|
|
report_state = get_global_report_state()
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2025-11-01 03:02:47 +02:00
|
|
|
scan_completed = False
|
2026-04-26 15:01:35 -07:00
|
|
|
if report_state:
|
|
|
|
|
scan_completed = report_state.run_record.get("status") == "completed"
|
2025-11-01 03:02:47 +02:00
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
completion_text = Text()
|
2025-11-01 03:02:47 +02:00
|
|
|
if scan_completed:
|
2026-01-19 16:42:38 -08:00
|
|
|
completion_text.append("Penetration test completed", style="bold #22c55e")
|
2025-11-01 03:02:47 +02:00
|
|
|
else:
|
2026-01-19 16:42:38 -08:00
|
|
|
completion_text.append("SESSION ENDED", style="bold #eab308")
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
target_text = Text()
|
2026-01-19 16:42:38 -08:00
|
|
|
target_text.append("Target", style="dim")
|
|
|
|
|
target_text.append(" ")
|
2025-11-01 01:25:07 +02:00
|
|
|
if len(args.targets_info) == 1:
|
|
|
|
|
target_text.append(args.targets_info[0]["original"], style="bold white")
|
|
|
|
|
else:
|
2026-01-19 16:42:38 -08:00
|
|
|
target_text.append(f"{len(args.targets_info)} targets", style="bold white")
|
|
|
|
|
for target_info in args.targets_info:
|
|
|
|
|
target_text.append("\n ")
|
2025-11-01 01:25:07 +02:00
|
|
|
target_text.append(target_info["original"], style="white")
|
2026-01-19 16:42:38 -08:00
|
|
|
|
2026-04-26 14:36:58 -07:00
|
|
|
stats_text = build_final_stats_text(report_state)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-25 08:03:00 -07:00
|
|
|
panel_parts: list[Text | str] = [completion_text, "\n\n", target_text]
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
if stats_text.plain:
|
2025-11-01 03:02:47 +02:00
|
|
|
panel_parts.extend(["\n", stats_text])
|
|
|
|
|
|
2026-03-09 05:11:24 -03:00
|
|
|
results_text = Text()
|
|
|
|
|
results_text.append("\n")
|
|
|
|
|
results_text.append("Output", style="dim")
|
|
|
|
|
results_text.append(" ")
|
|
|
|
|
results_text.append(str(results_path), style="#60a5fa")
|
|
|
|
|
panel_parts.extend(["\n", results_text])
|
2025-11-01 03:02:47 +02:00
|
|
|
|
2026-04-26 00:38:17 -07:00
|
|
|
if not scan_completed:
|
|
|
|
|
resume_text = Text()
|
|
|
|
|
resume_text.append("\n")
|
|
|
|
|
resume_text.append("Resume", style="dim")
|
|
|
|
|
resume_text.append(" ")
|
2026-04-26 00:43:22 -07:00
|
|
|
resume_text.append(f"strix --resume {args.run_name}", style="#22c55e")
|
2026-04-26 00:38:17 -07:00
|
|
|
panel_parts.extend(["\n", resume_text])
|
|
|
|
|
|
2025-11-01 03:02:47 +02:00
|
|
|
panel_content = Text.assemble(*panel_parts)
|
|
|
|
|
|
2026-01-19 16:42:38 -08:00
|
|
|
border_style = "#22c55e" if scan_completed else "#eab308"
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
panel = Panel(
|
|
|
|
|
panel_content,
|
2026-01-19 16:42:38 -08:00
|
|
|
title="[bold white]STRIX",
|
|
|
|
|
title_align="left",
|
2025-11-01 03:02:47 +02:00
|
|
|
border_style=border_style,
|
2025-08-08 20:36:44 -07:00
|
|
|
padding=(1, 2),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
console.print("\n")
|
|
|
|
|
console.print(panel)
|
|
|
|
|
console.print()
|
2026-04-26 12:26:48 -07:00
|
|
|
console.print(
|
|
|
|
|
"[#60a5fa]strix.ai[/] [dim]·[/] "
|
|
|
|
|
"[#60a5fa]docs.strix.ai[/] [dim]·[/] "
|
|
|
|
|
"[#60a5fa]discord.gg/strix-ai[/]"
|
|
|
|
|
)
|
2025-12-07 14:35:08 +02:00
|
|
|
console.print()
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def pull_docker_image() -> None:
|
|
|
|
|
console = Console()
|
2025-11-01 01:25:07 +02:00
|
|
|
client = check_docker_connection()
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
image = load_settings().runtime.image
|
|
|
|
|
|
|
|
|
|
if image_exists(client, image):
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.debug("Docker image already present locally: %s", image)
|
2025-08-08 20:36:44 -07:00
|
|
|
return
|
|
|
|
|
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.info("Pulling docker image: %s", image)
|
2025-08-08 20:36:44 -07:00
|
|
|
console.print()
|
2026-04-25 16:05:40 -07:00
|
|
|
console.print(f"[dim]Pulling image[/] {image}")
|
2025-09-08 23:56:03 -07:00
|
|
|
console.print("[dim yellow]This only happens on first run and may take a few minutes...[/]")
|
2025-08-08 20:36:44 -07:00
|
|
|
console.print()
|
|
|
|
|
|
|
|
|
|
with console.status("[bold cyan]Downloading image layers...", spinner="dots") as status:
|
|
|
|
|
try:
|
|
|
|
|
layers_info: dict[str, str] = {}
|
|
|
|
|
last_update = ""
|
|
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
for line in client.api.pull(image, stream=True, decode=True):
|
2025-11-01 01:25:07 +02:00
|
|
|
last_update = process_pull_line(line, layers_info, status, last_update)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
except DockerException as e:
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.exception("Failed to pull docker image %s", image)
|
2025-08-08 20:36:44 -07:00
|
|
|
console.print()
|
|
|
|
|
error_text = Text()
|
|
|
|
|
error_text.append("FAILED TO PULL IMAGE", style="bold red")
|
|
|
|
|
error_text.append("\n\n", style="white")
|
2026-04-25 16:05:40 -07:00
|
|
|
error_text.append(f"Could not download: {image}\n", style="white")
|
2025-08-08 20:36:44 -07:00
|
|
|
error_text.append(str(e), style="dim red")
|
|
|
|
|
|
|
|
|
|
panel = Panel(
|
|
|
|
|
error_text,
|
2026-01-19 16:42:38 -08:00
|
|
|
title="[bold white]STRIX",
|
|
|
|
|
title_align="left",
|
2025-08-08 20:36:44 -07:00
|
|
|
border_style="red",
|
|
|
|
|
padding=(1, 2),
|
|
|
|
|
)
|
|
|
|
|
console.print(panel, "\n")
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
2026-04-25 23:43:19 -07:00
|
|
|
logger.info("Docker image %s ready", image)
|
2025-08-08 20:36:44 -07:00
|
|
|
success_text = Text()
|
2026-01-19 16:42:38 -08:00
|
|
|
success_text.append("Docker image ready", style="#22c55e")
|
2025-08-08 20:36:44 -07:00
|
|
|
console.print(success_text)
|
|
|
|
|
console.print()
|
|
|
|
|
|
|
|
|
|
|
2026-04-25 09:30:23 -07:00
|
|
|
def main() -> None:
|
2026-04-26 14:04:32 -07:00
|
|
|
configure_dependency_logging()
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
if sys.platform == "win32":
|
|
|
|
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
|
|
|
|
2025-08-16 15:47:36 -07:00
|
|
|
args = parse_arguments()
|
|
|
|
|
|
2026-01-20 10:18:42 +01:00
|
|
|
if args.config:
|
2026-04-25 16:05:40 -07:00
|
|
|
apply_config_override(validate_config_file(args.config))
|
2026-01-20 10:18:42 +01:00
|
|
|
|
2025-08-11 18:00:24 -07:00
|
|
|
check_docker_installed()
|
2025-08-08 20:36:44 -07:00
|
|
|
pull_docker_image()
|
|
|
|
|
|
|
|
|
|
validate_environment()
|
|
|
|
|
asyncio.run(warm_up_llm())
|
|
|
|
|
|
2026-04-25 16:05:40 -07:00
|
|
|
persist_current()
|
2026-01-09 21:24:08 -08:00
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
args.run_name = args.resume or generate_run_name(args.targets_info)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
if not args.resume:
|
|
|
|
|
for target_info in args.targets_info:
|
|
|
|
|
if target_info["type"] == "repository":
|
|
|
|
|
repo_url = target_info["details"]["target_repo"]
|
|
|
|
|
dest_name = target_info["details"].get("workspace_subdir")
|
|
|
|
|
cloned_path = clone_repository(repo_url, args.run_name, dest_name)
|
|
|
|
|
target_info["details"]["cloned_repo_path"] = cloned_path
|
2025-08-16 15:47:36 -07:00
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
args.local_sources = collect_local_sources(args.targets_info)
|
|
|
|
|
try:
|
|
|
|
|
diff_scope = resolve_diff_scope_context(
|
|
|
|
|
local_sources=args.local_sources,
|
|
|
|
|
scope_mode=args.scope_mode,
|
|
|
|
|
diff_base=args.diff_base,
|
|
|
|
|
non_interactive=args.non_interactive,
|
|
|
|
|
)
|
|
|
|
|
except ValueError as e:
|
|
|
|
|
console = Console()
|
|
|
|
|
error_text = Text()
|
|
|
|
|
error_text.append("DIFF SCOPE RESOLUTION FAILED", style="bold red")
|
|
|
|
|
error_text.append("\n\n", style="white")
|
|
|
|
|
error_text.append(str(e), style="white")
|
2026-03-31 14:53:49 -04:00
|
|
|
|
2026-04-26 00:43:22 -07:00
|
|
|
panel = Panel(
|
|
|
|
|
error_text,
|
|
|
|
|
title="[bold white]STRIX",
|
|
|
|
|
title_align="left",
|
|
|
|
|
border_style="red",
|
|
|
|
|
padding=(1, 2),
|
|
|
|
|
)
|
|
|
|
|
console.print("\n")
|
|
|
|
|
console.print(panel)
|
|
|
|
|
console.print()
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
args.diff_scope = diff_scope.metadata
|
|
|
|
|
if diff_scope.instruction_block:
|
|
|
|
|
if args.instruction:
|
|
|
|
|
args.instruction = f"{diff_scope.instruction_block}\n\n{args.instruction}"
|
|
|
|
|
else:
|
|
|
|
|
args.instruction = diff_scope.instruction_block
|
2026-03-31 14:53:49 -04:00
|
|
|
|
2026-04-26 15:01:35 -07:00
|
|
|
_persist_run_record(args)
|
2025-08-16 15:47:36 -07:00
|
|
|
|
2026-05-25 23:22:01 -07:00
|
|
|
_telemetry_start_kwargs = {
|
|
|
|
|
"model": load_settings().llm.model,
|
|
|
|
|
"scan_mode": args.scan_mode,
|
|
|
|
|
"is_whitebox": is_whitebox_scan(args.targets_info),
|
|
|
|
|
"interactive": not args.non_interactive,
|
|
|
|
|
"has_instructions": bool(args.instruction),
|
|
|
|
|
}
|
|
|
|
|
posthog.start(**_telemetry_start_kwargs)
|
|
|
|
|
scarf.start(**_telemetry_start_kwargs)
|
2026-01-09 12:26:56 -08:00
|
|
|
|
|
|
|
|
exit_reason = "user_exit"
|
|
|
|
|
try:
|
|
|
|
|
if args.non_interactive:
|
|
|
|
|
asyncio.run(run_cli(args))
|
|
|
|
|
else:
|
|
|
|
|
asyncio.run(run_tui(args))
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
exit_reason = "interrupted"
|
|
|
|
|
except Exception as e:
|
|
|
|
|
exit_reason = "error"
|
|
|
|
|
posthog.error("unhandled_exception", str(e))
|
2026-05-25 23:22:01 -07:00
|
|
|
scarf.error("unhandled_exception", str(e))
|
2026-01-09 12:26:56 -08:00
|
|
|
raise
|
|
|
|
|
finally:
|
2026-04-26 14:36:58 -07:00
|
|
|
report_state = get_global_report_state()
|
|
|
|
|
if report_state:
|
2026-04-26 15:01:35 -07:00
|
|
|
status = {"interrupted": "interrupted", "error": "failed"}.get(
|
|
|
|
|
exit_reason,
|
|
|
|
|
"stopped",
|
|
|
|
|
)
|
|
|
|
|
report_state.cleanup(status=status)
|
2026-04-26 14:36:58 -07:00
|
|
|
posthog.end(report_state, exit_reason=exit_reason)
|
2026-05-25 23:22:01 -07:00
|
|
|
scarf.end(report_state, exit_reason=exit_reason)
|
2025-08-08 20:36:44 -07:00
|
|
|
|
2026-04-26 15:01:35 -07:00
|
|
|
results_path = run_dir_for(args.run_name)
|
2025-08-08 20:36:44 -07:00
|
|
|
display_completion_message(args, results_path)
|
|
|
|
|
|
2025-10-31 20:53:28 +02:00
|
|
|
if args.non_interactive:
|
2026-04-26 14:36:58 -07:00
|
|
|
report_state = get_global_report_state()
|
|
|
|
|
if report_state and report_state.vulnerability_reports:
|
2025-10-31 20:53:28 +02:00
|
|
|
sys.exit(2)
|
|
|
|
|
|
2025-08-08 20:36:44 -07:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|