sqlmap-ai 2.0.0__tar.gz → 2.0.1__tar.gz
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.
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/PKG-INFO +154 -2
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/README.md +153 -1
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/pyproject.toml +1 -1
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/main.py +56 -3
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/runner.py +13 -1
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai.egg-info/PKG-INFO +154 -2
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/LICENSE +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/setup.cfg +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/setup.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/__init__.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/adaptive_testing.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/advanced_reporting.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/ai_analyzer.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/cli.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/config_manager.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/enhanced_cli.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/evasion_engine.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/html_reporter.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/parser.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/security_manager.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/templates/report_template.html +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/timeout_handler.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai/ui.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai.egg-info/SOURCES.txt +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai.egg-info/dependency_links.txt +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai.egg-info/entry_points.txt +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai.egg-info/requires.txt +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/sqlmap_ai.egg-info/top_level.txt +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/tests/test_config_manager.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/tests/test_security_manager.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/utils/__init__.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/utils/ai_providers.py +0 -0
- {sqlmap_ai-2.0.0 → sqlmap_ai-2.0.1}/utils/groq_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlmap-ai
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: AI-powered SQL injection testing tool with multiple AI providers
|
|
5
5
|
Home-page: https://github.com/atiilla/sqlmap-ai
|
|
6
6
|
Author: Atilla
|
|
@@ -83,7 +83,7 @@ An AI-powered wrapper around SQLMap that makes SQL injection testing more access
|
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
85
|
# Clone the repository
|
|
86
|
-
git clone https://github.com/
|
|
86
|
+
git clone https://github.com/atiilla/sqlmap-ai.git
|
|
87
87
|
cd sqlmap-ai
|
|
88
88
|
|
|
89
89
|
# Install the package
|
|
@@ -171,6 +171,60 @@ sqlmap-ai -u "http://example.com/page.php?id=1"
|
|
|
171
171
|
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider groq
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
### HTTP Request File Testing (NEW!)
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Test using HTTP request capture file
|
|
178
|
+
sqlmap-ai -r request.txt
|
|
179
|
+
|
|
180
|
+
# Enhanced mode with request file and adaptive testing
|
|
181
|
+
sqlmap-ai --enhanced --adaptive -r request.txt
|
|
182
|
+
|
|
183
|
+
# With specific AI provider
|
|
184
|
+
sqlmap-ai --enhanced -r request.txt --ai-provider groq
|
|
185
|
+
|
|
186
|
+
# Simple mode with request file
|
|
187
|
+
sqlmap-ai --simple -r request.txt
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Request File Format:**
|
|
191
|
+
```http
|
|
192
|
+
POST /login.php HTTP/1.1
|
|
193
|
+
Host: example.com
|
|
194
|
+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
|
|
195
|
+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9
|
|
196
|
+
Content-Type: application/x-www-form-urlencoded
|
|
197
|
+
Content-Length: 38
|
|
198
|
+
|
|
199
|
+
username=admin&password=test
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Creating Request Files:**
|
|
203
|
+
|
|
204
|
+
1. **From Browser Developer Tools:**
|
|
205
|
+
- Open Developer Tools (F12)
|
|
206
|
+
- Go to Network tab
|
|
207
|
+
- Perform the action you want to test
|
|
208
|
+
- Right-click the request → Copy → Copy as cURL
|
|
209
|
+
- Convert cURL to HTTP format
|
|
210
|
+
|
|
211
|
+
2. **From Burp Suite:**
|
|
212
|
+
- Intercept the request
|
|
213
|
+
- Right-click → Save item
|
|
214
|
+
- Save as .txt file
|
|
215
|
+
|
|
216
|
+
3. **From OWASP ZAP:**
|
|
217
|
+
- Right-click request → Export → HTTP Message
|
|
218
|
+
- Save as .txt file
|
|
219
|
+
|
|
220
|
+
**Supported Request Types:**
|
|
221
|
+
- [x] GET requests with parameters
|
|
222
|
+
- [x] POST requests with form data
|
|
223
|
+
- [x] POST requests with JSON data
|
|
224
|
+
- [x] Requests with cookies
|
|
225
|
+
- [x] Requests with custom headers
|
|
226
|
+
- [x] Multipart form data
|
|
227
|
+
|
|
174
228
|
### Advanced Testing
|
|
175
229
|
|
|
176
230
|
```bash
|
|
@@ -179,6 +233,9 @@ sqlmap-ai --adaptive
|
|
|
179
233
|
|
|
180
234
|
# Simple mode (basic SQLMap without AI)
|
|
181
235
|
sqlmap-ai --simple -u "http://example.com/page.php?id=1"
|
|
236
|
+
|
|
237
|
+
# Enhanced mode with custom options
|
|
238
|
+
sqlmap-ai --enhanced -u "http://example.com/page.php?id=1" --level 3 --risk 2
|
|
182
239
|
```
|
|
183
240
|
|
|
184
241
|
### AI Provider Selection
|
|
@@ -197,6 +254,90 @@ sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider openai
|
|
|
197
254
|
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider auto
|
|
198
255
|
```
|
|
199
256
|
|
|
257
|
+
### Complete Testing Workflow
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# 1. Basic scan with URL
|
|
261
|
+
sqlmap-ai -u "http://example.com/page.php?id=1"
|
|
262
|
+
|
|
263
|
+
# 2. Enhanced scan with request file
|
|
264
|
+
sqlmap-ai --enhanced --adaptive -r captured_request.txt
|
|
265
|
+
|
|
266
|
+
# 3. Advanced scan with custom options
|
|
267
|
+
sqlmap-ai --enhanced -r request.txt --level 4 --risk 3 --threads 10
|
|
268
|
+
|
|
269
|
+
# 4. Simple mode for quick testing
|
|
270
|
+
sqlmap-ai --simple -r request.txt --batch
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Testing Modes
|
|
274
|
+
|
|
275
|
+
### Enhanced Mode (Default)
|
|
276
|
+
Full AI-powered testing with advanced features:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Basic enhanced scan
|
|
280
|
+
sqlmap-ai --enhanced -u "http://example.com/page.php?id=1"
|
|
281
|
+
|
|
282
|
+
# With request file
|
|
283
|
+
sqlmap-ai --enhanced -r request.txt
|
|
284
|
+
|
|
285
|
+
# Adaptive testing with AI analysis
|
|
286
|
+
sqlmap-ai --enhanced --adaptive -r request.txt --ai-provider groq
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Features:**
|
|
290
|
+
- AI-powered vulnerability analysis
|
|
291
|
+
- Adaptive testing strategies
|
|
292
|
+
- WAF evasion techniques
|
|
293
|
+
- Beautiful HTML reports
|
|
294
|
+
- Risk assessment and remediation guidance
|
|
295
|
+
- Interactive CLI with progress tracking
|
|
296
|
+
- Multiple AI providers (Groq, OpenAI, Anthropic, Ollama)
|
|
297
|
+
- Advanced configuration management
|
|
298
|
+
- Request file support (NEW!)
|
|
299
|
+
|
|
300
|
+
### Simple Mode
|
|
301
|
+
Basic SQL injection testing without AI features:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Basic simple scan
|
|
305
|
+
sqlmap-ai --simple -u "http://example.com/page.php?id=1"
|
|
306
|
+
|
|
307
|
+
# With request file
|
|
308
|
+
sqlmap-ai --simple -r request.txt
|
|
309
|
+
|
|
310
|
+
# Quick batch mode
|
|
311
|
+
sqlmap-ai --simple -r request.txt --batch
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Features:**
|
|
315
|
+
- Basic SQL injection detection
|
|
316
|
+
- Standard SQLMap functionality
|
|
317
|
+
- Minimal dependencies
|
|
318
|
+
- Fast execution
|
|
319
|
+
- Request file support (NEW!)
|
|
320
|
+
- Simple text output
|
|
321
|
+
- Basic result saving
|
|
322
|
+
|
|
323
|
+
### Adaptive Mode
|
|
324
|
+
Intelligent step-by-step testing that adapts to the target:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Full adaptive testing
|
|
328
|
+
sqlmap-ai --enhanced --adaptive -r request.txt
|
|
329
|
+
|
|
330
|
+
# With specific AI provider
|
|
331
|
+
sqlmap-ai --enhanced --adaptive -r request.txt --ai-provider groq
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Adaptive Steps:**
|
|
335
|
+
1. **🟢 Initial Assessment** - Check for SQL injection vulnerabilities
|
|
336
|
+
2. **🟠 DBMS Identification** - Detect database type (MySQL, PostgreSQL, etc.)
|
|
337
|
+
3. **🔴 Enhanced Testing** - Try more aggressive techniques
|
|
338
|
+
4. **🟣 Data Extraction** - Extract valuable data from identified tables
|
|
339
|
+
5. **🤖 AI Analysis** - Get AI recommendations for next steps
|
|
340
|
+
|
|
200
341
|
## AI Providers Comparison
|
|
201
342
|
|
|
202
343
|
| Provider | Setup | Speed | Privacy | Cost |
|
|
@@ -270,6 +411,17 @@ ui:
|
|
|
270
411
|
- Run `sqlmap-ai --config-wizard` to fix setup
|
|
271
412
|
- Check `sqlmap-ai --validate-config` for issues
|
|
272
413
|
|
|
414
|
+
**5. "Request file not working"**
|
|
415
|
+
- Ensure request file has proper HTTP format
|
|
416
|
+
- Check that Host header is present
|
|
417
|
+
- Verify request file path is correct
|
|
418
|
+
- Try with `--simple` mode first: `sqlmap-ai --simple -r request.txt`
|
|
419
|
+
|
|
420
|
+
**6. "URL validation failed"**
|
|
421
|
+
- When using request files, the URL is automatically extracted
|
|
422
|
+
- Ensure request file contains valid HTTP request
|
|
423
|
+
- Check that the Host header matches the target domain
|
|
424
|
+
|
|
273
425
|
### Getting Help
|
|
274
426
|
|
|
275
427
|
```bash
|
|
@@ -16,7 +16,7 @@ An AI-powered wrapper around SQLMap that makes SQL injection testing more access
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
# Clone the repository
|
|
19
|
-
git clone https://github.com/
|
|
19
|
+
git clone https://github.com/atiilla/sqlmap-ai.git
|
|
20
20
|
cd sqlmap-ai
|
|
21
21
|
|
|
22
22
|
# Install the package
|
|
@@ -104,6 +104,60 @@ sqlmap-ai -u "http://example.com/page.php?id=1"
|
|
|
104
104
|
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider groq
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
### HTTP Request File Testing (NEW!)
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Test using HTTP request capture file
|
|
111
|
+
sqlmap-ai -r request.txt
|
|
112
|
+
|
|
113
|
+
# Enhanced mode with request file and adaptive testing
|
|
114
|
+
sqlmap-ai --enhanced --adaptive -r request.txt
|
|
115
|
+
|
|
116
|
+
# With specific AI provider
|
|
117
|
+
sqlmap-ai --enhanced -r request.txt --ai-provider groq
|
|
118
|
+
|
|
119
|
+
# Simple mode with request file
|
|
120
|
+
sqlmap-ai --simple -r request.txt
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Request File Format:**
|
|
124
|
+
```http
|
|
125
|
+
POST /login.php HTTP/1.1
|
|
126
|
+
Host: example.com
|
|
127
|
+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
|
|
128
|
+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9
|
|
129
|
+
Content-Type: application/x-www-form-urlencoded
|
|
130
|
+
Content-Length: 38
|
|
131
|
+
|
|
132
|
+
username=admin&password=test
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Creating Request Files:**
|
|
136
|
+
|
|
137
|
+
1. **From Browser Developer Tools:**
|
|
138
|
+
- Open Developer Tools (F12)
|
|
139
|
+
- Go to Network tab
|
|
140
|
+
- Perform the action you want to test
|
|
141
|
+
- Right-click the request → Copy → Copy as cURL
|
|
142
|
+
- Convert cURL to HTTP format
|
|
143
|
+
|
|
144
|
+
2. **From Burp Suite:**
|
|
145
|
+
- Intercept the request
|
|
146
|
+
- Right-click → Save item
|
|
147
|
+
- Save as .txt file
|
|
148
|
+
|
|
149
|
+
3. **From OWASP ZAP:**
|
|
150
|
+
- Right-click request → Export → HTTP Message
|
|
151
|
+
- Save as .txt file
|
|
152
|
+
|
|
153
|
+
**Supported Request Types:**
|
|
154
|
+
- [x] GET requests with parameters
|
|
155
|
+
- [x] POST requests with form data
|
|
156
|
+
- [x] POST requests with JSON data
|
|
157
|
+
- [x] Requests with cookies
|
|
158
|
+
- [x] Requests with custom headers
|
|
159
|
+
- [x] Multipart form data
|
|
160
|
+
|
|
107
161
|
### Advanced Testing
|
|
108
162
|
|
|
109
163
|
```bash
|
|
@@ -112,6 +166,9 @@ sqlmap-ai --adaptive
|
|
|
112
166
|
|
|
113
167
|
# Simple mode (basic SQLMap without AI)
|
|
114
168
|
sqlmap-ai --simple -u "http://example.com/page.php?id=1"
|
|
169
|
+
|
|
170
|
+
# Enhanced mode with custom options
|
|
171
|
+
sqlmap-ai --enhanced -u "http://example.com/page.php?id=1" --level 3 --risk 2
|
|
115
172
|
```
|
|
116
173
|
|
|
117
174
|
### AI Provider Selection
|
|
@@ -130,6 +187,90 @@ sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider openai
|
|
|
130
187
|
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider auto
|
|
131
188
|
```
|
|
132
189
|
|
|
190
|
+
### Complete Testing Workflow
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# 1. Basic scan with URL
|
|
194
|
+
sqlmap-ai -u "http://example.com/page.php?id=1"
|
|
195
|
+
|
|
196
|
+
# 2. Enhanced scan with request file
|
|
197
|
+
sqlmap-ai --enhanced --adaptive -r captured_request.txt
|
|
198
|
+
|
|
199
|
+
# 3. Advanced scan with custom options
|
|
200
|
+
sqlmap-ai --enhanced -r request.txt --level 4 --risk 3 --threads 10
|
|
201
|
+
|
|
202
|
+
# 4. Simple mode for quick testing
|
|
203
|
+
sqlmap-ai --simple -r request.txt --batch
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Testing Modes
|
|
207
|
+
|
|
208
|
+
### Enhanced Mode (Default)
|
|
209
|
+
Full AI-powered testing with advanced features:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Basic enhanced scan
|
|
213
|
+
sqlmap-ai --enhanced -u "http://example.com/page.php?id=1"
|
|
214
|
+
|
|
215
|
+
# With request file
|
|
216
|
+
sqlmap-ai --enhanced -r request.txt
|
|
217
|
+
|
|
218
|
+
# Adaptive testing with AI analysis
|
|
219
|
+
sqlmap-ai --enhanced --adaptive -r request.txt --ai-provider groq
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Features:**
|
|
223
|
+
- AI-powered vulnerability analysis
|
|
224
|
+
- Adaptive testing strategies
|
|
225
|
+
- WAF evasion techniques
|
|
226
|
+
- Beautiful HTML reports
|
|
227
|
+
- Risk assessment and remediation guidance
|
|
228
|
+
- Interactive CLI with progress tracking
|
|
229
|
+
- Multiple AI providers (Groq, OpenAI, Anthropic, Ollama)
|
|
230
|
+
- Advanced configuration management
|
|
231
|
+
- Request file support (NEW!)
|
|
232
|
+
|
|
233
|
+
### Simple Mode
|
|
234
|
+
Basic SQL injection testing without AI features:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Basic simple scan
|
|
238
|
+
sqlmap-ai --simple -u "http://example.com/page.php?id=1"
|
|
239
|
+
|
|
240
|
+
# With request file
|
|
241
|
+
sqlmap-ai --simple -r request.txt
|
|
242
|
+
|
|
243
|
+
# Quick batch mode
|
|
244
|
+
sqlmap-ai --simple -r request.txt --batch
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Features:**
|
|
248
|
+
- Basic SQL injection detection
|
|
249
|
+
- Standard SQLMap functionality
|
|
250
|
+
- Minimal dependencies
|
|
251
|
+
- Fast execution
|
|
252
|
+
- Request file support (NEW!)
|
|
253
|
+
- Simple text output
|
|
254
|
+
- Basic result saving
|
|
255
|
+
|
|
256
|
+
### Adaptive Mode
|
|
257
|
+
Intelligent step-by-step testing that adapts to the target:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Full adaptive testing
|
|
261
|
+
sqlmap-ai --enhanced --adaptive -r request.txt
|
|
262
|
+
|
|
263
|
+
# With specific AI provider
|
|
264
|
+
sqlmap-ai --enhanced --adaptive -r request.txt --ai-provider groq
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Adaptive Steps:**
|
|
268
|
+
1. **🟢 Initial Assessment** - Check for SQL injection vulnerabilities
|
|
269
|
+
2. **🟠 DBMS Identification** - Detect database type (MySQL, PostgreSQL, etc.)
|
|
270
|
+
3. **🔴 Enhanced Testing** - Try more aggressive techniques
|
|
271
|
+
4. **🟣 Data Extraction** - Extract valuable data from identified tables
|
|
272
|
+
5. **🤖 AI Analysis** - Get AI recommendations for next steps
|
|
273
|
+
|
|
133
274
|
## AI Providers Comparison
|
|
134
275
|
|
|
135
276
|
| Provider | Setup | Speed | Privacy | Cost |
|
|
@@ -203,6 +344,17 @@ ui:
|
|
|
203
344
|
- Run `sqlmap-ai --config-wizard` to fix setup
|
|
204
345
|
- Check `sqlmap-ai --validate-config` for issues
|
|
205
346
|
|
|
347
|
+
**5. "Request file not working"**
|
|
348
|
+
- Ensure request file has proper HTTP format
|
|
349
|
+
- Check that Host header is present
|
|
350
|
+
- Verify request file path is correct
|
|
351
|
+
- Try with `--simple` mode first: `sqlmap-ai --simple -r request.txt`
|
|
352
|
+
|
|
353
|
+
**6. "URL validation failed"**
|
|
354
|
+
- When using request files, the URL is automatically extracted
|
|
355
|
+
- Ensure request file contains valid HTTP request
|
|
356
|
+
- Check that the Host header matches the target domain
|
|
357
|
+
|
|
206
358
|
### Getting Help
|
|
207
359
|
|
|
208
360
|
```bash
|
|
@@ -24,6 +24,7 @@ from sqlmap_ai.adaptive_testing import run_adaptive_test_sequence
|
|
|
24
24
|
from sqlmap_ai.advanced_reporting import report_generator
|
|
25
25
|
from sqlmap_ai.evasion_engine import evasion_engine
|
|
26
26
|
from utils.ai_providers import ai_manager, get_available_ai_providers
|
|
27
|
+
from typing import Optional
|
|
27
28
|
def main():
|
|
28
29
|
"""Enhanced main function with improved CLI and security"""
|
|
29
30
|
# Create enhanced CLI parser
|
|
@@ -45,15 +46,14 @@ def main():
|
|
|
45
46
|
return
|
|
46
47
|
|
|
47
48
|
# Check if we have a target
|
|
48
|
-
|
|
49
|
+
target_url = get_target_url_from_args(args)
|
|
50
|
+
if not target_url:
|
|
49
51
|
if args.interactive:
|
|
50
52
|
target_url = get_target_url()
|
|
51
53
|
else:
|
|
52
54
|
print_error("No target specified. Use -u/--url or -r/--request-file")
|
|
53
55
|
print_info("Use --help for usage information")
|
|
54
56
|
return
|
|
55
|
-
else:
|
|
56
|
-
target_url = args.url
|
|
57
57
|
|
|
58
58
|
try:
|
|
59
59
|
# Security validation
|
|
@@ -108,6 +108,10 @@ def build_sqlmap_options(args) -> list:
|
|
|
108
108
|
|
|
109
109
|
config = get_config()
|
|
110
110
|
|
|
111
|
+
# Add request file if provided
|
|
112
|
+
if args.request_file:
|
|
113
|
+
options.extend(["-r", args.request_file])
|
|
114
|
+
|
|
111
115
|
# Add risk and level
|
|
112
116
|
risk = args.risk or config.sqlmap.default_risk
|
|
113
117
|
level = args.level or config.sqlmap.default_level
|
|
@@ -425,6 +429,55 @@ def confirm_additional_step():
|
|
|
425
429
|
else:
|
|
426
430
|
print("Please answer with 'y' or 'n'.")
|
|
427
431
|
|
|
432
|
+
def extract_url_from_request_file(request_file_path: str) -> Optional[str]:
|
|
433
|
+
"""Extract target URL from HTTP request file"""
|
|
434
|
+
try:
|
|
435
|
+
with open(request_file_path, 'r', encoding='utf-8') as f:
|
|
436
|
+
content = f.read().strip()
|
|
437
|
+
|
|
438
|
+
# Parse the first line to get the request line
|
|
439
|
+
lines = content.split('\n')
|
|
440
|
+
if not lines:
|
|
441
|
+
return None
|
|
442
|
+
|
|
443
|
+
# First line should be: METHOD /path HTTP/1.1
|
|
444
|
+
request_line = lines[0].strip()
|
|
445
|
+
parts = request_line.split()
|
|
446
|
+
if len(parts) < 2:
|
|
447
|
+
return None
|
|
448
|
+
|
|
449
|
+
# Find Host header
|
|
450
|
+
host = None
|
|
451
|
+
for line in lines[1:]:
|
|
452
|
+
if line.lower().startswith('host:'):
|
|
453
|
+
host = line.split(':', 1)[1].strip()
|
|
454
|
+
break
|
|
455
|
+
|
|
456
|
+
if not host:
|
|
457
|
+
return None
|
|
458
|
+
|
|
459
|
+
# Determine protocol (default to http)
|
|
460
|
+
protocol = 'https' if 'https://' in content.lower() else 'http'
|
|
461
|
+
|
|
462
|
+
# Construct URL
|
|
463
|
+
path = parts[1]
|
|
464
|
+
if not path.startswith('/'):
|
|
465
|
+
path = '/' + path
|
|
466
|
+
|
|
467
|
+
return f"{protocol}://{host}{path}"
|
|
468
|
+
|
|
469
|
+
except Exception as e:
|
|
470
|
+
print_warning(f"Failed to extract URL from request file: {e}")
|
|
471
|
+
return None
|
|
472
|
+
|
|
473
|
+
def get_target_url_from_args(args) -> Optional[str]:
|
|
474
|
+
"""Get target URL from either URL argument or request file"""
|
|
475
|
+
if args.url:
|
|
476
|
+
return args.url
|
|
477
|
+
elif args.request_file:
|
|
478
|
+
return extract_url_from_request_file(args.request_file)
|
|
479
|
+
return None
|
|
480
|
+
|
|
428
481
|
def main_simple():
|
|
429
482
|
"""Simple mode - basic SQL injection testing without AI features"""
|
|
430
483
|
print("🔧 SQLMap AI Simple Mode")
|
|
@@ -414,8 +414,20 @@ class SQLMapAPIRunner:
|
|
|
414
414
|
task_id = self._create_new_task()
|
|
415
415
|
if not task_id:
|
|
416
416
|
return None
|
|
417
|
+
|
|
418
|
+
# Check if we're using a request file
|
|
419
|
+
using_request_file = False
|
|
420
|
+
if isinstance(options, list):
|
|
421
|
+
using_request_file = any(opt.startswith('-r') or opt.startswith('--request-file') for opt in options)
|
|
422
|
+
elif isinstance(options, str):
|
|
423
|
+
using_request_file = '-r' in options or '--request-file' in options
|
|
424
|
+
|
|
425
|
+
# Build command string
|
|
426
|
+
if using_request_file:
|
|
427
|
+
command_str = "sqlmap"
|
|
428
|
+
else:
|
|
429
|
+
command_str = f"sqlmap -u {target_url}"
|
|
417
430
|
|
|
418
|
-
command_str = f"sqlmap -u {target_url}"
|
|
419
431
|
if isinstance(options, list):
|
|
420
432
|
command_str += " " + " ".join(options)
|
|
421
433
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlmap-ai
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: AI-powered SQL injection testing tool with multiple AI providers
|
|
5
5
|
Home-page: https://github.com/atiilla/sqlmap-ai
|
|
6
6
|
Author: Atilla
|
|
@@ -83,7 +83,7 @@ An AI-powered wrapper around SQLMap that makes SQL injection testing more access
|
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
85
|
# Clone the repository
|
|
86
|
-
git clone https://github.com/
|
|
86
|
+
git clone https://github.com/atiilla/sqlmap-ai.git
|
|
87
87
|
cd sqlmap-ai
|
|
88
88
|
|
|
89
89
|
# Install the package
|
|
@@ -171,6 +171,60 @@ sqlmap-ai -u "http://example.com/page.php?id=1"
|
|
|
171
171
|
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider groq
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
### HTTP Request File Testing (NEW!)
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Test using HTTP request capture file
|
|
178
|
+
sqlmap-ai -r request.txt
|
|
179
|
+
|
|
180
|
+
# Enhanced mode with request file and adaptive testing
|
|
181
|
+
sqlmap-ai --enhanced --adaptive -r request.txt
|
|
182
|
+
|
|
183
|
+
# With specific AI provider
|
|
184
|
+
sqlmap-ai --enhanced -r request.txt --ai-provider groq
|
|
185
|
+
|
|
186
|
+
# Simple mode with request file
|
|
187
|
+
sqlmap-ai --simple -r request.txt
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Request File Format:**
|
|
191
|
+
```http
|
|
192
|
+
POST /login.php HTTP/1.1
|
|
193
|
+
Host: example.com
|
|
194
|
+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
|
|
195
|
+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9
|
|
196
|
+
Content-Type: application/x-www-form-urlencoded
|
|
197
|
+
Content-Length: 38
|
|
198
|
+
|
|
199
|
+
username=admin&password=test
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Creating Request Files:**
|
|
203
|
+
|
|
204
|
+
1. **From Browser Developer Tools:**
|
|
205
|
+
- Open Developer Tools (F12)
|
|
206
|
+
- Go to Network tab
|
|
207
|
+
- Perform the action you want to test
|
|
208
|
+
- Right-click the request → Copy → Copy as cURL
|
|
209
|
+
- Convert cURL to HTTP format
|
|
210
|
+
|
|
211
|
+
2. **From Burp Suite:**
|
|
212
|
+
- Intercept the request
|
|
213
|
+
- Right-click → Save item
|
|
214
|
+
- Save as .txt file
|
|
215
|
+
|
|
216
|
+
3. **From OWASP ZAP:**
|
|
217
|
+
- Right-click request → Export → HTTP Message
|
|
218
|
+
- Save as .txt file
|
|
219
|
+
|
|
220
|
+
**Supported Request Types:**
|
|
221
|
+
- [x] GET requests with parameters
|
|
222
|
+
- [x] POST requests with form data
|
|
223
|
+
- [x] POST requests with JSON data
|
|
224
|
+
- [x] Requests with cookies
|
|
225
|
+
- [x] Requests with custom headers
|
|
226
|
+
- [x] Multipart form data
|
|
227
|
+
|
|
174
228
|
### Advanced Testing
|
|
175
229
|
|
|
176
230
|
```bash
|
|
@@ -179,6 +233,9 @@ sqlmap-ai --adaptive
|
|
|
179
233
|
|
|
180
234
|
# Simple mode (basic SQLMap without AI)
|
|
181
235
|
sqlmap-ai --simple -u "http://example.com/page.php?id=1"
|
|
236
|
+
|
|
237
|
+
# Enhanced mode with custom options
|
|
238
|
+
sqlmap-ai --enhanced -u "http://example.com/page.php?id=1" --level 3 --risk 2
|
|
182
239
|
```
|
|
183
240
|
|
|
184
241
|
### AI Provider Selection
|
|
@@ -197,6 +254,90 @@ sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider openai
|
|
|
197
254
|
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider auto
|
|
198
255
|
```
|
|
199
256
|
|
|
257
|
+
### Complete Testing Workflow
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# 1. Basic scan with URL
|
|
261
|
+
sqlmap-ai -u "http://example.com/page.php?id=1"
|
|
262
|
+
|
|
263
|
+
# 2. Enhanced scan with request file
|
|
264
|
+
sqlmap-ai --enhanced --adaptive -r captured_request.txt
|
|
265
|
+
|
|
266
|
+
# 3. Advanced scan with custom options
|
|
267
|
+
sqlmap-ai --enhanced -r request.txt --level 4 --risk 3 --threads 10
|
|
268
|
+
|
|
269
|
+
# 4. Simple mode for quick testing
|
|
270
|
+
sqlmap-ai --simple -r request.txt --batch
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Testing Modes
|
|
274
|
+
|
|
275
|
+
### Enhanced Mode (Default)
|
|
276
|
+
Full AI-powered testing with advanced features:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Basic enhanced scan
|
|
280
|
+
sqlmap-ai --enhanced -u "http://example.com/page.php?id=1"
|
|
281
|
+
|
|
282
|
+
# With request file
|
|
283
|
+
sqlmap-ai --enhanced -r request.txt
|
|
284
|
+
|
|
285
|
+
# Adaptive testing with AI analysis
|
|
286
|
+
sqlmap-ai --enhanced --adaptive -r request.txt --ai-provider groq
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Features:**
|
|
290
|
+
- AI-powered vulnerability analysis
|
|
291
|
+
- Adaptive testing strategies
|
|
292
|
+
- WAF evasion techniques
|
|
293
|
+
- Beautiful HTML reports
|
|
294
|
+
- Risk assessment and remediation guidance
|
|
295
|
+
- Interactive CLI with progress tracking
|
|
296
|
+
- Multiple AI providers (Groq, OpenAI, Anthropic, Ollama)
|
|
297
|
+
- Advanced configuration management
|
|
298
|
+
- Request file support (NEW!)
|
|
299
|
+
|
|
300
|
+
### Simple Mode
|
|
301
|
+
Basic SQL injection testing without AI features:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Basic simple scan
|
|
305
|
+
sqlmap-ai --simple -u "http://example.com/page.php?id=1"
|
|
306
|
+
|
|
307
|
+
# With request file
|
|
308
|
+
sqlmap-ai --simple -r request.txt
|
|
309
|
+
|
|
310
|
+
# Quick batch mode
|
|
311
|
+
sqlmap-ai --simple -r request.txt --batch
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Features:**
|
|
315
|
+
- Basic SQL injection detection
|
|
316
|
+
- Standard SQLMap functionality
|
|
317
|
+
- Minimal dependencies
|
|
318
|
+
- Fast execution
|
|
319
|
+
- Request file support (NEW!)
|
|
320
|
+
- Simple text output
|
|
321
|
+
- Basic result saving
|
|
322
|
+
|
|
323
|
+
### Adaptive Mode
|
|
324
|
+
Intelligent step-by-step testing that adapts to the target:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Full adaptive testing
|
|
328
|
+
sqlmap-ai --enhanced --adaptive -r request.txt
|
|
329
|
+
|
|
330
|
+
# With specific AI provider
|
|
331
|
+
sqlmap-ai --enhanced --adaptive -r request.txt --ai-provider groq
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Adaptive Steps:**
|
|
335
|
+
1. **🟢 Initial Assessment** - Check for SQL injection vulnerabilities
|
|
336
|
+
2. **🟠 DBMS Identification** - Detect database type (MySQL, PostgreSQL, etc.)
|
|
337
|
+
3. **🔴 Enhanced Testing** - Try more aggressive techniques
|
|
338
|
+
4. **🟣 Data Extraction** - Extract valuable data from identified tables
|
|
339
|
+
5. **🤖 AI Analysis** - Get AI recommendations for next steps
|
|
340
|
+
|
|
200
341
|
## AI Providers Comparison
|
|
201
342
|
|
|
202
343
|
| Provider | Setup | Speed | Privacy | Cost |
|
|
@@ -270,6 +411,17 @@ ui:
|
|
|
270
411
|
- Run `sqlmap-ai --config-wizard` to fix setup
|
|
271
412
|
- Check `sqlmap-ai --validate-config` for issues
|
|
272
413
|
|
|
414
|
+
**5. "Request file not working"**
|
|
415
|
+
- Ensure request file has proper HTTP format
|
|
416
|
+
- Check that Host header is present
|
|
417
|
+
- Verify request file path is correct
|
|
418
|
+
- Try with `--simple` mode first: `sqlmap-ai --simple -r request.txt`
|
|
419
|
+
|
|
420
|
+
**6. "URL validation failed"**
|
|
421
|
+
- When using request files, the URL is automatically extracted
|
|
422
|
+
- Ensure request file contains valid HTTP request
|
|
423
|
+
- Check that the Host header matches the target domain
|
|
424
|
+
|
|
273
425
|
### Getting Help
|
|
274
426
|
|
|
275
427
|
```bash
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|