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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, NoReturn
|
|
4
|
+
|
|
5
|
+
from aipt_v2.tools.registry import register_tool
|
|
6
|
+
|
|
7
|
+
from .tab_manager import BrowserTabManager, get_browser_tab_manager
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
BrowserAction = Literal[
|
|
11
|
+
"launch",
|
|
12
|
+
"goto",
|
|
13
|
+
"click",
|
|
14
|
+
"type",
|
|
15
|
+
"scroll_down",
|
|
16
|
+
"scroll_up",
|
|
17
|
+
"back",
|
|
18
|
+
"forward",
|
|
19
|
+
"new_tab",
|
|
20
|
+
"switch_tab",
|
|
21
|
+
"close_tab",
|
|
22
|
+
"wait",
|
|
23
|
+
"execute_js",
|
|
24
|
+
"double_click",
|
|
25
|
+
"hover",
|
|
26
|
+
"press_key",
|
|
27
|
+
"save_pdf",
|
|
28
|
+
"get_console_logs",
|
|
29
|
+
"view_source",
|
|
30
|
+
"close",
|
|
31
|
+
"list_tabs",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _validate_url(action_name: str, url: str | None) -> None:
|
|
36
|
+
if not url:
|
|
37
|
+
raise ValueError(f"url parameter is required for {action_name} action")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _validate_coordinate(action_name: str, coordinate: str | None) -> None:
|
|
41
|
+
if not coordinate:
|
|
42
|
+
raise ValueError(f"coordinate parameter is required for {action_name} action")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _validate_text(action_name: str, text: str | None) -> None:
|
|
46
|
+
if not text:
|
|
47
|
+
raise ValueError(f"text parameter is required for {action_name} action")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _validate_tab_id(action_name: str, tab_id: str | None) -> None:
|
|
51
|
+
if not tab_id:
|
|
52
|
+
raise ValueError(f"tab_id parameter is required for {action_name} action")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _validate_js_code(action_name: str, js_code: str | None) -> None:
|
|
56
|
+
if not js_code:
|
|
57
|
+
raise ValueError(f"js_code parameter is required for {action_name} action")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _validate_duration(action_name: str, duration: float | None) -> None:
|
|
61
|
+
if duration is None:
|
|
62
|
+
raise ValueError(f"duration parameter is required for {action_name} action")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _validate_key(action_name: str, key: str | None) -> None:
|
|
66
|
+
if not key:
|
|
67
|
+
raise ValueError(f"key parameter is required for {action_name} action")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _validate_file_path(action_name: str, file_path: str | None) -> None:
|
|
71
|
+
if not file_path:
|
|
72
|
+
raise ValueError(f"file_path parameter is required for {action_name} action")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _handle_navigation_actions(
|
|
76
|
+
manager: BrowserTabManager,
|
|
77
|
+
action: str,
|
|
78
|
+
url: str | None = None,
|
|
79
|
+
tab_id: str | None = None,
|
|
80
|
+
) -> dict[str, Any]:
|
|
81
|
+
if action == "launch":
|
|
82
|
+
return manager.launch_browser(url)
|
|
83
|
+
if action == "goto":
|
|
84
|
+
_validate_url(action, url)
|
|
85
|
+
assert url is not None
|
|
86
|
+
return manager.goto_url(url, tab_id)
|
|
87
|
+
if action == "back":
|
|
88
|
+
return manager.back(tab_id)
|
|
89
|
+
if action == "forward":
|
|
90
|
+
return manager.forward(tab_id)
|
|
91
|
+
raise ValueError(f"Unknown navigation action: {action}")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _handle_interaction_actions(
|
|
95
|
+
manager: BrowserTabManager,
|
|
96
|
+
action: str,
|
|
97
|
+
coordinate: str | None = None,
|
|
98
|
+
text: str | None = None,
|
|
99
|
+
key: str | None = None,
|
|
100
|
+
tab_id: str | None = None,
|
|
101
|
+
) -> dict[str, Any]:
|
|
102
|
+
if action in {"click", "double_click", "hover"}:
|
|
103
|
+
_validate_coordinate(action, coordinate)
|
|
104
|
+
assert coordinate is not None
|
|
105
|
+
action_map = {
|
|
106
|
+
"click": manager.click,
|
|
107
|
+
"double_click": manager.double_click,
|
|
108
|
+
"hover": manager.hover,
|
|
109
|
+
}
|
|
110
|
+
return action_map[action](coordinate, tab_id)
|
|
111
|
+
|
|
112
|
+
if action in {"scroll_down", "scroll_up"}:
|
|
113
|
+
direction = "down" if action == "scroll_down" else "up"
|
|
114
|
+
return manager.scroll(direction, tab_id)
|
|
115
|
+
|
|
116
|
+
if action == "type":
|
|
117
|
+
_validate_text(action, text)
|
|
118
|
+
assert text is not None
|
|
119
|
+
return manager.type_text(text, tab_id)
|
|
120
|
+
if action == "press_key":
|
|
121
|
+
_validate_key(action, key)
|
|
122
|
+
assert key is not None
|
|
123
|
+
return manager.press_key(key, tab_id)
|
|
124
|
+
|
|
125
|
+
raise ValueError(f"Unknown interaction action: {action}")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _raise_unknown_action(action: str) -> NoReturn:
|
|
129
|
+
raise ValueError(f"Unknown action: {action}")
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _handle_tab_actions(
|
|
133
|
+
manager: BrowserTabManager,
|
|
134
|
+
action: str,
|
|
135
|
+
url: str | None = None,
|
|
136
|
+
tab_id: str | None = None,
|
|
137
|
+
) -> dict[str, Any]:
|
|
138
|
+
if action == "new_tab":
|
|
139
|
+
return manager.new_tab(url)
|
|
140
|
+
if action == "switch_tab":
|
|
141
|
+
_validate_tab_id(action, tab_id)
|
|
142
|
+
assert tab_id is not None
|
|
143
|
+
return manager.switch_tab(tab_id)
|
|
144
|
+
if action == "close_tab":
|
|
145
|
+
_validate_tab_id(action, tab_id)
|
|
146
|
+
assert tab_id is not None
|
|
147
|
+
return manager.close_tab(tab_id)
|
|
148
|
+
if action == "list_tabs":
|
|
149
|
+
return manager.list_tabs()
|
|
150
|
+
raise ValueError(f"Unknown tab action: {action}")
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _handle_utility_actions(
|
|
154
|
+
manager: BrowserTabManager,
|
|
155
|
+
action: str,
|
|
156
|
+
duration: float | None = None,
|
|
157
|
+
js_code: str | None = None,
|
|
158
|
+
file_path: str | None = None,
|
|
159
|
+
tab_id: str | None = None,
|
|
160
|
+
clear: bool = False,
|
|
161
|
+
) -> dict[str, Any]:
|
|
162
|
+
if action == "wait":
|
|
163
|
+
_validate_duration(action, duration)
|
|
164
|
+
assert duration is not None
|
|
165
|
+
return manager.wait_browser(duration, tab_id)
|
|
166
|
+
if action == "execute_js":
|
|
167
|
+
_validate_js_code(action, js_code)
|
|
168
|
+
assert js_code is not None
|
|
169
|
+
return manager.execute_js(js_code, tab_id)
|
|
170
|
+
if action == "save_pdf":
|
|
171
|
+
_validate_file_path(action, file_path)
|
|
172
|
+
assert file_path is not None
|
|
173
|
+
return manager.save_pdf(file_path, tab_id)
|
|
174
|
+
if action == "get_console_logs":
|
|
175
|
+
return manager.get_console_logs(tab_id, clear)
|
|
176
|
+
if action == "view_source":
|
|
177
|
+
return manager.view_source(tab_id)
|
|
178
|
+
if action == "close":
|
|
179
|
+
return manager.close_browser()
|
|
180
|
+
raise ValueError(f"Unknown utility action: {action}")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@register_tool
|
|
184
|
+
def browser_action(
|
|
185
|
+
action: BrowserAction,
|
|
186
|
+
url: str | None = None,
|
|
187
|
+
coordinate: str | None = None,
|
|
188
|
+
text: str | None = None,
|
|
189
|
+
tab_id: str | None = None,
|
|
190
|
+
js_code: str | None = None,
|
|
191
|
+
duration: float | None = None,
|
|
192
|
+
key: str | None = None,
|
|
193
|
+
file_path: str | None = None,
|
|
194
|
+
clear: bool = False,
|
|
195
|
+
) -> dict[str, Any]:
|
|
196
|
+
manager = get_browser_tab_manager()
|
|
197
|
+
|
|
198
|
+
try:
|
|
199
|
+
navigation_actions = {"launch", "goto", "back", "forward"}
|
|
200
|
+
interaction_actions = {
|
|
201
|
+
"click",
|
|
202
|
+
"type",
|
|
203
|
+
"double_click",
|
|
204
|
+
"hover",
|
|
205
|
+
"press_key",
|
|
206
|
+
"scroll_down",
|
|
207
|
+
"scroll_up",
|
|
208
|
+
}
|
|
209
|
+
tab_actions = {"new_tab", "switch_tab", "close_tab", "list_tabs"}
|
|
210
|
+
utility_actions = {
|
|
211
|
+
"wait",
|
|
212
|
+
"execute_js",
|
|
213
|
+
"save_pdf",
|
|
214
|
+
"get_console_logs",
|
|
215
|
+
"view_source",
|
|
216
|
+
"close",
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if action in navigation_actions:
|
|
220
|
+
return _handle_navigation_actions(manager, action, url, tab_id)
|
|
221
|
+
if action in interaction_actions:
|
|
222
|
+
return _handle_interaction_actions(manager, action, coordinate, text, key, tab_id)
|
|
223
|
+
if action in tab_actions:
|
|
224
|
+
return _handle_tab_actions(manager, action, url, tab_id)
|
|
225
|
+
if action in utility_actions:
|
|
226
|
+
return _handle_utility_actions(
|
|
227
|
+
manager, action, duration, js_code, file_path, tab_id, clear
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
_raise_unknown_action(action)
|
|
231
|
+
|
|
232
|
+
except (ValueError, RuntimeError) as e:
|
|
233
|
+
return {
|
|
234
|
+
"error": str(e),
|
|
235
|
+
"tab_id": tab_id,
|
|
236
|
+
"screenshot": "",
|
|
237
|
+
"is_running": False,
|
|
238
|
+
}
|