Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. from utils import *
  2. import time
  3. import socket
  4. import csv
  5. import sys
  6.  
  7. port = 53;
  8.  
  9. with open("urllist.csv") as f:
  10. url = [line.rstrip() for line in f]
  11. print (url)
  12.  
  13. with open("dnslist.csv") as t:
  14. host = [line.rstrip() for line in t]
  15. print (host)
  16.  
  17. mmm = []
  18. for y in host:
  19. for x in url:
  20. #try:
  21. w = create_DNS_query(x)
  22. #timeout = 5.0
  23. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  24. s.sendto(w, (y, port))
  25. message,adress = s.recvfrom(1024)
  26. info = decode_dns_message(message)
  27. mmm.append((info,y)) #possibly move or append
  28. print (mmm)
  29. #except TimeoutError:
  30. #print ('Server could not be reached')
  31.  
  32.  
  33. webport = 80;
  34.  
  35. for i in mmm:
  36. tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM )
  37. start = time.time()
  38. tcp.connect((i,webport))
  39. end = time.time() - start
  40. print (end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement