├── image_sqlmapcg.GIF
├── image_sqlmapcg.png
├── vite.config.js
├── package.json
├── js
├── components
│ ├── detectionOptions.js
│ ├── connectionOptions.js
│ ├── crawlingOptions.js
│ ├── optimizationOptions.js
│ ├── techniqueOptions.js
│ ├── enumerationOptions.js
│ ├── advancedOptions.js
│ └── targetOptions.js
├── theme.js
└── main.js
├── run.sh
├── script.js
├── README.md
├── styles.css
└── index.html
/image_sqlmapcg.GIF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Acorzo1983/SQLMapCG/HEAD/image_sqlmapcg.GIF
--------------------------------------------------------------------------------
/image_sqlmapcg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Acorzo1983/SQLMapCG/HEAD/image_sqlmapcg.png
--------------------------------------------------------------------------------
/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | export default defineConfig({
4 | server: {
5 | port: 3000,
6 | open: true
7 | }
8 | });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sqlmap-generator",
3 | "private": true,
4 | "version": "1.1.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {},
12 | "devDependencies": {
13 | "vite": "^5.0.0"
14 | }
15 | }
--------------------------------------------------------------------------------
/js/components/detectionOptions.js:
--------------------------------------------------------------------------------
1 | export function addDetectionOptions(command) {
2 | const level = document.getElementById('level').value;
3 | const risk = document.getElementById('risk').value;
4 | const verbosity = document.getElementById('verbosity').value;
5 |
6 | command += ` --level=${level} --risk=${risk} -v ${verbosity}`;
7 |
8 | return command;
9 | }
--------------------------------------------------------------------------------
/js/components/connectionOptions.js:
--------------------------------------------------------------------------------
1 | export function addConnectionOptions(command) {
2 | if (document.getElementById('random-agent').checked) command += ' --random-agent';
3 | if (document.getElementById('tor').checked) command += ' --tor';
4 |
5 | const proxy = document.getElementById('proxy').value;
6 | if (proxy) command += ` --proxy="${proxy}"`;
7 |
8 | return command;
9 | }
--------------------------------------------------------------------------------
/js/components/crawlingOptions.js:
--------------------------------------------------------------------------------
1 | export function addCrawlingOptions(command) {
2 | const crawlDepth = document.getElementById('crawl-depth').value;
3 | const crawlExclude = document.getElementById('crawl-exclude').value;
4 |
5 | if (crawlDepth) command += ` --crawl=${crawlDepth}`;
6 | if (crawlExclude) command += ` --crawl-exclude="${crawlExclude}"`;
7 |
8 | return command;
9 | }
--------------------------------------------------------------------------------
/js/components/optimizationOptions.js:
--------------------------------------------------------------------------------
1 | export function addOptimizationOptions(command) {
2 | if (document.getElementById('optimize').checked) command += ' -o';
3 | const threads = document.getElementById('threads').value;
4 | if (threads > 1) command += ` --threads=${threads}`;
5 | if (document.getElementById('keep-alive').checked) command += ' --keep-alive';
6 |
7 | return command;
8 | }
--------------------------------------------------------------------------------
/js/components/techniqueOptions.js:
--------------------------------------------------------------------------------
1 | export function addTechniqueOptions(command) {
2 | let techniques = '';
3 | ['b', 'e', 'u', 's', 't', 'q'].forEach(tech => {
4 | if (document.getElementById(`tech-${tech}`).checked) {
5 | techniques += tech.toUpperCase();
6 | }
7 | });
8 |
9 | if (techniques) command += ` --technique=${techniques}`;
10 |
11 | return command;
12 | }
--------------------------------------------------------------------------------
/js/components/enumerationOptions.js:
--------------------------------------------------------------------------------
1 | export function addEnumerationOptions(command) {
2 | const enumOptions = [
3 | 'all', 'banner', 'current-user', 'current-db', 'passwords',
4 | 'dbs', 'tables', 'columns', 'schema', 'dump'
5 | ];
6 |
7 | enumOptions.forEach(opt => {
8 | if (document.getElementById(opt).checked) {
9 | command += ` --${opt}`;
10 | }
11 | });
12 |
13 | return command;
14 | }
--------------------------------------------------------------------------------
/js/components/advancedOptions.js:
--------------------------------------------------------------------------------
1 | export function addAdvancedOptions(command) {
2 | const advancedOptions = ['os-shell', 'os-pwn', 'batch', 'flush-session'];
3 | advancedOptions.forEach(opt => {
4 | if (document.getElementById(opt).checked) {
5 | command += ` --${opt}`;
6 | }
7 | });
8 |
9 | const tamper = document.getElementById('tamper').value;
10 | if (tamper) command += ` --tamper="${tamper}"`;
11 |
12 | return command;
13 | }
--------------------------------------------------------------------------------
/js/components/targetOptions.js:
--------------------------------------------------------------------------------
1 | export function addTargetOptions(command) {
2 | const url = document.getElementById('url').value;
3 | const googleDork = document.getElementById('google-dork').value;
4 | const data = document.getElementById('data').value;
5 | const cookie = document.getElementById('cookie').value;
6 |
7 | if (url) command += ` -u "${url}"`;
8 | if (googleDork) command += ` -g "${googleDork}"`;
9 | if (data) command += ` --data="${data}"`;
10 | if (cookie) command += ` --cookie="${cookie}"`;
11 |
12 | return command;
13 | }
--------------------------------------------------------------------------------
/js/theme.js:
--------------------------------------------------------------------------------
1 | export function toggleTheme() {
2 | const html = document.documentElement;
3 | const isDark = html.classList.contains('dark');
4 | html.classList.toggle('dark', !isDark);
5 | html.classList.toggle('light', isDark);
6 | localStorage.setItem('theme', isDark ? 'light' : 'dark');
7 | }
8 |
9 | // Initialize theme from localStorage
10 | export function initTheme() {
11 | const savedTheme = localStorage.getItem('theme');
12 | if (savedTheme) {
13 | document.documentElement.classList.remove('dark', 'light');
14 | document.documentElement.classList.add(savedTheme);
15 | }
16 | }
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Function to check if a port is in use
4 | is_port_in_use() {
5 | if lsof -i :$1 >/dev/null; then
6 | return 0 # port is in use
7 | else
8 | return 1 # port is available
9 | fi
10 | }
11 |
12 | # List of default ports to check
13 | PORTS=(8082 8083 8084 8085)
14 | SELECTED_PORT=""
15 |
16 | # Find the first available port from the default list
17 | for PORT in "${PORTS[@]}"; do
18 | if ! is_port_in_use "$PORT"; then
19 | SELECTED_PORT=$PORT
20 | break
21 | fi
22 | done
23 |
24 | # If no default port found in the list, prompt the user to specify another port
25 | if [ -z "$SELECTED_PORT" ]; then
26 | echo "None of the default ports (8082-8085) are available."
27 | while true; do
28 | read -p "Please specify a port that is available: " user_port
29 | if ! [[ "$user_port" =~ ^[0-9]+$ ]]; then
30 | echo "Invalid input. Please enter a numeric port."
31 | elif is_port_in_use "$user_port"; then
32 | echo "Port $user_port is already in use. Please choose another."
33 | else
34 | SELECTED_PORT=$user_port
35 | break
36 | fi
37 | done
38 | else
39 | echo "Port $SELECTED_PORT is available."
40 | fi
41 |
42 | # Start HTTP server on the selected port
43 | echo "Starting HTTP server on port $SELECTED_PORT..."
44 | python3 -m http.server "$SELECTED_PORT" &
45 |
46 | # Open Firefox with the chosen port
47 | firefox "http://localhost:$SELECTED_PORT" &
48 |
--------------------------------------------------------------------------------
/js/main.js:
--------------------------------------------------------------------------------
1 | import { addTargetOptions } from './components/targetOptions.js';
2 | import { addCrawlingOptions } from './components/crawlingOptions.js';
3 | import { addConnectionOptions } from './components/connectionOptions.js';
4 | import { addOptimizationOptions } from './components/optimizationOptions.js';
5 | import { addDetectionOptions } from './components/detectionOptions.js';
6 | import { addTechniqueOptions } from './components/techniqueOptions.js';
7 | import { addEnumerationOptions } from './components/enumerationOptions.js';
8 | import { addAdvancedOptions } from './components/advancedOptions.js';
9 | import { toggleTheme, initTheme } from './theme.js';
10 |
11 | // Initialize event listeners when DOM is loaded
12 | document.addEventListener('DOMContentLoaded', () => {
13 | // Initialize theme
14 | initTheme();
15 |
16 | // Add event listeners
17 | document.getElementById('theme-toggle').addEventListener('click', toggleTheme);
18 | document.getElementById('generate-btn').addEventListener('click', generateCommand);
19 | document.getElementById('copy-btn').addEventListener('click', copyCommand);
20 |
21 | // Handle incompatible options
22 | document.getElementById('all').addEventListener('change', function() {
23 | const enumOptions = [
24 | 'banner', 'current-user', 'current-db', 'passwords',
25 | 'dbs', 'tables', 'columns', 'schema', 'dump'
26 | ];
27 | enumOptions.forEach(opt => {
28 | const el = document.getElementById(opt);
29 | el.disabled = this.checked;
30 | if (this.checked) el.checked = false;
31 | });
32 | });
33 | });
34 |
35 | function generateCommand() {
36 | let command = 'sqlmap';
37 |
38 | command = addTargetOptions(command);
39 | command = addCrawlingOptions(command);
40 | command = addConnectionOptions(command);
41 | command = addOptimizationOptions(command);
42 | command = addDetectionOptions(command);
43 | command = addTechniqueOptions(command);
44 | command = addEnumerationOptions(command);
45 | command = addAdvancedOptions(command);
46 |
47 | document.getElementById('output').textContent = command;
48 | }
49 |
50 | function copyCommand() {
51 | const output = document.getElementById('output');
52 | navigator.clipboard.writeText(output.textContent)
53 | .then(() => {
54 | const btn = document.getElementById('copy-btn');
55 | btn.textContent = 'Copied!';
56 | setTimeout(() => btn.textContent = 'Copy Command', 2000);
57 | })
58 | .catch(err => console.error('Failed to copy:', err));
59 | }
--------------------------------------------------------------------------------
/script.js:
--------------------------------------------------------------------------------
1 | // All previous functions remain the same until generateCommand()
2 |
3 | function generateCommand() {
4 | let command = 'sqlmap';
5 |
6 | // Target options
7 | const url = document.getElementById('url').value;
8 | const googleDork = document.getElementById('google-dork').value;
9 | const data = document.getElementById('data').value;
10 | const cookie = document.getElementById('cookie').value;
11 |
12 | if (url) command += ` -u "${url}"`;
13 | if (googleDork) command += ` -g "${googleDork}"`;
14 | if (data) command += ` --data="${data}"`;
15 | if (cookie) command += ` --cookie="${cookie}"`;
16 |
17 | // Crawling options
18 | const crawlDepth = document.getElementById('crawl-depth').value;
19 | const crawlExclude = document.getElementById('crawl-exclude').value;
20 |
21 | if (crawlDepth > 1) command += ` --crawl=${crawlDepth}`;
22 | if (crawlExclude) command += ` --crawl-exclude="${crawlExclude}"`;
23 |
24 | // Connection options
25 | if (document.getElementById('random-agent').checked) command += ' --random-agent';
26 | if (document.getElementById('tor').checked) command += ' --tor';
27 |
28 | const proxy = document.getElementById('proxy').value;
29 | if (proxy) command += ` --proxy="${proxy}"`;
30 |
31 | // Optimization options
32 | if (document.getElementById('optimize').checked) command += ' -o';
33 | const threads = document.getElementById('threads').value;
34 | if (threads > 1) command += ` --threads=${threads}`;
35 | if (document.getElementById('keep-alive').checked) command += ' --keep-alive';
36 |
37 | // Detection options
38 | const level = document.getElementById('level').value;
39 | const risk = document.getElementById('risk').value;
40 | const verbosity = document.getElementById('verbosity').value;
41 | command += ` --level=${level} --risk=${risk} -v ${verbosity}`;
42 |
43 | // Techniques
44 | let techniques = '';
45 | ['b', 'e', 'u', 's', 't', 'q'].forEach(tech => {
46 | if (document.getElementById(`tech-${tech}`).checked) {
47 | techniques += tech.toUpperCase();
48 | }
49 | });
50 | if (techniques) command += ` --technique=${techniques}`;
51 |
52 | // Enumeration options
53 | const enumOptions = [
54 | 'all', 'banner', 'current-user', 'current-db', 'passwords',
55 | 'dbs', 'tables', 'columns', 'schema', 'dump'
56 | ];
57 | enumOptions.forEach(opt => {
58 | if (document.getElementById(opt).checked) {
59 | command += ` --${opt}`;
60 | }
61 | });
62 |
63 | // Advanced options
64 | const advancedOptions = ['os-shell', 'os-pwn', 'batch', 'flush-session'];
65 | advancedOptions.forEach(opt => {
66 | if (document.getElementById(opt).checked) {
67 | command += ` --${opt}`;
68 | }
69 | });
70 |
71 | // Tamper options
72 | const tamper = document.getElementById('tamper').value;
73 | if (tamper) command += ` --tamper="${tamper}"`;
74 |
75 | document.getElementById('output').textContent = command;
76 | }
77 |
78 | // Rest of the code remains exactly the same
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SQLMap Command Generator
2 |
3 |
4 | ## Description
5 |
6 | SQLMap Command Generator is a web-based application designed to assist penetration testers and security enthusiasts in generating SQLMap commands with various options for testing SQL injection vulnerabilities. It provides an easy-to-use interface where users can configure various parameters, such as target URL, Google dork, POST data, connection options, detection levels, and techniques for SQL injection.
7 |
8 | ## Features
9 |
10 | - **Target Configuration**: Define target URL or Google dork.
11 | - **Connection Options**: Configure proxy, random user-agent, and use Tor network.
12 | - **Detection Options**: Set the test level, risk, and verbosity.
13 | - **Injection Techniques**: Select from multiple SQL injection techniques, including boolean-based, error-based, union-based, and more.
14 | - **Enumeration Options**: Choose data to extract from the database (e.g., tables, columns, passwords).
15 | - **Advanced Options**: Configure additional attack options like OS shell, OS pwn, and batch mode.
16 |
17 | ## Requirements
18 |
19 | - A Unix-based operating system (Linux/macOS).
20 | - Python 3.x.
21 | - Firefox (for opening the SQLMap interface).
22 |
23 |
24 | ## Web Usage Live
25 |
26 | https://acorzo1983.github.io/SQLMapCG/
27 |
28 |
29 | ## Installation & Usage
30 |
31 | To install and run the application, follow these steps:
32 |
33 | 0. **OneLiner Automatic Install and Run**:
34 |
35 | ```bash
36 | git clone https://github.com/Acorzo1983/SQLMapCG.git && cd SQLMapCG && chmod +x run.sh && ./run.sh
37 | ```
38 |
39 | 1. **Clone the repository**:
40 |
41 | ```bash
42 | git clone https://github.com/Acorzo1983/SQLMapCG.git
43 | ```
44 |
45 | 2. **Navigate to the project directory**:
46 |
47 | ```bash
48 | cd SQLMapCG
49 | ```
50 |
51 | 3. **Make the `run.sh` script executable**:
52 |
53 | ```bash
54 | chmod +x run.sh
55 | ```
56 |
57 | 4. **Run the script**:
58 |
59 | ```bash
60 | ./run.sh
61 | ```
62 |
63 | This will start an HTTP server on an available port (either 8082-8085 or a custom port you specify) and open the web application in Firefox automatically.
64 |
65 | ## Available Options
66 |
67 | - **Target URL**: Input the target URL to be tested (e.g., `http://example.com/vuln.php?id=1`).
68 | - **Google Dork**: Use a Google dork to find vulnerable pages (e.g., `inurl:".php?id=1"`).
69 | - **POST Data**: Provide any POST data parameters.
70 | - **Cookie**: Provide any cookies needed for the session.
71 |
72 | ## Troubleshooting
73 |
74 | - **Port Availability**: The script will check if ports 8082-8085 are available. If none of them are free, it will prompt you to choose another port.
75 | - **Permissions**: Ensure you have the required permissions to run the script and make the `run.sh` file executable.
76 | - **Dependencies**: The script assumes that `python3` and `firefox` are installed on your system.
77 |
78 | ## License
79 |
80 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
81 |
82 | ---
83 |
84 | Made with ❤️ by Albert C (2024)
85 |
--------------------------------------------------------------------------------
/styles.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --bg-primary: #0a0e17;
3 | --bg-secondary: #1a1f2b;
4 | --text-primary: #00ff00;
5 | --text-secondary: #b3b3b3;
6 | --accent: #1e8b1e;
7 | --border: #2a2f3a;
8 | --shadow: rgba(0, 255, 0, 0.1);
9 | --tooltip-bg: rgba(26, 31, 43, 0.95);
10 | }
11 |
12 | .light {
13 | --bg-primary: #f0f2f5;
14 | --bg-secondary: #ffffff;
15 | --text-primary: #1e8b1e;
16 | --text-secondary: #4a4a4a;
17 | --accent: #2ea043;
18 | --border: #e1e4e8;
19 | --shadow: rgba(0, 0, 0, 0.1);
20 | --tooltip-bg: rgba(255, 255, 255, 0.95);
21 | }
22 |
23 | * {
24 | margin: 0;
25 | padding: 0;
26 | box-sizing: border-box;
27 | font-family: 'Share Tech Mono', monospace;
28 | }
29 |
30 | body {
31 | background: var(--bg-primary);
32 | color: var(--text-primary);
33 | line-height: 1.6;
34 | transition: background-color 0.3s;
35 | }
36 |
37 | .container {
38 | max-width: 1200px;
39 | margin: 0 auto;
40 | padding: 2rem;
41 | }
42 |
43 | .header {
44 | display: flex;
45 | justify-content: space-between;
46 | align-items: center;
47 | margin-bottom: 2rem;
48 | padding-bottom: 1rem;
49 | border-bottom: 2px solid var(--accent);
50 | }
51 |
52 | .title {
53 | font-size: 2rem;
54 | color: var(--text-primary);
55 | }
56 |
57 | .theme-toggle {
58 | background: var(--bg-secondary);
59 | color: var(--text-primary);
60 | border: 1px solid var(--accent);
61 | padding: 0.5rem 1rem;
62 | border-radius: 4px;
63 | cursor: pointer;
64 | display: flex;
65 | align-items: center;
66 | gap: 0.5rem;
67 | }
68 |
69 | .grid {
70 | display: grid;
71 | grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
72 | gap: 1.5rem;
73 | margin-bottom: 1.5rem;
74 | }
75 |
76 | .card {
77 | background: var(--bg-secondary);
78 | padding: 1.5rem;
79 | border-radius: 8px;
80 | border: 1px solid var(--border);
81 | box-shadow: 0 4px 6px var(--shadow);
82 | }
83 |
84 | .card h2 {
85 | display: flex;
86 | align-items: center;
87 | margin-bottom: 1rem;
88 | font-size: 1.2rem;
89 | color: var(--text-primary);
90 | }
91 |
92 | .form-group {
93 | margin-bottom: 1rem;
94 | }
95 |
96 | .form-group label {
97 | display: block;
98 | margin-bottom: 0.5rem;
99 | color: var(--text-secondary);
100 | }
101 |
102 | input[type="text"],
103 | input[type="number"] {
104 | width: 100%;
105 | padding: 0.5rem;
106 | background: var(--bg-primary);
107 | border: 1px solid var(--border);
108 | border-radius: 4px;
109 | color: var(--text-primary);
110 | }
111 |
112 | .checkbox-group {
113 | display: grid;
114 | grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
115 | gap: 0.5rem;
116 | }
117 |
118 | .checkbox-item {
119 | display: flex;
120 | align-items: center;
121 | gap: 0.5rem;
122 | }
123 |
124 | .info-icon {
125 | width: 18px;
126 | height: 18px;
127 | display: inline-flex;
128 | align-items: center;
129 | justify-content: center;
130 | border: 1px solid var(--text-primary);
131 | border-radius: 50%;
132 | font-size: 12px;
133 | margin-left: 0.5rem;
134 | cursor: help;
135 | color: var(--text-primary);
136 | }
137 |
138 | .tooltip {
139 | position: relative;
140 | display: inline-flex;
141 | align-items: center;
142 | }
143 |
144 | .tooltiptext {
145 | visibility: hidden;
146 | position: absolute;
147 | z-index: 1;
148 | width: 250px;
149 | background: var(--tooltip-bg);
150 | color: var(--text-primary);
151 | text-align: center;
152 | padding: 0.75rem;
153 | border-radius: 4px;
154 | border: 1px solid var(--border);
155 | font-size: 0.85rem;
156 | left: 50%;
157 | transform: translateX(-50%);
158 | bottom: 125%;
159 | box-shadow: 0 2px 4px var(--shadow);
160 | opacity: 0;
161 | transition: opacity 0.3s, visibility 0.3s;
162 | }
163 |
164 | .tooltip:hover .tooltiptext {
165 | visibility: visible;
166 | opacity: 1;
167 | }
168 |
169 | .tooltiptext::after {
170 | content: '';
171 | position: absolute;
172 | top: 100%;
173 | left: 50%;
174 | margin-left: -5px;
175 | border-width: 5px;
176 | border-style: solid;
177 | border-color: var(--border) transparent transparent transparent;
178 | }
179 |
180 | button {
181 | background: var(--accent);
182 | color: white;
183 | border: none;
184 | padding: 0.75rem 1.5rem;
185 | border-radius: 4px;
186 | cursor: pointer;
187 | font-size: 1rem;
188 | transition: opacity 0.3s;
189 | }
190 |
191 | button:hover {
192 | opacity: 0.9;
193 | }
194 |
195 | .generate-btn {
196 | width: 100%;
197 | margin: 1rem 0;
198 | font-size: 1.1rem;
199 | font-weight: bold;
200 | }
201 |
202 | #output {
203 | background: var(--bg-primary);
204 | padding: 1rem;
205 | border-radius: 4px;
206 | margin: 1rem 0;
207 | white-space: pre-wrap;
208 | word-break: break-all;
209 | border: 1px solid var(--border);
210 | min-height: 60px;
211 | }
212 |
213 | .copy-btn {
214 | width: 100%;
215 | background: var(--bg-primary);
216 | color: var(--text-primary);
217 | border: 1px solid var(--accent);
218 | }
219 |
220 | .footer {
221 | margin-top: 2rem;
222 | text-align: center;
223 | color: var(--text-secondary);
224 | font-size: 0.9rem;
225 | }
226 |
227 | .version {
228 | margin-top: 0.5rem;
229 | color: var(--text-primary);
230 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |