基于S-XIASQL Burp Suite插件功能改造的Termux Kali命令行版本
- 自动参数提取: URL、POST、Cookie、JSON参数自动识别
- 多重注入检测: 布尔盲注、错误注入、时间盲注、联合查询
- 三重验证机制: 响应差异、SQL错误、时间延迟
- 智能Payload: 针对不同数据库的专用Payload
- 自动命令生成: 发现漏洞后自动生成sqlmap命令
- 请求保存: 保存HTTP请求供sqlmap直接使用
- 批量执行: 支持自动调用系统sqlmap
- 自定义配置: 支持level、risk、threads参数
- 简洁参数: 支持URL、方法、数据、头部等参数
- 灵活输出: 自定义输出目录和报告格式
- 批量处理: 支持脚本化批量检测
- 兼容性好: 纯Python实现,Termux Kali完美运行
# Termux Kali环境
pkg update && pkg upgrade
pkg install python
pip install requests
# 可选:安装sqlmap增强功能
pkg install sqlmap# 授予执行权限
chmod +x run.sh sql_injection_detector.py
# 运行准备脚本
./run.sh
# 基础URL检测
python3 sql_injection_detector.py -u "http://test.com/page.php?id=1"python3 sql_injection_detector.py -u "http://test.com/login" -m POST -d "username=admin&password=123"python3 sql_injection_detector.py -u "http://test.com/admin" -H '{"Cookie": "session=abc123", "User-Agent": "Mozilla/5.0"}'python3 sql_injection_detector.py -u "http://api.test.com/user" -m POST -d '{"id": 1, "name": "test"}'| 参数 | 简写 | 说明 | 示例 |
|---|---|---|---|
--url |
-u |
目标URL | -u "http://example.com" |
--method |
-m |
HTTP方法 | -m POST |
--data |
-d |
POST数据 | -d "user=admin" |
--headers |
-H |
请求头(JSON) | -H '{"Cookie":"abc"}' |
--output |
-o |
输出目录 | -o ./results |
- 检测响应内容/长度变化
- 使用
OR 1=1、AND 1=2等Payload - 对比原始响应与注入响应
- 检测SQL错误信息
- 包含MySQL、Oracle、SQL Server等错误模式
- 单引号、双引号测试
- 检测响应时间延迟
- 使用
SLEEP()、BENCHMARK()函数 - 时间阈值3秒
- 检测UNION SELECT漏洞
- 测试列数匹配
- 信息泄露检测
发现漏洞后自动生成:
# 基础命令
sqlmap -u "http://test.com/page.php?id=1" -p id --batch --output-dir=./results
# 高级命令
sqlmap -u "http://test.com/page.php?id=1" -p id --level=3 --risk=3 --threads=5 --batch --output-dir=./results检测完成后可选择自动运行sqlmap进行深入利用。
检测完成后生成:
detection_report.txt: 详细检测报告sqlmap_request.json: sqlmap可用请求文件sqlmap_commands.txt: 生成的sqlmap命令
#!/bin/bash
# 批量检测脚本
URLS=(
"http://site1.com/page?id=1"
"http://site2.com/search?q=test"
"http://site3.com/login"
)
for url in "${URLS[@]}"; do
echo "检测: $url"
python3 sql_injection_detector.py -u "$url" -o "./results/$(date +%s)"
echo "完成"
done# 结合其他工具使用
nmap -p 80,443 target.com | grep open | awk '{print $1}' | while read port; do
python3 sql_injection_detector.py -u "http://target.com:$port" -o "./scan_results"
done| 功能 | S-XIASQL(GUI) | 本工具(CLI) |
|---|---|---|
| 图形界面 | ✅ | ❌ |
| 命令行 | ❌ | ✅ |
| 自动检测 | ✅ | ✅ |
| sqlmap集成 | ✅ | ✅ |
| Termux支持 | ❌ | ✅ |
| 批量处理 | ❌ | ✅ |
| 脚本集成 | ❌ | ✅ |
- 依赖错误: 运行
pip install requests - 权限问题: 执行
chmod +x *.py - 网络超时: 检查目标可达性,调整timeout
- sqlmap未找到: 安装sqlmap或手动执行命令
- 调整config.json中的timeout和threads
- 使用更精确的Payload集合
- 针对特定数据库优化检测规则
本工具仅用于安全学习和授权测试,请勿用于非法用途。
基于S-XIASQL V1.0功能开发 适配Termux Kali命令行环境