Advertisement
Typhoon

SK-NIC Domain Parser

May 22nd, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import re
  4. import urllib
  5.  
  6. # You must download All Slovak Domains Dump from Slovak National Domain Registry : SK-NIC
  7. # https://www.sk-nic.sk/documents/domeny_1.txt
  8. # You can try direct file processing with python instaed of opening local downloaded file :
  9. # link = "https://www.sk-nic.sk/documents/domeny_1.txt"
  10. # file = urllib.urlopen(link)
  11.  
  12. # If you want direct url file processing then comment 2 lines below and uncomment 2 lines above.  
  13. file = open('domeny_1.txt','r')
  14. fo = file.readlines()
  15.  
  16. print ("Parsing.....")
  17. domains = []
  18. for line in fo:
  19.     reg_vyraz = re.search('[^;]*', str(line)).group()
  20.     domains.append(reg_vyraz)
  21.     print reg_vyraz
  22.  
  23. print ("Parsing complete. Writing File")
  24. fileout = open('domeny_2.txt','wa')
  25. for domain in domains:
  26.     fileout.write(domain+"\n")
  27.  
  28. print ("Generating info@domain.sk e-mail addresses...")
  29. fileout.write("\n\n\n ################# \n info@domain.sk \n ################# \n\n\n")
  30. for domain in domains:
  31.     fileout.write("info@"+domain+"\n")
  32.  
  33. print ("Generating domain@domain.sk e-mail addresses...")
  34. fileout.write("\n\n\n ################# \n domain@domain.sk \n ################# \n\n\n")
  35. for domain in domains:
  36.     prefix = domain.replace('.sk','')
  37.     fileout.write(prefix+"@"+domain+"\n")
  38.  
  39. print ("Process Finished... Now Exiting")
  40. file.close()
  41. fileout.close()
  42. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement