Advertisement
Typhoon

Domain Names Matching

Jun 5th, 2015
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import re
  5. addr_s = open('unregistered.txt', 'r')
  6. addr_m = open('mails_to_send.txt', 'r')
  7. addr_c = open('cleared.txt', 'w')
  8.  
  9. def match_domain(domain):
  10.  match = re.search(r'([\w.-]+)@([\w.-]+)', domain )
  11.  domain_name = str(match.group(2))
  12.  return domain_name
  13.  
  14. domains_all = []
  15. domains_bad = []
  16.  
  17. for line in addr_s:
  18.     try :
  19.         line = line.replace("\n","")
  20.         print match_domain(line)
  21.         domains_bad.append(match_domain(line))
  22.     except :
  23.         print "Wrong Domain Name : " + line
  24.  
  25. print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
  26.  
  27. for line in addr_m:
  28.     try :
  29.         line = line.replace("\n","")
  30.         print match_domain(line)
  31.         domains_all.append(match_domain(line))
  32.     except :
  33.         print "Wrong Domain Name : " + line
  34. match_counter = 0
  35. for domain in domains_all:
  36.     if domain in domains_bad:
  37.         print "Match : " + domain
  38.         match_counter +=1
  39.     else :
  40.         print "Unique Domain : " + domain
  41.         addr_c.write("info@" + domain + "\n")
  42.  
  43. print "###############################"
  44. print "Bad Domains : " + str(len(domains_bad))
  45. print "Good Domains : " + str(len(domains_all))
  46. print "Matching Domains : " + str(match_counter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement