Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. from Queue import Queue
  2. import threading
  3. import socket
  4. dominio = "dominio.com"
  5. lock = threading.lock()
  6. def forca_bruta():
  7. while not q.empty():
  8. dns = q.get()+"." + dominio
  9. try:
  10. ip = socket.gethostbyname(dns)
  11. lock.acquire()
  12. print dns + ":t" + ip
  13. except socket.gaierror:
  14. pass
  15. else:
  16. lock.release()
  17. q.task_done()
  18. q = Queue()
  19. for i in range(20):
  20. t = threading.Thread(target=forca_bruta)
  21. t.daemon = True
  22. t.start()
  23. with open("lista.txt")as lista:
  24. while True:
  25. nome = lista.readline().strip("n")
  26. if not nome:
  27. break
  28. q.put(nome)
  29. q.join()
  30. print "nMapeamento completo"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement