Files
CyberSecurityUP a5badefc29 v3.3.0 GUI dashboard + reports + model expansion + root fix
Engine:
- Fix: inject IS_SANDBOX=1 so Claude Code's --dangerously-skip-permissions
  works under root (real backend runs were exiting rc=1 immediately)
- models: expand to 40 models / 13 providers, tagged CLI vs API
  (NVIDIA NIM, DeepSeek, Mistral, Qwen/DashScope, Groq, Together, OpenRouter,
  Ollama, Gemini) — Qwen/DeepSeek/Llama usable via API
- backends: on_start callback surfaces the exact argv ("what runs behind it")
- orchestrator: require a Playwright screenshot per confirmed finding; collect
  results/activity.json; auto-generate reports after a run
- report.py: HTML always + PDF via Typst engine (.typ source emitted too)

Web dashboard (webgui/, stdlib only — no npm/build):
- Sidebar dashboard (PentAGI-style): Run / Agents / Insights / Reports / Settings
- Multi-target runs; live execution console + per-task activity; finding cards
  with screenshots; backend+provider+model pickers (CLI & API)
- Agents tab: browse 213 + add new .md agents from the UI
- Insights: interactive RL-weight + severity charts
- Reports: download/preview PDF + HTML
- Settings/API: execution mode, per-provider API keys, orchestrator, verbosity
- Endpoints: /api/agents (GET/POST), /api/rl, /api/config, /api/reports,
  /reports/* + /shots/* static serving

Cleanup: retire replaced web stack (frontend React, FastAPI backend, core
orchestration, old test) to legacy/. Active engine + GUI are fully standalone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 23:26:11 -03:00

93 lines
2.6 KiB
Python
Executable File

"""
NeuroSploit v3 - Target Schemas
"""
from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel, Field, field_validator
import re
class TargetCreate(BaseModel):
"""Schema for creating a target"""
url: str = Field(..., description="Target URL")
@field_validator('url')
@classmethod
def validate_url(cls, v: str) -> str:
"""Validate URL format"""
v = v.strip()
if not v:
raise ValueError("URL cannot be empty")
# Basic URL validation
url_pattern = re.compile(
r'^https?://' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?|' # domain
r'localhost|' # localhost
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # or ip
r'(?::\d+)?' # optional port
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
if not url_pattern.match(v):
# Try adding https:// prefix
if url_pattern.match(f"https://{v}"):
return f"https://{v}"
raise ValueError(f"Invalid URL format: {v}")
return v
class TargetBulkCreate(BaseModel):
"""Schema for bulk target creation"""
urls: List[str] = Field(..., min_length=1, description="List of URLs")
@field_validator('urls')
@classmethod
def validate_urls(cls, v: List[str]) -> List[str]:
"""Validate and clean URLs"""
cleaned = []
url_pattern = re.compile(
r'^https?://'
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?|'
r'localhost|'
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'
r'(?::\d+)?'
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
for url in v:
url = url.strip()
if not url:
continue
if url_pattern.match(url):
cleaned.append(url)
elif url_pattern.match(f"https://{url}"):
cleaned.append(f"https://{url}")
if not cleaned:
raise ValueError("No valid URLs provided")
return cleaned
class TargetValidation(BaseModel):
"""Schema for URL validation result"""
url: str
valid: bool
normalized_url: Optional[str] = None
hostname: Optional[str] = None
port: Optional[int] = None
protocol: Optional[str] = None
error: Optional[str] = None
class TargetResponse(BaseModel):
"""Schema for target response"""
id: str
scan_id: str
url: str
hostname: Optional[str]
port: Optional[int]
protocol: Optional[str]
path: Optional[str]
status: str
created_at: datetime
class Config:
from_attributes = True