aiptx 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aiptx might be problematic. Click here for more details.
- aipt_v2/__init__.py +110 -0
- aipt_v2/__main__.py +24 -0
- aipt_v2/agents/AIPTxAgent/__init__.py +10 -0
- aipt_v2/agents/AIPTxAgent/aiptx_agent.py +211 -0
- aipt_v2/agents/__init__.py +24 -0
- aipt_v2/agents/base.py +520 -0
- aipt_v2/agents/ptt.py +406 -0
- aipt_v2/agents/state.py +168 -0
- aipt_v2/app.py +960 -0
- aipt_v2/browser/__init__.py +31 -0
- aipt_v2/browser/automation.py +458 -0
- aipt_v2/browser/crawler.py +453 -0
- aipt_v2/cli.py +321 -0
- aipt_v2/compliance/__init__.py +71 -0
- aipt_v2/compliance/compliance_report.py +449 -0
- aipt_v2/compliance/framework_mapper.py +424 -0
- aipt_v2/compliance/nist_mapping.py +345 -0
- aipt_v2/compliance/owasp_mapping.py +330 -0
- aipt_v2/compliance/pci_mapping.py +297 -0
- aipt_v2/config.py +288 -0
- aipt_v2/core/__init__.py +43 -0
- aipt_v2/core/agent.py +630 -0
- aipt_v2/core/llm.py +395 -0
- aipt_v2/core/memory.py +305 -0
- aipt_v2/core/ptt.py +329 -0
- aipt_v2/database/__init__.py +14 -0
- aipt_v2/database/models.py +232 -0
- aipt_v2/database/repository.py +384 -0
- aipt_v2/docker/__init__.py +23 -0
- aipt_v2/docker/builder.py +260 -0
- aipt_v2/docker/manager.py +222 -0
- aipt_v2/docker/sandbox.py +371 -0
- aipt_v2/evasion/__init__.py +58 -0
- aipt_v2/evasion/request_obfuscator.py +272 -0
- aipt_v2/evasion/tls_fingerprint.py +285 -0
- aipt_v2/evasion/ua_rotator.py +301 -0
- aipt_v2/evasion/waf_bypass.py +439 -0
- aipt_v2/execution/__init__.py +23 -0
- aipt_v2/execution/executor.py +302 -0
- aipt_v2/execution/parser.py +544 -0
- aipt_v2/execution/terminal.py +337 -0
- aipt_v2/health.py +437 -0
- aipt_v2/intelligence/__init__.py +85 -0
- aipt_v2/intelligence/auth.py +520 -0
- aipt_v2/intelligence/chaining.py +775 -0
- aipt_v2/intelligence/cve_aipt.py +334 -0
- aipt_v2/intelligence/cve_info.py +1111 -0
- aipt_v2/intelligence/rag.py +239 -0
- aipt_v2/intelligence/scope.py +442 -0
- aipt_v2/intelligence/searchers/__init__.py +5 -0
- aipt_v2/intelligence/searchers/exploitdb_searcher.py +523 -0
- aipt_v2/intelligence/searchers/github_searcher.py +467 -0
- aipt_v2/intelligence/searchers/google_searcher.py +281 -0
- aipt_v2/intelligence/tools.json +443 -0
- aipt_v2/intelligence/triage.py +670 -0
- aipt_v2/interface/__init__.py +5 -0
- aipt_v2/interface/cli.py +230 -0
- aipt_v2/interface/main.py +501 -0
- aipt_v2/interface/tui.py +1276 -0
- aipt_v2/interface/utils.py +583 -0
- aipt_v2/llm/__init__.py +39 -0
- aipt_v2/llm/config.py +26 -0
- aipt_v2/llm/llm.py +514 -0
- aipt_v2/llm/memory.py +214 -0
- aipt_v2/llm/request_queue.py +89 -0
- aipt_v2/llm/utils.py +89 -0
- aipt_v2/models/__init__.py +15 -0
- aipt_v2/models/findings.py +295 -0
- aipt_v2/models/phase_result.py +224 -0
- aipt_v2/models/scan_config.py +207 -0
- aipt_v2/monitoring/grafana/dashboards/aipt-dashboard.json +355 -0
- aipt_v2/monitoring/grafana/dashboards/default.yml +17 -0
- aipt_v2/monitoring/grafana/datasources/prometheus.yml +17 -0
- aipt_v2/monitoring/prometheus.yml +60 -0
- aipt_v2/orchestration/__init__.py +52 -0
- aipt_v2/orchestration/pipeline.py +398 -0
- aipt_v2/orchestration/progress.py +300 -0
- aipt_v2/orchestration/scheduler.py +296 -0
- aipt_v2/orchestrator.py +2284 -0
- aipt_v2/payloads/__init__.py +27 -0
- aipt_v2/payloads/cmdi.py +150 -0
- aipt_v2/payloads/sqli.py +263 -0
- aipt_v2/payloads/ssrf.py +204 -0
- aipt_v2/payloads/templates.py +222 -0
- aipt_v2/payloads/traversal.py +166 -0
- aipt_v2/payloads/xss.py +204 -0
- aipt_v2/prompts/__init__.py +60 -0
- aipt_v2/proxy/__init__.py +29 -0
- aipt_v2/proxy/history.py +352 -0
- aipt_v2/proxy/interceptor.py +452 -0
- aipt_v2/recon/__init__.py +44 -0
- aipt_v2/recon/dns.py +241 -0
- aipt_v2/recon/osint.py +367 -0
- aipt_v2/recon/subdomain.py +372 -0
- aipt_v2/recon/tech_detect.py +311 -0
- aipt_v2/reports/__init__.py +17 -0
- aipt_v2/reports/generator.py +313 -0
- aipt_v2/reports/html_report.py +378 -0
- aipt_v2/runtime/__init__.py +44 -0
- aipt_v2/runtime/base.py +30 -0
- aipt_v2/runtime/docker.py +401 -0
- aipt_v2/runtime/local.py +346 -0
- aipt_v2/runtime/tool_server.py +205 -0
- aipt_v2/scanners/__init__.py +28 -0
- aipt_v2/scanners/base.py +273 -0
- aipt_v2/scanners/nikto.py +244 -0
- aipt_v2/scanners/nmap.py +402 -0
- aipt_v2/scanners/nuclei.py +273 -0
- aipt_v2/scanners/web.py +454 -0
- aipt_v2/scripts/security_audit.py +366 -0
- aipt_v2/telemetry/__init__.py +7 -0
- aipt_v2/telemetry/tracer.py +347 -0
- aipt_v2/terminal/__init__.py +28 -0
- aipt_v2/terminal/executor.py +400 -0
- aipt_v2/terminal/sandbox.py +350 -0
- aipt_v2/tools/__init__.py +44 -0
- aipt_v2/tools/active_directory/__init__.py +78 -0
- aipt_v2/tools/active_directory/ad_config.py +238 -0
- aipt_v2/tools/active_directory/bloodhound_wrapper.py +447 -0
- aipt_v2/tools/active_directory/kerberos_attacks.py +430 -0
- aipt_v2/tools/active_directory/ldap_enum.py +533 -0
- aipt_v2/tools/active_directory/smb_attacks.py +505 -0
- aipt_v2/tools/agents_graph/__init__.py +19 -0
- aipt_v2/tools/agents_graph/agents_graph_actions.py +69 -0
- aipt_v2/tools/api_security/__init__.py +76 -0
- aipt_v2/tools/api_security/api_discovery.py +608 -0
- aipt_v2/tools/api_security/graphql_scanner.py +622 -0
- aipt_v2/tools/api_security/jwt_analyzer.py +577 -0
- aipt_v2/tools/api_security/openapi_fuzzer.py +761 -0
- aipt_v2/tools/browser/__init__.py +5 -0
- aipt_v2/tools/browser/browser_actions.py +238 -0
- aipt_v2/tools/browser/browser_instance.py +535 -0
- aipt_v2/tools/browser/tab_manager.py +344 -0
- aipt_v2/tools/cloud/__init__.py +70 -0
- aipt_v2/tools/cloud/cloud_config.py +273 -0
- aipt_v2/tools/cloud/cloud_scanner.py +639 -0
- aipt_v2/tools/cloud/prowler_tool.py +571 -0
- aipt_v2/tools/cloud/scoutsuite_tool.py +359 -0
- aipt_v2/tools/executor.py +307 -0
- aipt_v2/tools/parser.py +408 -0
- aipt_v2/tools/proxy/__init__.py +5 -0
- aipt_v2/tools/proxy/proxy_actions.py +103 -0
- aipt_v2/tools/proxy/proxy_manager.py +789 -0
- aipt_v2/tools/registry.py +196 -0
- aipt_v2/tools/scanners/__init__.py +343 -0
- aipt_v2/tools/scanners/acunetix_tool.py +712 -0
- aipt_v2/tools/scanners/burp_tool.py +631 -0
- aipt_v2/tools/scanners/config.py +156 -0
- aipt_v2/tools/scanners/nessus_tool.py +588 -0
- aipt_v2/tools/scanners/zap_tool.py +612 -0
- aipt_v2/tools/terminal/__init__.py +5 -0
- aipt_v2/tools/terminal/terminal_actions.py +37 -0
- aipt_v2/tools/terminal/terminal_manager.py +153 -0
- aipt_v2/tools/terminal/terminal_session.py +449 -0
- aipt_v2/tools/tool_processing.py +108 -0
- aipt_v2/utils/__init__.py +17 -0
- aipt_v2/utils/logging.py +201 -0
- aipt_v2/utils/model_manager.py +187 -0
- aipt_v2/utils/searchers/__init__.py +269 -0
- aiptx-2.0.2.dist-info/METADATA +324 -0
- aiptx-2.0.2.dist-info/RECORD +165 -0
- aiptx-2.0.2.dist-info/WHEEL +5 -0
- aiptx-2.0.2.dist-info/entry_points.txt +7 -0
- aiptx-2.0.2.dist-info/licenses/LICENSE +21 -0
- aiptx-2.0.2.dist-info/top_level.txt +1 -0
aipt_v2/__init__.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT v2 - AI-Powered Penetration Testing Framework
|
|
3
|
+
===================================================
|
|
4
|
+
|
|
5
|
+
A unified penetration testing framework built on top of 8 reference tools:
|
|
6
|
+
- AIPTx: LLM (litellm), Runtime (Docker), Tools (Browser, Terminal, Proxy)
|
|
7
|
+
- pentest-agent: CVE Intelligence with EPSS scoring
|
|
8
|
+
- PentestAssistant: RAG-based tool selection with BGE embeddings
|
|
9
|
+
- PentestGPT: PTT (Penetration Testing Tree) task tracking
|
|
10
|
+
- VulnBot: Output parsing patterns
|
|
11
|
+
- HackSynth: Multi-step reasoning
|
|
12
|
+
- Pentagi: Docker isolation
|
|
13
|
+
- ez-ai-agent: Simple execution model
|
|
14
|
+
|
|
15
|
+
Features:
|
|
16
|
+
- Universal LLM support via litellm (100+ models)
|
|
17
|
+
- Docker sandbox execution
|
|
18
|
+
- Browser automation via Playwright
|
|
19
|
+
- Proxy interception via mitmproxy
|
|
20
|
+
- CVE prioritization (CVSS + EPSS + trending + POC)
|
|
21
|
+
- RAG tool selection with semantic search
|
|
22
|
+
- Hierarchical task tracking
|
|
23
|
+
- SQLAlchemy persistence
|
|
24
|
+
- FastAPI REST API
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
__version__ = "2.0.2"
|
|
28
|
+
__author__ = "AIPT Team"
|
|
29
|
+
|
|
30
|
+
# Available submodules (direct import)
|
|
31
|
+
__all__ = [
|
|
32
|
+
# Core - LangGraph agent, LLM providers, memory
|
|
33
|
+
"core",
|
|
34
|
+
# Docker - Container management and sandboxing
|
|
35
|
+
"docker",
|
|
36
|
+
# Execution - Terminal, parser, sandbox integration
|
|
37
|
+
"execution",
|
|
38
|
+
# Orchestration - Pipeline, scheduler, progress tracking
|
|
39
|
+
"orchestration",
|
|
40
|
+
# Intelligence - Vulnerability analysis, triage, scope
|
|
41
|
+
"intelligence",
|
|
42
|
+
# Tools - Scanner integrations (Acunetix, Burp, etc.)
|
|
43
|
+
"tools",
|
|
44
|
+
# Payloads - XSS, SQLi, SSRF, SSTI, etc.
|
|
45
|
+
"payloads",
|
|
46
|
+
# Scanners - Nuclei, Nmap, Nikto wrappers
|
|
47
|
+
"scanners",
|
|
48
|
+
# Recon - Subdomain, DNS, tech detection
|
|
49
|
+
"recon",
|
|
50
|
+
# Browser - Playwright automation
|
|
51
|
+
"browser",
|
|
52
|
+
# Terminal - Command execution
|
|
53
|
+
"terminal",
|
|
54
|
+
# Proxy - mitmproxy interception
|
|
55
|
+
"proxy",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
# Lazy imports to avoid failures when optional dependencies are missing
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def __getattr__(name):
|
|
62
|
+
"""Lazy import handler for optional dependencies"""
|
|
63
|
+
if name == "LLM":
|
|
64
|
+
from aipt_v2.llm.llm import LLM
|
|
65
|
+
return LLM
|
|
66
|
+
elif name == "LLMConfig":
|
|
67
|
+
from aipt_v2.llm.config import LLMConfig
|
|
68
|
+
return LLMConfig
|
|
69
|
+
elif name == "PTT":
|
|
70
|
+
from aipt_v2.agents.ptt import PTT
|
|
71
|
+
return PTT
|
|
72
|
+
elif name == "BaseAgent":
|
|
73
|
+
from aipt_v2.agents.base import BaseAgent
|
|
74
|
+
return BaseAgent
|
|
75
|
+
elif name == "CVEIntelligence":
|
|
76
|
+
from aipt_v2.intelligence.cve_aipt import CVEIntelligence
|
|
77
|
+
return CVEIntelligence
|
|
78
|
+
elif name == "ToolRAG":
|
|
79
|
+
from aipt_v2.intelligence.rag import ToolRAG
|
|
80
|
+
return ToolRAG
|
|
81
|
+
elif name == "OutputParser":
|
|
82
|
+
from aipt_v2.tools.parser import OutputParser
|
|
83
|
+
return OutputParser
|
|
84
|
+
elif name == "Repository":
|
|
85
|
+
from aipt_v2.database.repository import Repository
|
|
86
|
+
return Repository
|
|
87
|
+
# New models module
|
|
88
|
+
elif name == "Finding":
|
|
89
|
+
from aipt_v2.models.findings import Finding
|
|
90
|
+
return Finding
|
|
91
|
+
elif name == "Severity":
|
|
92
|
+
from aipt_v2.models.findings import Severity
|
|
93
|
+
return Severity
|
|
94
|
+
elif name == "ScanConfig":
|
|
95
|
+
from aipt_v2.models.scan_config import ScanConfig
|
|
96
|
+
return ScanConfig
|
|
97
|
+
elif name == "ScanMode":
|
|
98
|
+
from aipt_v2.models.scan_config import ScanMode
|
|
99
|
+
return ScanMode
|
|
100
|
+
elif name == "PhaseResult":
|
|
101
|
+
from aipt_v2.models.phase_result import PhaseResult
|
|
102
|
+
return PhaseResult
|
|
103
|
+
# Reports module
|
|
104
|
+
elif name == "ReportGenerator":
|
|
105
|
+
from aipt_v2.reports.generator import ReportGenerator
|
|
106
|
+
return ReportGenerator
|
|
107
|
+
elif name == "ReportConfig":
|
|
108
|
+
from aipt_v2.reports.generator import ReportConfig
|
|
109
|
+
return ReportConfig
|
|
110
|
+
raise AttributeError(f"module 'aipt_v2' has no attribute '{name}'")
|
aipt_v2/__main__.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
AIPTX - AI-Powered Penetration Testing Framework
|
|
4
|
+
================================================
|
|
5
|
+
|
|
6
|
+
This module allows running aiptx as a module:
|
|
7
|
+
python -m aiptx scan example.com
|
|
8
|
+
python -m aiptx --help
|
|
9
|
+
|
|
10
|
+
Or directly after pipx install:
|
|
11
|
+
aiptx scan example.com
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main():
|
|
18
|
+
"""Entry point for module execution."""
|
|
19
|
+
from cli import main as cli_main
|
|
20
|
+
sys.exit(cli_main())
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
main()
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT AIPTxAgent - Main penetration testing agent
|
|
3
|
+
|
|
4
|
+
This is the primary agent that orchestrates penetration testing activities.
|
|
5
|
+
It uses the BaseAgent infrastructure with security-focused tools and prompts.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import asyncio
|
|
9
|
+
import logging
|
|
10
|
+
from typing import Any, Optional, Dict
|
|
11
|
+
|
|
12
|
+
from aipt_v2.agents.base import BaseAgent
|
|
13
|
+
from aipt_v2.agents.ptt import PTT, TaskStatus
|
|
14
|
+
from aipt_v2.llm.config import LLMConfig
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class AIPTxAgent(BaseAgent):
|
|
21
|
+
"""
|
|
22
|
+
AIPTxAgent - AI-powered penetration testing agent.
|
|
23
|
+
|
|
24
|
+
This agent performs autonomous security testing using a Think-Select-Execute-Learn loop:
|
|
25
|
+
1. THINK: Analyze current state and decide next action
|
|
26
|
+
2. SELECT: Choose appropriate security tools via RAG
|
|
27
|
+
3. EXECUTE: Run tools and capture output
|
|
28
|
+
4. LEARN: Extract findings, update PTT, decide next phase
|
|
29
|
+
|
|
30
|
+
Features:
|
|
31
|
+
- Multi-phase pentest tracking (recon, enum, exploit, post, report)
|
|
32
|
+
- RAG-based tool selection with 50+ security tools
|
|
33
|
+
- CVE intelligence with CVSS+EPSS+POC scoring
|
|
34
|
+
- Docker sandbox for isolated tool execution
|
|
35
|
+
- Browser automation for web application testing
|
|
36
|
+
- Proxy interception for traffic analysis
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
agent_name = "AIPTxAgent"
|
|
40
|
+
max_iterations = 300
|
|
41
|
+
|
|
42
|
+
def __init__(self, config: Dict[str, Any]):
|
|
43
|
+
"""
|
|
44
|
+
Initialize AIPTxAgent.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
config: Agent configuration with:
|
|
48
|
+
- llm_config: LLMConfig instance
|
|
49
|
+
- max_iterations: Maximum agent loop iterations
|
|
50
|
+
- non_interactive: Run without user interaction
|
|
51
|
+
- local_sources: Local source directories to mount
|
|
52
|
+
"""
|
|
53
|
+
# Ensure llm_config is provided
|
|
54
|
+
if "llm_config" not in config:
|
|
55
|
+
config["llm_config"] = LLMConfig()
|
|
56
|
+
|
|
57
|
+
super().__init__(config)
|
|
58
|
+
|
|
59
|
+
# Initialize PTT for tracking pentest progress
|
|
60
|
+
self.ptt = PTT()
|
|
61
|
+
|
|
62
|
+
# Store scan configuration
|
|
63
|
+
self.scan_config: Optional[Dict[str, Any]] = None
|
|
64
|
+
self.targets_info: list[Dict[str, Any]] = []
|
|
65
|
+
|
|
66
|
+
# Results storage
|
|
67
|
+
self.findings: list[Dict[str, Any]] = []
|
|
68
|
+
self.vulnerabilities: list[Dict[str, Any]] = []
|
|
69
|
+
|
|
70
|
+
async def execute_scan(self, scan_config: Dict[str, Any]) -> Dict[str, Any]:
|
|
71
|
+
"""
|
|
72
|
+
Execute a penetration test scan.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
scan_config: Scan configuration with:
|
|
76
|
+
- scan_id: Unique scan identifier
|
|
77
|
+
- targets: List of target info dicts
|
|
78
|
+
- user_instructions: Optional user instructions
|
|
79
|
+
- run_name: Name for this run
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Dict with scan results including findings and vulnerabilities
|
|
83
|
+
"""
|
|
84
|
+
self.scan_config = scan_config
|
|
85
|
+
self.targets_info = scan_config.get("targets", [])
|
|
86
|
+
|
|
87
|
+
# Build the task prompt
|
|
88
|
+
task = self._build_task_prompt(scan_config)
|
|
89
|
+
|
|
90
|
+
# Initialize PTT for first target
|
|
91
|
+
if self.targets_info:
|
|
92
|
+
first_target = self.targets_info[0].get("original", "unknown")
|
|
93
|
+
self.ptt.initialize(first_target)
|
|
94
|
+
|
|
95
|
+
logger.info(f"Starting penetration test scan: {scan_config.get('scan_id', 'unknown')}")
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
# Run the agent loop
|
|
99
|
+
result = await self.agent_loop(task)
|
|
100
|
+
|
|
101
|
+
# Compile final results
|
|
102
|
+
final_result = {
|
|
103
|
+
"success": True,
|
|
104
|
+
"scan_id": scan_config.get("scan_id"),
|
|
105
|
+
"findings": self.findings,
|
|
106
|
+
"vulnerabilities": self.vulnerabilities,
|
|
107
|
+
"ptt_summary": self.ptt.get_summary() if self.ptt.target else {},
|
|
108
|
+
"agent_summary": self.state.get_execution_summary(),
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return final_result
|
|
112
|
+
|
|
113
|
+
except asyncio.CancelledError:
|
|
114
|
+
logger.warning("Scan was cancelled")
|
|
115
|
+
return {
|
|
116
|
+
"success": False,
|
|
117
|
+
"error": "Scan was cancelled",
|
|
118
|
+
"scan_id": scan_config.get("scan_id"),
|
|
119
|
+
}
|
|
120
|
+
except Exception as e:
|
|
121
|
+
logger.exception(f"Scan failed: {e}")
|
|
122
|
+
return {
|
|
123
|
+
"success": False,
|
|
124
|
+
"error": str(e),
|
|
125
|
+
"scan_id": scan_config.get("scan_id"),
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
def _build_task_prompt(self, scan_config: Dict[str, Any]) -> str:
|
|
129
|
+
"""Build the initial task prompt for the agent."""
|
|
130
|
+
targets = scan_config.get("targets", [])
|
|
131
|
+
user_instructions = scan_config.get("user_instructions", "")
|
|
132
|
+
|
|
133
|
+
# Build target description
|
|
134
|
+
if len(targets) == 1:
|
|
135
|
+
target_desc = targets[0].get("original", "unknown target")
|
|
136
|
+
target_type = targets[0].get("type", "unknown")
|
|
137
|
+
else:
|
|
138
|
+
target_desc = f"{len(targets)} targets"
|
|
139
|
+
target_type = "multiple"
|
|
140
|
+
|
|
141
|
+
task = f"""You are an AI penetration testing agent. Your mission is to perform a comprehensive security assessment on: {target_desc}
|
|
142
|
+
|
|
143
|
+
Target Type: {target_type}
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
if len(targets) == 1:
|
|
147
|
+
details = targets[0].get("details", {})
|
|
148
|
+
if details:
|
|
149
|
+
task += f"Target Details: {details}\n"
|
|
150
|
+
|
|
151
|
+
if user_instructions:
|
|
152
|
+
task += f"\nUser Instructions: {user_instructions}\n"
|
|
153
|
+
|
|
154
|
+
task += """
|
|
155
|
+
Your objectives:
|
|
156
|
+
1. RECONNAISSANCE: Gather information about the target (ports, services, technologies)
|
|
157
|
+
2. ENUMERATION: Identify potential attack vectors and vulnerabilities
|
|
158
|
+
3. EXPLOITATION: Safely test identified vulnerabilities (do not cause damage)
|
|
159
|
+
4. DOCUMENTATION: Record all findings with severity and remediation advice
|
|
160
|
+
|
|
161
|
+
Guidelines:
|
|
162
|
+
- Follow responsible disclosure practices
|
|
163
|
+
- Document all findings clearly
|
|
164
|
+
- Prioritize high-impact vulnerabilities
|
|
165
|
+
- Stay within authorized scope
|
|
166
|
+
- Use appropriate tools for each phase
|
|
167
|
+
|
|
168
|
+
Begin your security assessment now. Start with reconnaissance to understand the target.
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
return task
|
|
172
|
+
|
|
173
|
+
def add_finding(self, finding: Dict[str, Any]) -> None:
|
|
174
|
+
"""Add a finding to the scan results."""
|
|
175
|
+
self.findings.append(finding)
|
|
176
|
+
|
|
177
|
+
# Also track in PTT
|
|
178
|
+
if self.ptt.target:
|
|
179
|
+
phase = finding.get("phase", self.ptt.current_phase)
|
|
180
|
+
self.ptt.add_findings(phase, [finding])
|
|
181
|
+
|
|
182
|
+
def add_vulnerability(self, vulnerability: Dict[str, Any]) -> None:
|
|
183
|
+
"""Add a vulnerability to the scan results."""
|
|
184
|
+
self.vulnerabilities.append(vulnerability)
|
|
185
|
+
|
|
186
|
+
# Also add as finding
|
|
187
|
+
self.add_finding({
|
|
188
|
+
**vulnerability,
|
|
189
|
+
"type": "vulnerability",
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
# Notify tracer if available
|
|
193
|
+
from aipt_v2.telemetry.tracer import get_global_tracer
|
|
194
|
+
tracer = get_global_tracer()
|
|
195
|
+
if tracer and hasattr(tracer, "report_vulnerability"):
|
|
196
|
+
tracer.report_vulnerability(
|
|
197
|
+
report_id=vulnerability.get("id", "VULN"),
|
|
198
|
+
title=vulnerability.get("title", "Unknown Vulnerability"),
|
|
199
|
+
content=vulnerability.get("description", ""),
|
|
200
|
+
severity=vulnerability.get("severity", "info"),
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
def get_ptt_summary(self) -> str:
|
|
204
|
+
"""Get PTT progress summary for the LLM."""
|
|
205
|
+
if self.ptt.target:
|
|
206
|
+
return self.ptt.to_prompt()
|
|
207
|
+
return "No PTT initialized"
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# Backwards compatibility alias
|
|
211
|
+
StrixAgent = AIPTxAgent
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Agents Module - Agent orchestration and task tracking
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Core components that don't require external dependencies
|
|
6
|
+
from aipt_v2.agents.ptt import PTT, Task, Phase, TaskStatus, PhaseType
|
|
7
|
+
from aipt_v2.agents.state import AgentState
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"PTT",
|
|
11
|
+
"Task",
|
|
12
|
+
"Phase",
|
|
13
|
+
"PhaseType",
|
|
14
|
+
"TaskStatus",
|
|
15
|
+
"AgentState",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __getattr__(name):
|
|
20
|
+
"""Lazy import for components with external dependencies"""
|
|
21
|
+
if name == "BaseAgent":
|
|
22
|
+
from aipt_v2.agents.base import BaseAgent
|
|
23
|
+
return BaseAgent
|
|
24
|
+
raise AttributeError(f"module 'aipt_v2.agents' has no attribute '{name}'")
|