sqlmap-ai 2.0.5__tar.gz → 2.0.7__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.5/sqlmap_ai.egg-info → sqlmap_ai-2.0.7}/PKG-INFO +1 -1
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/pyproject.toml +1 -1
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/setup.py +19 -23
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/__init__.py +2 -6
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/adaptive_testing.py +1 -1
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/advanced_reporting.py +20 -25
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/ai_analyzer.py +1 -1
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/cli.py +45 -44
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/config_manager.py +41 -36
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/enhanced_cli.py +202 -152
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/evasion_engine.py +1 -5
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/html_reporter.py +16 -20
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/main.py +12 -11
- sqlmap_ai-2.0.7/sqlmap_ai/run.py +364 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/runner.py +19 -19
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/security_manager.py +26 -31
- sqlmap_ai-2.0.7/sqlmap_ai/startup.py +234 -0
- sqlmap_ai-2.0.7/sqlmap_ai/templates/report_template.html +131 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/ui.py +2 -10
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7/sqlmap_ai.egg-info}/PKG-INFO +1 -1
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai.egg-info/SOURCES.txt +2 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/tests/test_config_manager.py +8 -11
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/tests/test_security_manager.py +12 -15
- sqlmap_ai-2.0.7/utils/__init__.py +3 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/utils/ai_providers.py +19 -24
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/utils/groq_utils.py +0 -14
- sqlmap_ai-2.0.5/sqlmap_ai/templates/report_template.html +0 -222
- sqlmap_ai-2.0.5/utils/__init__.py +0 -6
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/LICENSE +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/README.md +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/setup.cfg +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/parser.py +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai/timeout_handler.py +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai.egg-info/dependency_links.txt +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai.egg-info/entry_points.txt +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai.egg-info/requires.txt +0 -0
- {sqlmap_ai-2.0.5 → sqlmap_ai-2.0.7}/sqlmap_ai.egg-info/top_level.txt +0 -0
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Setup script for SQLMap AI
|
|
4
|
-
Provides backward compatibility and additional installation features
|
|
5
|
-
"""
|
|
6
2
|
|
|
7
3
|
import os
|
|
8
4
|
import sys
|
|
@@ -19,7 +15,7 @@ def read_readme():
|
|
|
19
15
|
|
|
20
16
|
# Read requirements from pyproject.toml
|
|
21
17
|
def get_requirements():
|
|
22
|
-
|
|
18
|
+
|
|
23
19
|
try:
|
|
24
20
|
import tomllib
|
|
25
21
|
except ImportError:
|
|
@@ -33,7 +29,7 @@ def get_requirements():
|
|
|
33
29
|
return []
|
|
34
30
|
|
|
35
31
|
def install_sqlmap():
|
|
36
|
-
|
|
32
|
+
|
|
37
33
|
try:
|
|
38
34
|
# Check if sqlmap is already installed
|
|
39
35
|
result = subprocess.run(
|
|
@@ -43,7 +39,7 @@ def install_sqlmap():
|
|
|
43
39
|
timeout=10
|
|
44
40
|
)
|
|
45
41
|
if result.returncode == 0:
|
|
46
|
-
print("
|
|
42
|
+
print("✓ SQLMap is already installed")
|
|
47
43
|
return True
|
|
48
44
|
except (subprocess.TimeoutExpired, FileNotFoundError, subprocess.SubprocessError):
|
|
49
45
|
pass
|
|
@@ -56,19 +52,19 @@ def install_sqlmap():
|
|
|
56
52
|
capture_output=True,
|
|
57
53
|
text=True
|
|
58
54
|
)
|
|
59
|
-
print("
|
|
55
|
+
print("✓ SQLMap installed successfully")
|
|
60
56
|
return True
|
|
61
57
|
except subprocess.CalledProcessError as e:
|
|
62
|
-
print(f"
|
|
58
|
+
print(f"X Failed to install SQLMap: {e}")
|
|
63
59
|
print("Please install SQLMap manually: pip install sqlmap")
|
|
64
60
|
return False
|
|
65
61
|
|
|
66
62
|
def create_env_template():
|
|
67
|
-
|
|
63
|
+
|
|
68
64
|
# Use current working directory instead of project root
|
|
69
65
|
env_file = Path.cwd() / ".env"
|
|
70
66
|
if env_file.exists():
|
|
71
|
-
print("
|
|
67
|
+
print("✓ .env file already exists")
|
|
72
68
|
return True
|
|
73
69
|
|
|
74
70
|
print("📝 Creating .env template...")
|
|
@@ -108,15 +104,15 @@ DEFAULT_TIMEOUT=300
|
|
|
108
104
|
try:
|
|
109
105
|
with open(env_file, 'w') as f:
|
|
110
106
|
f.write(env_content)
|
|
111
|
-
print("
|
|
107
|
+
print("✓ .env template created")
|
|
112
108
|
print(" Please edit .env file and add your API keys")
|
|
113
109
|
return True
|
|
114
110
|
except Exception as e:
|
|
115
|
-
print(f"
|
|
111
|
+
print(f"X Failed to create .env template: {e}")
|
|
116
112
|
return False
|
|
117
113
|
|
|
118
114
|
def setup_directories():
|
|
119
|
-
|
|
115
|
+
|
|
120
116
|
print("📁 Setting up directories...")
|
|
121
117
|
|
|
122
118
|
directories = [
|
|
@@ -128,15 +124,15 @@ def setup_directories():
|
|
|
128
124
|
try:
|
|
129
125
|
for directory in directories:
|
|
130
126
|
directory.mkdir(exist_ok=True)
|
|
131
|
-
print("
|
|
127
|
+
print("✓ Directories created")
|
|
132
128
|
return True
|
|
133
129
|
except Exception as e:
|
|
134
|
-
print(f"
|
|
130
|
+
print(f"X Failed to create directories: {e}")
|
|
135
131
|
return False
|
|
136
132
|
|
|
137
133
|
def run_post_install():
|
|
138
|
-
|
|
139
|
-
print("\
|
|
134
|
+
|
|
135
|
+
print("\nRunning post-installation tasks...")
|
|
140
136
|
|
|
141
137
|
success = True
|
|
142
138
|
|
|
@@ -153,13 +149,13 @@ def run_post_install():
|
|
|
153
149
|
success = False
|
|
154
150
|
|
|
155
151
|
if success:
|
|
156
|
-
print("\
|
|
152
|
+
print("\nInstallation completed successfully!")
|
|
157
153
|
print("\nNext steps:")
|
|
158
154
|
print("1. Edit .env file and add your API keys")
|
|
159
155
|
print("2. Run: sqlmap-ai --config-wizard")
|
|
160
156
|
print("3. Run: sqlmap-ai --help")
|
|
161
157
|
else:
|
|
162
|
-
print("\n⚠️
|
|
158
|
+
print("\n⚠️ Installation completed with issues")
|
|
163
159
|
print("Please resolve the issues above before using SQLMap AI")
|
|
164
160
|
|
|
165
161
|
return success
|
|
@@ -171,12 +167,12 @@ if __name__ == "__main__":
|
|
|
171
167
|
# Run setup first
|
|
172
168
|
setup(
|
|
173
169
|
name="sqlmap-ai",
|
|
174
|
-
version="2.0.
|
|
170
|
+
version="2.0.7",
|
|
175
171
|
description="AI-powered SQL injection testing tool with multiple AI providers",
|
|
176
172
|
long_description=read_readme(),
|
|
177
173
|
long_description_content_type="text/markdown",
|
|
178
174
|
author="Atilla",
|
|
179
|
-
author_email="
|
|
175
|
+
author_email="attilla@tuta.io",
|
|
180
176
|
url="https://github.com/atiilla/sqlmap-ai",
|
|
181
177
|
packages=find_packages(include=["sqlmap_ai*", "utils*"]),
|
|
182
178
|
include_package_data=True,
|
|
@@ -239,7 +235,7 @@ if __name__ == "__main__":
|
|
|
239
235
|
long_description=read_readme(),
|
|
240
236
|
long_description_content_type="text/markdown",
|
|
241
237
|
author="Atilla",
|
|
242
|
-
author_email="
|
|
238
|
+
author_email="attilla@tuta.io",
|
|
243
239
|
url="https://github.com/atiilla/sqlmap-ai",
|
|
244
240
|
packages=find_packages(include=["sqlmap_ai*", "utils*"]),
|
|
245
241
|
include_package_data=True,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
""
|
|
2
|
-
SQLMap AI - AI-powered SQL injection testing tool
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
__version__ = "2.0.0"
|
|
1
|
+
__version__ = "2.0.7"
|
|
6
2
|
__author__ = "Atilla"
|
|
7
|
-
__email__ = "
|
|
3
|
+
__email__ = "atilla@tuta.io"
|
|
8
4
|
__description__ = "AI-powered SQL injection testing tool with multiple AI providers"
|
|
9
5
|
|
|
10
6
|
# Import main components
|
|
@@ -24,7 +24,7 @@ class AdaptiveTestingEngine:
|
|
|
24
24
|
self.test_parameter = test_parameter # Specific parameter(s) to test
|
|
25
25
|
|
|
26
26
|
def _add_param_option(self, options: List[str]) -> List[str]:
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
if self.test_parameter:
|
|
29
29
|
options.append(f"-p {self.test_parameter}")
|
|
30
30
|
return options
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Advanced reporting system with HTML, PDF, and interactive visualizations.
|
|
3
|
-
Provides comprehensive vulnerability analysis and remediation guidance.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
1
|
import json
|
|
7
2
|
import time
|
|
8
3
|
import os
|
|
@@ -36,7 +31,7 @@ except ImportError:
|
|
|
36
31
|
|
|
37
32
|
@dataclass
|
|
38
33
|
class VulnerabilityDetails:
|
|
39
|
-
|
|
34
|
+
|
|
40
35
|
parameter: str
|
|
41
36
|
injection_type: str
|
|
42
37
|
payload: str
|
|
@@ -50,7 +45,7 @@ class VulnerabilityDetails:
|
|
|
50
45
|
|
|
51
46
|
@dataclass
|
|
52
47
|
class ScanStatistics:
|
|
53
|
-
|
|
48
|
+
|
|
54
49
|
total_requests: int
|
|
55
50
|
successful_injections: int
|
|
56
51
|
false_positives: int
|
|
@@ -62,7 +57,7 @@ class ScanStatistics:
|
|
|
62
57
|
|
|
63
58
|
@dataclass
|
|
64
59
|
class RemediationGuidance:
|
|
65
|
-
|
|
60
|
+
|
|
66
61
|
immediate_actions: List[str]
|
|
67
62
|
long_term_fixes: List[str]
|
|
68
63
|
secure_coding_practices: List[str]
|
|
@@ -71,7 +66,7 @@ class RemediationGuidance:
|
|
|
71
66
|
|
|
72
67
|
|
|
73
68
|
class VulnerabilityAssessment:
|
|
74
|
-
|
|
69
|
+
|
|
75
70
|
|
|
76
71
|
def __init__(self):
|
|
77
72
|
self.risk_factors = {
|
|
@@ -106,7 +101,7 @@ class VulnerabilityAssessment:
|
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
def assess_vulnerability(self, vuln_data: Dict[str, Any]) -> VulnerabilityDetails:
|
|
109
|
-
|
|
104
|
+
|
|
110
105
|
|
|
111
106
|
# Determine injection type
|
|
112
107
|
injection_type = self._determine_injection_type(vuln_data)
|
|
@@ -134,7 +129,7 @@ class VulnerabilityAssessment:
|
|
|
134
129
|
)
|
|
135
130
|
|
|
136
131
|
def _determine_injection_type(self, vuln_data: Dict[str, Any]) -> str:
|
|
137
|
-
|
|
132
|
+
|
|
138
133
|
techniques = vuln_data.get('techniques', [])
|
|
139
134
|
|
|
140
135
|
if 'time-based blind' in str(techniques).lower():
|
|
@@ -151,7 +146,7 @@ class VulnerabilityAssessment:
|
|
|
151
146
|
return "Generic SQL Injection"
|
|
152
147
|
|
|
153
148
|
def _calculate_risk_score(self, vuln_data: Dict[str, Any]) -> int:
|
|
154
|
-
|
|
149
|
+
|
|
155
150
|
base_score = 60 # Base vulnerability score
|
|
156
151
|
|
|
157
152
|
# Database privileges factor
|
|
@@ -180,7 +175,7 @@ class VulnerabilityAssessment:
|
|
|
180
175
|
return min(base_score, 100)
|
|
181
176
|
|
|
182
177
|
def _get_risk_level(self, score: int) -> str:
|
|
183
|
-
|
|
178
|
+
|
|
184
179
|
if score >= 90:
|
|
185
180
|
return "CRITICAL"
|
|
186
181
|
elif score >= 70:
|
|
@@ -193,7 +188,7 @@ class VulnerabilityAssessment:
|
|
|
193
188
|
return "INFO"
|
|
194
189
|
|
|
195
190
|
def _assess_exploitation_complexity(self, vuln_data: Dict[str, Any]) -> str:
|
|
196
|
-
|
|
191
|
+
|
|
197
192
|
factors = 0
|
|
198
193
|
|
|
199
194
|
# WAF presence increases complexity
|
|
@@ -226,7 +221,7 @@ class VulnerabilityAssessment:
|
|
|
226
221
|
return "Trivial"
|
|
227
222
|
|
|
228
223
|
def _calculate_remediation_priority(self, risk_score: int, complexity: str) -> str:
|
|
229
|
-
|
|
224
|
+
|
|
230
225
|
if risk_score >= 90:
|
|
231
226
|
return "IMMEDIATE"
|
|
232
227
|
elif risk_score >= 70:
|
|
@@ -240,7 +235,7 @@ class VulnerabilityAssessment:
|
|
|
240
235
|
|
|
241
236
|
|
|
242
237
|
class AdvancedReportGenerator:
|
|
243
|
-
|
|
238
|
+
|
|
244
239
|
|
|
245
240
|
def __init__(self):
|
|
246
241
|
self.vulnerability_assessor = VulnerabilityAssessment()
|
|
@@ -249,7 +244,7 @@ class AdvancedReportGenerator:
|
|
|
249
244
|
self._create_templates()
|
|
250
245
|
|
|
251
246
|
def _create_templates(self):
|
|
252
|
-
|
|
247
|
+
|
|
253
248
|
if not HAS_JINJA2:
|
|
254
249
|
return
|
|
255
250
|
|
|
@@ -395,7 +390,7 @@ class AdvancedReportGenerator:
|
|
|
395
390
|
output_format: str = "html",
|
|
396
391
|
output_path: Optional[str] = None
|
|
397
392
|
) -> str:
|
|
398
|
-
|
|
393
|
+
|
|
399
394
|
|
|
400
395
|
# Process scan data
|
|
401
396
|
vulnerabilities = self._process_vulnerabilities(scan_data)
|
|
@@ -411,7 +406,7 @@ class AdvancedReportGenerator:
|
|
|
411
406
|
)
|
|
412
407
|
|
|
413
408
|
def _process_vulnerabilities(self, scan_data: Dict[str, Any]) -> List[VulnerabilityDetails]:
|
|
414
|
-
|
|
409
|
+
|
|
415
410
|
vulnerabilities = []
|
|
416
411
|
|
|
417
412
|
scan_history = scan_data.get('scan_history', [])
|
|
@@ -441,7 +436,7 @@ class AdvancedReportGenerator:
|
|
|
441
436
|
scan_data: Dict[str, Any],
|
|
442
437
|
vulnerabilities: List[VulnerabilityDetails]
|
|
443
438
|
) -> Dict[str, Any]:
|
|
444
|
-
|
|
439
|
+
|
|
445
440
|
|
|
446
441
|
# Calculate overall risk
|
|
447
442
|
if vulnerabilities:
|
|
@@ -482,7 +477,7 @@ class AdvancedReportGenerator:
|
|
|
482
477
|
}
|
|
483
478
|
|
|
484
479
|
def _generate_remediation_guidance(self, vulnerabilities: List[VulnerabilityDetails]) -> RemediationGuidance:
|
|
485
|
-
|
|
480
|
+
|
|
486
481
|
|
|
487
482
|
immediate_actions = [
|
|
488
483
|
"Immediately patch or disable vulnerable endpoints",
|
|
@@ -542,7 +537,7 @@ class AdvancedReportGenerator:
|
|
|
542
537
|
remediation: RemediationGuidance,
|
|
543
538
|
output_path: Optional[str] = None
|
|
544
539
|
) -> str:
|
|
545
|
-
|
|
540
|
+
|
|
546
541
|
|
|
547
542
|
if not HAS_JINJA2:
|
|
548
543
|
return self._generate_simple_html_report(scan_data, vulnerabilities, scan_summary)
|
|
@@ -587,7 +582,7 @@ class AdvancedReportGenerator:
|
|
|
587
582
|
vulnerabilities: List[VulnerabilityDetails],
|
|
588
583
|
scan_summary: Dict[str, Any]
|
|
589
584
|
) -> str:
|
|
590
|
-
|
|
585
|
+
|
|
591
586
|
|
|
592
587
|
html_content = f"""
|
|
593
588
|
<!DOCTYPE html>
|
|
@@ -653,7 +648,7 @@ class AdvancedReportGenerator:
|
|
|
653
648
|
remediation: RemediationGuidance,
|
|
654
649
|
output_path: Optional[str] = None
|
|
655
650
|
) -> str:
|
|
656
|
-
|
|
651
|
+
|
|
657
652
|
|
|
658
653
|
report_data = {
|
|
659
654
|
"metadata": {
|
|
@@ -684,7 +679,7 @@ class AdvancedReportGenerator:
|
|
|
684
679
|
|
|
685
680
|
|
|
686
681
|
def _generate_timeline_chart(self, scan_history: List[Dict[str, Any]]) -> str:
|
|
687
|
-
|
|
682
|
+
|
|
688
683
|
|
|
689
684
|
if not HAS_PLOTLY:
|
|
690
685
|
return ""
|
|
@@ -172,7 +172,7 @@ def ai_suggest_next_steps(report, scan_history=None, extracted_data=None, ai_pro
|
|
|
172
172
|
return valid_options
|
|
173
173
|
|
|
174
174
|
def create_simple_prompt(report, structured_info, scan_history=None, extracted_data=None):
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
prompt = """
|
|
177
177
|
You are a SQLMap expert. Analyze this SQL injection scan result and suggest the next steps.
|
|
178
178
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
SQLMap AI CLI Entry Point
|
|
4
|
-
Handles installation tasks and provides the main interface
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
2
|
import sys
|
|
8
3
|
import os
|
|
9
4
|
import subprocess
|
|
@@ -16,7 +11,6 @@ project_root = Path(__file__).parent.parent
|
|
|
16
11
|
sys.path.insert(0, str(project_root))
|
|
17
12
|
|
|
18
13
|
def check_sqlmap_installation() -> bool:
|
|
19
|
-
"""Check if SQLMap is installed and accessible"""
|
|
20
14
|
try:
|
|
21
15
|
# Try to run sqlmap --version
|
|
22
16
|
result = subprocess.run(
|
|
@@ -30,14 +24,13 @@ def check_sqlmap_installation() -> bool:
|
|
|
30
24
|
return False
|
|
31
25
|
|
|
32
26
|
def install_sqlmap() -> bool:
|
|
33
|
-
"
|
|
34
|
-
print("🔍 Checking SQLMap installation...")
|
|
27
|
+
print("[INFO] Checking SQLMap installation...")
|
|
35
28
|
|
|
36
29
|
if check_sqlmap_installation():
|
|
37
|
-
print("
|
|
30
|
+
print("[SUCCESS] SQLMap is already installed")
|
|
38
31
|
return True
|
|
39
32
|
|
|
40
|
-
print("
|
|
33
|
+
print("[INFO] SQLMap not found. Installing...")
|
|
41
34
|
|
|
42
35
|
# Try pip installation first
|
|
43
36
|
try:
|
|
@@ -49,10 +42,10 @@ def install_sqlmap() -> bool:
|
|
|
49
42
|
timeout=60
|
|
50
43
|
)
|
|
51
44
|
if result.returncode == 0:
|
|
52
|
-
print("
|
|
45
|
+
print("[SUCCESS] SQLMap installed via pip")
|
|
53
46
|
return True
|
|
54
47
|
except (subprocess.TimeoutExpired, subprocess.SubprocessError) as e:
|
|
55
|
-
print(f"
|
|
48
|
+
print(f" [ERROR] Pip installation failed: {e}")
|
|
56
49
|
|
|
57
50
|
# Try git clone as fallback
|
|
58
51
|
try:
|
|
@@ -68,12 +61,12 @@ def install_sqlmap() -> bool:
|
|
|
68
61
|
timeout=120
|
|
69
62
|
)
|
|
70
63
|
if result.returncode == 0:
|
|
71
|
-
print("
|
|
64
|
+
print("[SUCCESS] SQLMap cloned from repository")
|
|
72
65
|
return True
|
|
73
66
|
except (subprocess.TimeoutExpired, subprocess.SubprocessError) as e:
|
|
74
|
-
print(f"
|
|
67
|
+
print(f" [ERROR] Git clone failed: {e}")
|
|
75
68
|
|
|
76
|
-
print("
|
|
69
|
+
print("[ERROR] Failed to install SQLMap automatically")
|
|
77
70
|
print("Please install SQLMap manually:")
|
|
78
71
|
print(" pip install sqlmap")
|
|
79
72
|
print(" or")
|
|
@@ -81,14 +74,14 @@ def install_sqlmap() -> bool:
|
|
|
81
74
|
return False
|
|
82
75
|
|
|
83
76
|
def create_env_template() -> bool:
|
|
84
|
-
|
|
77
|
+
|
|
85
78
|
# Use current working directory instead of project root
|
|
86
79
|
env_file = Path.cwd() / ".env"
|
|
87
80
|
if env_file.exists():
|
|
88
|
-
print("
|
|
81
|
+
print("[SUCCESS] .env file already exists")
|
|
89
82
|
return True
|
|
90
83
|
|
|
91
|
-
print("
|
|
84
|
+
print("[INFO] Creating .env template...")
|
|
92
85
|
|
|
93
86
|
env_content = """# SQLMap AI Configuration
|
|
94
87
|
# Copy this to .env file and fill in your API keys
|
|
@@ -125,16 +118,16 @@ DEFAULT_TIMEOUT=300
|
|
|
125
118
|
try:
|
|
126
119
|
with open(env_file, 'w') as f:
|
|
127
120
|
f.write(env_content)
|
|
128
|
-
print("
|
|
121
|
+
print("[SUCCESS] .env template created")
|
|
129
122
|
print(" Please edit .env file and add your API keys")
|
|
130
123
|
return True
|
|
131
124
|
except Exception as e:
|
|
132
|
-
print(f"
|
|
125
|
+
print(f"[ERROR] Failed to create .env template: {e}")
|
|
133
126
|
return False
|
|
134
127
|
|
|
135
128
|
def setup_directories() -> bool:
|
|
136
|
-
|
|
137
|
-
print("
|
|
129
|
+
|
|
130
|
+
print("[INFO] Setting up directories...")
|
|
138
131
|
|
|
139
132
|
directories = [
|
|
140
133
|
Path.cwd() / "reports",
|
|
@@ -145,25 +138,25 @@ def setup_directories() -> bool:
|
|
|
145
138
|
try:
|
|
146
139
|
for directory in directories:
|
|
147
140
|
directory.mkdir(exist_ok=True)
|
|
148
|
-
print("
|
|
141
|
+
print("[SUCCESS] Directories created")
|
|
149
142
|
return True
|
|
150
143
|
except Exception as e:
|
|
151
|
-
print(f"
|
|
144
|
+
print(f"[ERROR] Failed to create directories: {e}")
|
|
152
145
|
return False
|
|
153
146
|
|
|
154
147
|
def run_installation_checks() -> bool:
|
|
155
|
-
|
|
156
|
-
print("
|
|
148
|
+
|
|
149
|
+
print("SQLMap AI Installation Check")
|
|
157
150
|
print("=" * 50)
|
|
158
151
|
|
|
159
152
|
success = True
|
|
160
153
|
|
|
161
154
|
# Check Python version
|
|
162
155
|
if sys.version_info < (3, 8):
|
|
163
|
-
print("
|
|
156
|
+
print("[ERROR] Python 3.8 or higher is required")
|
|
164
157
|
return False
|
|
165
158
|
|
|
166
|
-
print(f"
|
|
159
|
+
print(f"[SUCCESS] Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
|
|
167
160
|
|
|
168
161
|
# Install SQLMap
|
|
169
162
|
if not install_sqlmap():
|
|
@@ -178,37 +171,45 @@ def run_installation_checks() -> bool:
|
|
|
178
171
|
success = False
|
|
179
172
|
|
|
180
173
|
if success:
|
|
181
|
-
print("\
|
|
174
|
+
print("\nInstallation check completed successfully!")
|
|
182
175
|
print("\nNext steps:")
|
|
183
176
|
print("1. Edit .env file and add your API keys")
|
|
184
177
|
print("2. Run: sqlmap-ai --config-wizard")
|
|
185
178
|
print("3. Run: sqlmap-ai --help")
|
|
186
179
|
else:
|
|
187
|
-
print("\n
|
|
180
|
+
print("\n[WARNING] Installation check completed with issues")
|
|
188
181
|
print("Please resolve the issues above before using SQLMap AI")
|
|
189
182
|
|
|
190
183
|
return success
|
|
191
184
|
|
|
192
185
|
def main():
|
|
193
|
-
"""Main CLI entry point"""
|
|
194
|
-
# Check if this is the first run (installation check)
|
|
195
|
-
if len(sys.argv) == 1 or "--install-check" in sys.argv:
|
|
196
|
-
if run_installation_checks():
|
|
197
|
-
sys.exit(0)
|
|
198
|
-
else:
|
|
199
|
-
sys.exit(1)
|
|
200
186
|
|
|
201
|
-
# Import and run the main application
|
|
187
|
+
# Import and run the main application with new startup system
|
|
202
188
|
try:
|
|
203
|
-
|
|
189
|
+
# Import the main run.py from project root
|
|
190
|
+
import sys
|
|
191
|
+
from pathlib import Path
|
|
192
|
+
|
|
193
|
+
# Add project root to path
|
|
194
|
+
project_root = Path(__file__).parent.parent
|
|
195
|
+
sys.path.insert(0, str(project_root))
|
|
196
|
+
|
|
197
|
+
from sqlmap_ai.run import main as run_main
|
|
204
198
|
run_main()
|
|
199
|
+
|
|
205
200
|
except ImportError as e:
|
|
206
|
-
print(f"
|
|
207
|
-
print("
|
|
208
|
-
|
|
209
|
-
|
|
201
|
+
print(f"[ERROR] Failed to import main application: {e}")
|
|
202
|
+
print("Running fallback installation check...")
|
|
203
|
+
|
|
204
|
+
# Fallback to old installation check if new system fails
|
|
205
|
+
if run_installation_checks():
|
|
206
|
+
print("\nTry running 'sqlmap-ai' again after installation completes.")
|
|
207
|
+
sys.exit(0)
|
|
208
|
+
else:
|
|
209
|
+
sys.exit(1)
|
|
210
|
+
|
|
210
211
|
except Exception as e:
|
|
211
|
-
print(f"
|
|
212
|
+
print(f"[ERROR] Application error: {e}")
|
|
212
213
|
sys.exit(1)
|
|
213
214
|
|
|
214
215
|
if __name__ == "__main__":
|