Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #Code by
  2. #Networking + security
  3.  
  4. from utils import *
  5. import time
  6. import socket
  7. import csv
  8. import sys
  9.  
  10.  
  11. port = 53;
  12.  
  13. with open("urllist.csv") as f:
  14. url = [line.rstrip() for line in f]
  15.  
  16. with open("dnslist.csv") as t:
  17. host = [line.rstrip() for line in t]
  18.  
  19. for x in url:
  20. for y in host:
  21. #print(x)
  22. #print(y)
  23.  
  24. w = create_DNS_query(x)
  25. #print(w)
  26. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  27. s.sendto(w, (host[0], port))
  28. message,adress = s.recvfrom(1024)
  29. #print (message)
  30. info = decode_dns_message(message)
  31. print (info)
  32.  
  33. #tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM )
  34. #start = time.time()
  35. #tcp.connect((host[0],80))
  36. #print ('time taken ', time.time() - start ,' seconds')
  37.  
  38.  
  39. s.close()
  40.  
  41.  
  42. ####establish connection with websever, not dns here - using tcp socket
  43. #null is no response from server, include timeout catch as well
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement