mirror of
https://github.com/CyberSecurityUP/NeuroSploit.git
synced 2026-03-21 01:33:23 +00:00
NeuroSploit v3.2 - Autonomous AI Penetration Testing Platform
116 modules | 100 vuln types | 18 API routes | 18 frontend pages Major features: - VulnEngine: 100 vuln types, 526+ payloads, 12 testers, anti-hallucination prompts - Autonomous Agent: 3-stream auto pentest, multi-session (5 concurrent), pause/resume/stop - CLI Agent: Claude Code / Gemini CLI / Codex CLI inside Kali containers - Validation Pipeline: negative controls, proof of execution, confidence scoring, judge - AI Reasoning: ReACT engine, token budget, endpoint classifier, CVE hunter, deep recon - Multi-Agent: 5 specialists + orchestrator + researcher AI + vuln type agents - RAG System: BM25/TF-IDF/ChromaDB vectorstore, few-shot, reasoning templates - Smart Router: 20 providers (8 CLI OAuth + 12 API), tier failover, token refresh - Kali Sandbox: container-per-scan, 56 tools, VPN support, on-demand install - Full IA Testing: methodology-driven comprehensive pentest sessions - Notifications: Discord, Telegram, WhatsApp/Twilio multi-channel alerts - Frontend: React/TypeScript with 18 pages, real-time WebSocket updates
This commit is contained in:
1
backend/services/__init__.py
Executable file
1
backend/services/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
# Services package
|
||||
105
backend/services/report_service.py
Executable file
105
backend/services/report_service.py
Executable file
@@ -0,0 +1,105 @@
|
||||
"""
|
||||
NeuroSploit v3 - Report Service
|
||||
|
||||
Handles automatic report generation on scan completion/stop.
|
||||
"""
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select
|
||||
|
||||
from backend.models import Scan, Report, Vulnerability
|
||||
from backend.core.report_engine.generator import ReportGenerator
|
||||
from backend.api.websocket import manager as ws_manager
|
||||
|
||||
|
||||
class ReportService:
|
||||
"""Service for automatic report generation"""
|
||||
|
||||
def __init__(self, db: AsyncSession):
|
||||
self.db = db
|
||||
self.generator = ReportGenerator()
|
||||
|
||||
async def auto_generate_report(
|
||||
self,
|
||||
scan_id: str,
|
||||
is_partial: bool = False,
|
||||
format: str = "html"
|
||||
) -> Report:
|
||||
"""
|
||||
Automatically generate a report for a scan.
|
||||
|
||||
Args:
|
||||
scan_id: The scan ID to generate report for
|
||||
is_partial: True if scan was stopped/incomplete
|
||||
format: Report format (html, pdf, json)
|
||||
|
||||
Returns:
|
||||
The generated Report model instance
|
||||
"""
|
||||
# Get scan
|
||||
scan_result = await self.db.execute(select(Scan).where(Scan.id == scan_id))
|
||||
scan = scan_result.scalar_one_or_none()
|
||||
|
||||
if not scan:
|
||||
raise ValueError(f"Scan {scan_id} not found")
|
||||
|
||||
# Get vulnerabilities
|
||||
vulns_result = await self.db.execute(
|
||||
select(Vulnerability).where(Vulnerability.scan_id == scan_id)
|
||||
)
|
||||
vulnerabilities = vulns_result.scalars().all()
|
||||
|
||||
# Generate title
|
||||
if is_partial:
|
||||
title = f"Partial Report - {scan.name or 'Unnamed Scan'}"
|
||||
else:
|
||||
title = f"Security Assessment Report - {scan.name or 'Unnamed Scan'}"
|
||||
|
||||
# Generate report
|
||||
try:
|
||||
report_path, executive_summary = await self.generator.generate(
|
||||
scan=scan,
|
||||
vulnerabilities=vulnerabilities,
|
||||
format=format,
|
||||
title=title,
|
||||
include_executive_summary=True,
|
||||
include_poc=True,
|
||||
include_remediation=True
|
||||
)
|
||||
|
||||
# Create report record
|
||||
report = Report(
|
||||
scan_id=scan_id,
|
||||
title=title,
|
||||
format=format,
|
||||
file_path=str(report_path) if report_path else None,
|
||||
executive_summary=executive_summary,
|
||||
auto_generated=True,
|
||||
is_partial=is_partial
|
||||
)
|
||||
self.db.add(report)
|
||||
await self.db.commit()
|
||||
await self.db.refresh(report)
|
||||
|
||||
# Broadcast report generated event
|
||||
await ws_manager.broadcast_report_generated(scan_id, report.to_dict())
|
||||
await ws_manager.broadcast_log(
|
||||
scan_id,
|
||||
"info",
|
||||
f"Report auto-generated: {title}"
|
||||
)
|
||||
|
||||
return report
|
||||
|
||||
except Exception as e:
|
||||
await ws_manager.broadcast_log(
|
||||
scan_id,
|
||||
"error",
|
||||
f"Failed to auto-generate report: {str(e)}"
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
async def auto_generate_report(db: AsyncSession, scan_id: str, is_partial: bool = False) -> Report:
|
||||
"""Helper function to auto-generate a report"""
|
||||
service = ReportService(db)
|
||||
return await service.auto_generate_report(scan_id, is_partial)
|
||||
1105
backend/services/scan_service.py
Executable file
1105
backend/services/scan_service.py
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user