Files
rengine/shared/definitions/tools.py
T
Yogesh OjhaandClaude Opus 5 2cb8d73280 style: strip explanatory comments across the codebase
The comment rule in CLAUDE.md is one line maximum, never narration: no
multi-line blocks, no module-header explainers, no sentences that explain or
justify the code to the reader. The tree had drifted a long way from it, and
most of the drift is mine.

Removed:
  232  lines of multi-line comment blocks
  203  single-line comments that argued instead of stating
  154  comments joined by so/because/otherwise/rather-than
  143  narrating comments in the frontend
  112  test docstrings (the test name already says what it asserts)
   25  test module docstrings and 25 decorative section dividers

Collapsed:
  324  multi-line docstrings to one factual line
  271  one-line docstrings that had a justifying clause bolted on

Kept: functional directives, section dividers, short field labels, alembic
revision headers, and the eight FastAPI route docstrings that render in /docs.
Where a fact was load-bearing it is in CLAUDE.md, which is where it belongs.

284 python tests and 34 frontend tests pass, ruff and ruff-format clean across
ten packages, svelte-check 0 errors, prettier and eslint clean, app.main imports.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013dKUV96WkQQETZBMoAG98C
2026-09-11 14:11:23 +05:30

125 lines
2.6 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."""
if not raw:
return []
try:
return shlex.split(raw)
except ValueError:
return []
class ToolSpec(BaseModel):
name: str
label: str
phase: str
example: str
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)