Guest User

Untitled

a guest
May 10th, 2013
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. import threading, socket, time
  2.  
  3. def runwhois(query, server):
  4.     whoisconnection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  5.     whoisconnection.connect((server, 43))
  6.     queryinbytes = (query  + "\r\n").encode()
  7.     whoisconnection.send(queryinbytes)
  8.     response = b''
  9.     while True:
  10.         replyinbytes = whoisconnection.recv(4096)
  11.         response += replyinbytes
  12.         if not replyinbytes:
  13.             break
  14.  
  15.     whoisconnection.close()
  16.     jj = response.decode('utf-8')
  17.     return jj
  18.  
  19. def iowhois(domain):
  20.     g = runwhois(domain, "io.whois-servers.net")
  21.     if "Not" not in g:
  22.         print(domain)
  23.  
  24. def main():
  25.     with open("wordlist.txt") as f:
  26.         domlist = [x.strip() for x in f.readlines() if x.strip()]
  27.     for i in domlist:
  28.         t = threading.Thread(target=iowhois, args=(i,))
  29.         t.start()
  30.         while threading.activeCount()>9:
  31.             time.sleep(.1)
  32.     while threading.activeCount()>1:
  33.         time.sleep(.1)
  34.  
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment