mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-21 07:41:28 +02:00
Stages pass custom arguments to nuclei, httpx, naabu, ffuf, wafw00f and cdncheck — every one of them calls tool_args for its own binary — but none was listed as a tool that takes them, and the validator dropped an unlisted tool without a word. Setting nuclei arguments returned 200 and stored nothing. The six are now listed, so what the stages already read is what a user can set, and a tool that genuinely takes no arguments is refused by name instead of silently ignored. A failing tool reported only its exit code when it wrote its complaint to stdout rather than stderr, which naabu does for a bad flag: the scan said "naabu exited with code 2" while the reason sat one table away. A short stdout is now used when stderr is empty, so the scan says "naabu exited with code 2: flag provided but not defined: -source-port". Every shipped example argument was checked against the binary it names. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K6LcH8uUddjJbKrahf34ys
126 lines
2.7 KiB
Python
126 lines
2.7 KiB
Python
import shlex
|
|
|
|
from pydantic import BaseModel
|
|
|
|
MAX_TOOL_OPTION_LEN = 1000
|
|
|
|
|
|
def parse_tool_args(raw: str) -> list[str]:
|
|
"""shlex-split custom tool args for execution; [] on parse error (validated on save)."""
|
|
if not raw:
|
|
return []
|
|
try:
|
|
return shlex.split(raw)
|
|
except ValueError:
|
|
return []
|
|
|
|
|
|
class ToolSpec(BaseModel):
|
|
name: str
|
|
label: str
|
|
phase: str
|
|
example: str
|
|
|
|
|
|
# CLI tools that accept custom args today (HTTP-only providers + scaffolds excluded).
|
|
SCAN_TOOLS: tuple[ToolSpec, ...] = (
|
|
ToolSpec(
|
|
name="subfinder",
|
|
label="Subfinder",
|
|
phase="Subdomain Discovery",
|
|
example="-all -recursive -timeout 30",
|
|
),
|
|
ToolSpec(
|
|
name="amass",
|
|
label="Amass",
|
|
phase="Subdomain Discovery",
|
|
example="-active",
|
|
),
|
|
ToolSpec(
|
|
name="assetfinder",
|
|
label="Assetfinder",
|
|
phase="Subdomain Discovery",
|
|
example="--subs-only",
|
|
),
|
|
ToolSpec(
|
|
name="sublist3r",
|
|
label="Sublist3r",
|
|
phase="Subdomain Discovery",
|
|
example="-v",
|
|
),
|
|
ToolSpec(
|
|
name="oneforall",
|
|
label="OneForAll",
|
|
phase="Subdomain Discovery",
|
|
example="--takeover False",
|
|
),
|
|
ToolSpec(
|
|
name="tlsx",
|
|
label="TLSX",
|
|
phase="TLS / Certificates",
|
|
example="-cn -san",
|
|
),
|
|
ToolSpec(
|
|
name="katana",
|
|
label="Katana",
|
|
phase="URL Discovery",
|
|
example="-jc -kf all -aff",
|
|
),
|
|
ToolSpec(
|
|
name="urlfinder",
|
|
label="URLFinder",
|
|
phase="URL Discovery",
|
|
example="-all",
|
|
),
|
|
ToolSpec(
|
|
name="dnsx",
|
|
label="DNSX",
|
|
phase="DNS Resolution",
|
|
example="-rcode noerror",
|
|
),
|
|
ToolSpec(
|
|
name="alterx",
|
|
label="Alterx",
|
|
phase="Subdomain Discovery",
|
|
example="-p '{{sub}}-{{word}}.{{suffix}}'",
|
|
),
|
|
ToolSpec(
|
|
name="naabu",
|
|
label="Naabu",
|
|
phase="Port Scan",
|
|
example="-scan-all-ips -sn",
|
|
),
|
|
ToolSpec(
|
|
name="httpx",
|
|
label="HTTPX",
|
|
phase="HTTP Probe",
|
|
example="-favicon -jarm",
|
|
),
|
|
ToolSpec(
|
|
name="nuclei",
|
|
label="Nuclei",
|
|
phase="Vulnerability Scan",
|
|
example="-etags intrusive -exclude-severity info",
|
|
),
|
|
ToolSpec(
|
|
name="ffuf",
|
|
label="ffuf",
|
|
phase="URL Discovery",
|
|
example="-mc 200,204,301,302",
|
|
),
|
|
ToolSpec(
|
|
name="wafw00f",
|
|
label="wafw00f",
|
|
phase="WAF Detection",
|
|
example="-a",
|
|
),
|
|
ToolSpec(
|
|
name="cdncheck",
|
|
label="cdncheck",
|
|
phase="CDN Attribution",
|
|
example="-resp",
|
|
),
|
|
)
|
|
|
|
TOOL_NAMES: frozenset[str] = frozenset(t.name for t in SCAN_TOOLS)
|