aiptx 2.0.7__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.
- 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 +46 -0
- aipt_v2/agents/base.py +520 -0
- aipt_v2/agents/exploit_agent.py +688 -0
- aipt_v2/agents/ptt.py +406 -0
- aipt_v2/agents/state.py +168 -0
- aipt_v2/app.py +957 -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 +2933 -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 +341 -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 +194 -0
- aipt_v2/intelligence/adaptation.py +474 -0
- aipt_v2/intelligence/auth.py +520 -0
- aipt_v2/intelligence/chaining.py +775 -0
- aipt_v2/intelligence/correlation.py +536 -0
- aipt_v2/intelligence/cve_aipt.py +334 -0
- aipt_v2/intelligence/cve_info.py +1111 -0
- aipt_v2/intelligence/knowledge_graph.py +590 -0
- aipt_v2/intelligence/learning.py +626 -0
- aipt_v2/intelligence/llm_analyzer.py +502 -0
- aipt_v2/intelligence/llm_tool_selector.py +518 -0
- aipt_v2/intelligence/payload_generator.py +562 -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/interactive_shell.py +559 -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/local_tool_installer.py +1467 -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 +2427 -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 +53 -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/runtime/vps.py +830 -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/setup_wizard.py +941 -0
- aipt_v2/skills/__init__.py +80 -0
- aipt_v2/skills/agents/__init__.py +14 -0
- aipt_v2/skills/agents/api_tester.py +706 -0
- aipt_v2/skills/agents/base.py +477 -0
- aipt_v2/skills/agents/code_review.py +459 -0
- aipt_v2/skills/agents/security_agent.py +336 -0
- aipt_v2/skills/agents/web_pentest.py +818 -0
- aipt_v2/skills/prompts/__init__.py +647 -0
- aipt_v2/system_detector.py +539 -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 +202 -0
- aipt_v2/utils/model_manager.py +187 -0
- aipt_v2/utils/searchers/__init__.py +269 -0
- aipt_v2/verify_install.py +793 -0
- aiptx-2.0.7.dist-info/METADATA +345 -0
- aiptx-2.0.7.dist-info/RECORD +187 -0
- aiptx-2.0.7.dist-info/WHEEL +5 -0
- aiptx-2.0.7.dist-info/entry_points.txt +7 -0
- aiptx-2.0.7.dist-info/licenses/LICENSE +21 -0
- aiptx-2.0.7.dist-info/top_level.txt +1 -0
aipt_v2/interface/cli.py
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import atexit
|
|
2
|
+
import signal
|
|
3
|
+
import sys
|
|
4
|
+
import threading
|
|
5
|
+
import time
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.live import Live
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
from rich.text import Text
|
|
12
|
+
|
|
13
|
+
from aipt_v2.agents.AIPTxAgent import AIPTxAgent
|
|
14
|
+
from aipt_v2.llm.config import LLMConfig
|
|
15
|
+
from aipt_v2.telemetry.tracer import Tracer, set_global_tracer
|
|
16
|
+
|
|
17
|
+
from .utils import build_final_stats_text, build_live_stats_text, get_severity_color
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def run_cli(args: Any) -> None: # noqa: PLR0915
|
|
21
|
+
console = Console()
|
|
22
|
+
|
|
23
|
+
start_text = Text()
|
|
24
|
+
start_text.append("🔒 ", style="bold white")
|
|
25
|
+
start_text.append("AIPT PENETRATION TESTING AGENT", style="bold green")
|
|
26
|
+
|
|
27
|
+
target_text = Text()
|
|
28
|
+
if len(args.targets_info) == 1:
|
|
29
|
+
target_text.append("🎯 Target: ", style="bold cyan")
|
|
30
|
+
target_text.append(args.targets_info[0]["original"], style="bold white")
|
|
31
|
+
else:
|
|
32
|
+
target_text.append("🎯 Targets: ", style="bold cyan")
|
|
33
|
+
target_text.append(f"{len(args.targets_info)} targets\n", style="bold white")
|
|
34
|
+
for i, target_info in enumerate(args.targets_info):
|
|
35
|
+
target_text.append(" • ", style="dim white")
|
|
36
|
+
target_text.append(target_info["original"], style="white")
|
|
37
|
+
if i < len(args.targets_info) - 1:
|
|
38
|
+
target_text.append("\n")
|
|
39
|
+
|
|
40
|
+
results_text = Text()
|
|
41
|
+
results_text.append("📊 Results will be saved to: ", style="bold cyan")
|
|
42
|
+
results_text.append(f"aipt_runs/{args.run_name}", style="bold white")
|
|
43
|
+
|
|
44
|
+
note_text = Text()
|
|
45
|
+
note_text.append("\n\n", style="dim")
|
|
46
|
+
note_text.append("⏱️ ", style="dim")
|
|
47
|
+
note_text.append("This may take a while depending on target complexity. ", style="dim")
|
|
48
|
+
note_text.append("Vulnerabilities will be displayed in real-time.", style="dim")
|
|
49
|
+
|
|
50
|
+
startup_panel = Panel(
|
|
51
|
+
Text.assemble(
|
|
52
|
+
start_text,
|
|
53
|
+
"\n\n",
|
|
54
|
+
target_text,
|
|
55
|
+
"\n",
|
|
56
|
+
results_text,
|
|
57
|
+
note_text,
|
|
58
|
+
),
|
|
59
|
+
title="[bold green]🛡️ AIPT PENETRATION TEST INITIATED",
|
|
60
|
+
title_align="center",
|
|
61
|
+
border_style="green",
|
|
62
|
+
padding=(1, 2),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
console.print("\n")
|
|
66
|
+
console.print(startup_panel)
|
|
67
|
+
console.print()
|
|
68
|
+
|
|
69
|
+
scan_config = {
|
|
70
|
+
"scan_id": args.run_name,
|
|
71
|
+
"targets": args.targets_info,
|
|
72
|
+
"user_instructions": args.instruction or "",
|
|
73
|
+
"run_name": args.run_name,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
llm_config = LLMConfig()
|
|
77
|
+
agent_config = {
|
|
78
|
+
"llm_config": llm_config,
|
|
79
|
+
"max_iterations": 300,
|
|
80
|
+
"non_interactive": True,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if getattr(args, "local_sources", None):
|
|
84
|
+
agent_config["local_sources"] = args.local_sources
|
|
85
|
+
|
|
86
|
+
tracer = Tracer(args.run_name)
|
|
87
|
+
tracer.set_scan_config(scan_config)
|
|
88
|
+
|
|
89
|
+
def display_vulnerability(report_id: str, title: str, content: str, severity: str) -> None:
|
|
90
|
+
severity_color = get_severity_color(severity.lower())
|
|
91
|
+
|
|
92
|
+
vuln_text = Text()
|
|
93
|
+
vuln_text.append("🐞 ", style="bold red")
|
|
94
|
+
vuln_text.append("VULNERABILITY FOUND", style="bold red")
|
|
95
|
+
vuln_text.append(" • ", style="dim white")
|
|
96
|
+
vuln_text.append(title, style="bold white")
|
|
97
|
+
|
|
98
|
+
severity_text = Text()
|
|
99
|
+
severity_text.append("Severity: ", style="dim white")
|
|
100
|
+
severity_text.append(severity.upper(), style=f"bold {severity_color}")
|
|
101
|
+
|
|
102
|
+
vuln_panel = Panel(
|
|
103
|
+
Text.assemble(
|
|
104
|
+
vuln_text,
|
|
105
|
+
"\n\n",
|
|
106
|
+
severity_text,
|
|
107
|
+
"\n\n",
|
|
108
|
+
content,
|
|
109
|
+
),
|
|
110
|
+
title=f"[bold red]🔍 {report_id.upper()}",
|
|
111
|
+
title_align="left",
|
|
112
|
+
border_style="red",
|
|
113
|
+
padding=(1, 2),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
console.print(vuln_panel)
|
|
117
|
+
console.print()
|
|
118
|
+
|
|
119
|
+
tracer.vulnerability_found_callback = display_vulnerability
|
|
120
|
+
|
|
121
|
+
def cleanup_on_exit() -> None:
|
|
122
|
+
tracer.cleanup()
|
|
123
|
+
|
|
124
|
+
def signal_handler(_signum: int, _frame: Any) -> None:
|
|
125
|
+
tracer.cleanup()
|
|
126
|
+
sys.exit(1)
|
|
127
|
+
|
|
128
|
+
atexit.register(cleanup_on_exit)
|
|
129
|
+
signal.signal(signal.SIGINT, signal_handler)
|
|
130
|
+
signal.signal(signal.SIGTERM, signal_handler)
|
|
131
|
+
if hasattr(signal, "SIGHUP"):
|
|
132
|
+
signal.signal(signal.SIGHUP, signal_handler)
|
|
133
|
+
|
|
134
|
+
set_global_tracer(tracer)
|
|
135
|
+
|
|
136
|
+
def create_live_status() -> Panel:
|
|
137
|
+
status_text = Text()
|
|
138
|
+
status_text.append("🦉 ", style="bold white")
|
|
139
|
+
status_text.append("Running penetration test...", style="bold #22c55e")
|
|
140
|
+
status_text.append("\n\n")
|
|
141
|
+
|
|
142
|
+
stats_text = build_live_stats_text(tracer, agent_config)
|
|
143
|
+
if stats_text:
|
|
144
|
+
status_text.append(stats_text)
|
|
145
|
+
|
|
146
|
+
return Panel(
|
|
147
|
+
status_text,
|
|
148
|
+
title="[bold #22c55e]🔍 Live Penetration Test Status",
|
|
149
|
+
title_align="center",
|
|
150
|
+
border_style="#22c55e",
|
|
151
|
+
padding=(1, 2),
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
try:
|
|
155
|
+
console.print()
|
|
156
|
+
|
|
157
|
+
with Live(
|
|
158
|
+
create_live_status(), console=console, refresh_per_second=2, transient=False
|
|
159
|
+
) as live:
|
|
160
|
+
stop_updates = threading.Event()
|
|
161
|
+
|
|
162
|
+
def update_status() -> None:
|
|
163
|
+
while not stop_updates.is_set():
|
|
164
|
+
try:
|
|
165
|
+
live.update(create_live_status())
|
|
166
|
+
time.sleep(2)
|
|
167
|
+
except Exception: # noqa: BLE001
|
|
168
|
+
break
|
|
169
|
+
|
|
170
|
+
update_thread = threading.Thread(target=update_status, daemon=True)
|
|
171
|
+
update_thread.start()
|
|
172
|
+
|
|
173
|
+
try:
|
|
174
|
+
agent = AIPTxAgent(agent_config)
|
|
175
|
+
result = await agent.execute_scan(scan_config)
|
|
176
|
+
|
|
177
|
+
if isinstance(result, dict) and not result.get("success", True):
|
|
178
|
+
error_msg = result.get("error", "Unknown error")
|
|
179
|
+
console.print()
|
|
180
|
+
console.print(f"[bold red]❌ Penetration test failed:[/] {error_msg}")
|
|
181
|
+
console.print()
|
|
182
|
+
sys.exit(1)
|
|
183
|
+
finally:
|
|
184
|
+
stop_updates.set()
|
|
185
|
+
update_thread.join(timeout=1)
|
|
186
|
+
|
|
187
|
+
except Exception as e:
|
|
188
|
+
console.print(f"[bold red]Error during penetration test:[/] {e}")
|
|
189
|
+
raise
|
|
190
|
+
|
|
191
|
+
console.print()
|
|
192
|
+
final_stats_text = Text()
|
|
193
|
+
final_stats_text.append("📊 ", style="bold cyan")
|
|
194
|
+
final_stats_text.append("PENETRATION TEST COMPLETED", style="bold green")
|
|
195
|
+
final_stats_text.append("\n\n")
|
|
196
|
+
|
|
197
|
+
stats_text = build_final_stats_text(tracer)
|
|
198
|
+
if stats_text:
|
|
199
|
+
final_stats_text.append(stats_text)
|
|
200
|
+
|
|
201
|
+
final_stats_panel = Panel(
|
|
202
|
+
final_stats_text,
|
|
203
|
+
title="[bold green]✅ Final Statistics",
|
|
204
|
+
title_align="center",
|
|
205
|
+
border_style="green",
|
|
206
|
+
padding=(1, 2),
|
|
207
|
+
)
|
|
208
|
+
console.print(final_stats_panel)
|
|
209
|
+
|
|
210
|
+
if tracer.final_scan_result:
|
|
211
|
+
console.print()
|
|
212
|
+
|
|
213
|
+
final_report_text = Text()
|
|
214
|
+
final_report_text.append("📄 ", style="bold cyan")
|
|
215
|
+
final_report_text.append("FINAL PENETRATION TEST REPORT", style="bold cyan")
|
|
216
|
+
|
|
217
|
+
final_report_panel = Panel(
|
|
218
|
+
Text.assemble(
|
|
219
|
+
final_report_text,
|
|
220
|
+
"\n\n",
|
|
221
|
+
tracer.final_scan_result,
|
|
222
|
+
),
|
|
223
|
+
title="[bold cyan]📊 PENETRATION TEST SUMMARY",
|
|
224
|
+
title_align="center",
|
|
225
|
+
border_style="cyan",
|
|
226
|
+
padding=(1, 2),
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
console.print(final_report_panel)
|
|
230
|
+
console.print()
|