Advertisement
jagata

nic.ge domain checker

Jan 2nd, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. import threading
  2. import requests as r
  3. from queue import Queue
  4. import itertools
  5. from bs4 import BeautifulSoup
  6. q = Queue()
  7. dom = [''.join(x) for x in itertools.product('abcdefghijklmnopqrstuvwxyz1234567890', repeat=2)]
  8. for each in dom:
  9.     q.put(each+'.ge')
  10. busy_domain_list = []
  11. def worker():
  12.     global busy_domain_list
  13.     header = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'}
  14.     link = 'https://nic.ge/ka/search?domain='
  15.  
  16.     while q.qsize() !=0:
  17.         each = q.get()
  18.         response = r.get(link+each,headers=header)
  19.         soup = BeautifulSoup(response.text,"html.parser")
  20.         info = soup.find("div",{"class":"domain-information tac"})
  21.         status = info.find("p")
  22.         if status.text.strip() == "დომენი არ არის ხელმისაწვდომი":
  23.             data = soup.find("div",{"class":"registereddomain-info"}).find("p")
  24.             #print(each+"\n"+", ".join(data.text.split("   ")[1:12]))
  25.             busy_domain_list.append(each+"\n"+", ".join(data.text.split("   ")[1:12]))
  26.         file = open("domain_info.txt",'w')
  27.         file.write("\n\n".join(busy_domain_list))
  28.  
  29. for _ in range(8):
  30.     threading.Thread(target=worker,args=()).start()
  31.     print("thread start")
  32.  
  33. while q.qsize() !=0:
  34.     print("domains left: ",q.qsize())
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement