Files
rengine/shared/models/scan_preview.py
T
Yogesh OjhaandClaude Fable 5.1 96c31ee611 feat(scans): redesign the launch flow with engine-free custom scans
A scan no longer needs a saved engine. The launch dialog has two
configuration modes: Scan Engine (default, runs a saved engine exactly
as configured, shown as a pipeline and its YAML) and Custom Scan (pick
the capabilities to run; dependent and supporting stages are included
automatically). Targets are created on launch from typed values, the
scan context is a first-class field, and "Run again" restores the
engine or the selection that ran.

Backend
- scans.engine_id is nullable; an absent engine resolves through
  AdHocEngine and the run is named after its capabilities (plan_label)
- ScanCreate/ScanBatchCreate accept target_value(s) (create or reuse via
  TargetService.ensure_targets), a per-run intensity, and preview works
  for a target that does not exist yet
- every stage declares consumes/produces (AssetKind), group (StageGroup)
  and role (capability | support); the registry validates them and the
  catalog serves them with groups and seed_produces
- stage_effects walks levels so a producer only feeds later levels and
  marks an unfed consumer skipped_no_input

Frontend
- components/scans/launch/: launch-dialog, launch-state, target-picker,
  plan-picker (segmented Scan Engine | Custom Scan, pipeline + YAML
  Config views, capability pills with full per-stage settings),
  stage-pill, stage-config-popover, launch-summary + what-runs,
  launch-context-field, launch-context-form, save-engine-dialog
- utilities/launch-plan.ts resolves implied producers and following
  support stages; the last engine and last custom selection persist
- quick-scan-fields offers presets and engines in one select; the
  command palette offers "Scan <value>"; scan list action is "Run again"
- effect-panel drops its explanatory header; NO_CONTEXT_LABEL is
  "No scan context"; launch-modal and execution-preview are removed

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014erb6Jbm6v9sxPgYFBxB7E
2026-09-05 08:16:43 +05:30

62 lines
1.7 KiB
Python

import uuid
from enum import StrEnum
from pydantic import BaseModel, Field
class PreviewToolStatus(StrEnum):
WILL_RUN = "will_run"
SKIPPED_DISABLED = "skipped_disabled"
SKIPPED_NEEDS_KEY = "skipped_needs_key"
SKIPPED_NOT_APPLICABLE = "skipped_not_applicable"
SKIPPED_NO_INPUT = "skipped_no_input"
class PreviewTool(BaseModel):
capability: str
label: str
status: PreviewToolStatus
reason: str | None = None
rate: int | None = None
threads: int | None = None
timeout: int | None = None
class PreviewPhase(BaseModel):
phase: str
label: str
tools: list[PreviewTool] = Field(default_factory=list)
class PreviewSummary(BaseModel):
auth_summary: str
custom_header_names: list[str] = Field(default_factory=list)
rate_summary: str
thread_multiplier: float
timeout_multiplier: float
http_protocol: str
follow_redirects: bool | None = None
excluded_subdomains_count: int = 0
excluded_paths_count: int = 0
excluded_ips_count: int = 0
excluded_subdomains: list[str] = Field(default_factory=list)
excluded_paths: list[str] = Field(default_factory=list)
excluded_ips: list[str] = Field(default_factory=list)
included_subdomains: list[str] = Field(default_factory=list)
proxy_name: str | None = None
estimated_duration_seconds: int = 0
estimated_duration_human: str = ""
class ScanPreview(BaseModel):
target_id: uuid.UUID | None = None
target_value: str
target_type: str
engine_id: uuid.UUID | None = None
engine_name: str
context_id: uuid.UUID | None = None
context_name: str | None = None
phases: list[PreviewPhase] = Field(default_factory=list)
summary: PreviewSummary
warnings: list[str] = Field(default_factory=list)