mirror of
https://github.com/CyberSecurityUP/NeuroSploit.git
synced 2026-06-30 16:55:34 +02:00
55af0d4634
Re-model the pentest agent into an autonomous, markdown-driven engine that turns a URL into a full engagement and delegates execution to a locally installed agentic CLI backend. Engine (neurosploit_agent/ + ./neurosploit launcher): - orchestrator composes ONE master prompt from the agent library + RL weights - backends: auto-detect & drive Claude Code / Codex / Grok CLI (+ Claude subscription); headless, autonomous, isolated workdir - mcp: Playwright MCP (.mcp.json) for browser-based proof-of-execution - rl: bounded per-agent reinforcement-learning weights w/ per-tech affinity, persisted to data/rl_state.json - models: latest registry incl. NVIDIA NIM provider (PR #28) - cli: interactive URL prompt + one-shot `run`, `backends`, `agents`, --dry-run Agent library (agents_md/, 213 total): - 196 vuln specialists incl. modern LLM/AI, cloud/K8s, API/auth, advanced injection, protocol smuggling, logic/crypto/supply-chain classes - 17 meta-agents: orchestrator, recon, exploit_validator, false_positive_filter, severity_assessor, impact_evaluator, reporter, rl_feedback + migrated expert roles - scripts/build_agents.py data-driven builder; REGISTRY.md index Docs: rewritten README.md, v3.3.0 RELEASE.md, .env.example (NVIDIA NIM, xAI, engine vars). Retire legacy Python orchestration (neurosploit.py + agent classes) to legacy/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84 lines
2.3 KiB
Python
Executable File
84 lines
2.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Example Custom Agent for NeuroSploitv2
|
|
This demonstrates how to create custom agents for specific tasks
|
|
"""
|
|
|
|
import logging
|
|
from typing import Dict
|
|
from core.llm_manager import LLMManager
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class CustomAgent:
|
|
"""Example custom agent - Web API Security Scanner"""
|
|
|
|
def __init__(self, config: Dict):
|
|
"""Initialize custom agent"""
|
|
self.config = config
|
|
self.llm = LLMManager(config)
|
|
self.name = "WebAPIScanner"
|
|
logger.info(f"{self.name} initialized")
|
|
|
|
def execute(self, target: str, context: Dict) -> Dict:
|
|
"""Execute custom agent logic"""
|
|
logger.info(f"Running {self.name} on {target}")
|
|
|
|
results = {
|
|
"agent": self.name,
|
|
"target": target,
|
|
"status": "running",
|
|
"findings": []
|
|
}
|
|
|
|
try:
|
|
# Your custom logic here
|
|
# Example: API endpoint testing
|
|
results["findings"] = self._scan_api_endpoints(target)
|
|
|
|
# Use AI for analysis
|
|
ai_analysis = self._ai_analyze(results["findings"])
|
|
results["ai_analysis"] = ai_analysis
|
|
|
|
results["status"] = "completed"
|
|
|
|
except Exception as e:
|
|
logger.error(f"Error in {self.name}: {e}")
|
|
results["status"] = "error"
|
|
results["error"] = str(e)
|
|
|
|
return results
|
|
|
|
def _scan_api_endpoints(self, target: str) -> list:
|
|
"""Custom scanning logic"""
|
|
# Implement your custom scanning logic
|
|
return [
|
|
{"endpoint": "/api/users", "method": "GET", "auth": "required"},
|
|
{"endpoint": "/api/admin", "method": "POST", "auth": "weak"}
|
|
]
|
|
|
|
def _ai_analyze(self, findings: list) -> Dict:
|
|
"""Use AI to analyze findings"""
|
|
prompt = f"""
|
|
Analyze the following API security findings:
|
|
|
|
{findings}
|
|
|
|
Provide:
|
|
1. Security assessment
|
|
2. Risk prioritization
|
|
3. Exploitation recommendations
|
|
4. Remediation advice
|
|
|
|
Response in JSON format.
|
|
"""
|
|
|
|
system_prompt = "You are an API security expert."
|
|
|
|
try:
|
|
response = self.llm.generate(prompt, system_prompt)
|
|
return {"analysis": response}
|
|
except Exception as e:
|
|
return {"error": str(e)}
|