def nc_manage(data, domain_whois): if data.find('not found') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(Created on .*|Expires on :.*|Last updated on :.*|Domain server.*|Registrant name :.*|)') for match in pattern.findall(data): if match.split(':')[0].strip().find('Domain server')!=-1: name_server += match.split(':')[1].strip() name_server += ';' elif match.split(':')[0].strip() == 'Created on': domain_whois['creation_date'] = match.split(':',1)[1].strip() elif match.split(':')[0].strip() == 'Expires on': domain_whois['expiration_date'] = match.split(':',1)[1].strip() elif match.split(':')[0].strip() == 'Registrant name': domain_whois['reg_name'] = match.split(':')[1].strip() domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') domain_whois['details'] = str(data) return domain_whois
def cf_manage(data, domain_whois): if data.find('No match') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(Registrant.*|Name Server.*|登録年月日.*|有効期限.*|\ |状態.*|Name.*|Email.*|電話番号.*|)') for match in pattern.findall(data): if match.find("状態") != -1: domain_status += match.split(']')[1].strip() domain_status += ';' elif match.find("Registrant") != -1: domain_whois['reg_name'] = match.split(']')[1].strip() elif match.find("登録年月日") != -1: domain_whois['creation_date'] = match.split(']')[1].strip() elif match.find("有効期限") != -1: domain_whois['expiration_date'] = match.split(']')[1].strip() elif match.find("Email") != -1: domain_whois['reg_email'] = match.split(']')[1].strip() elif match.find("電話番号") != -1: domain_whois['reg_phone'] = match.split(']')[1].strip() elif match.find("Name") != -1 and match.find("Name Server") == -1: domain_whois['org_name'] = match.split(']')[1].strip() elif match.find("Name Server") != -1: name_server += match.split(']')[1].strip() name_server += ';' domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def bo_manage(data, domain_whois): if data.find('solo acepta') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern3 = re.compile(r'(Registrant:\n.*|Registrar:\n.*|Registration status:\n.*|Registered on.*|Registry fee due on.*)') for match in pattern3.findall(data): if match.split(':')[0].strip() == 'Fecha de registro': domain_whois['creation_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'Fecha de vencimiento': domain_whois['expiration_date'] = match.split(':')[1].strip() pattern2 = re.compile(r'(TITULAR([\s\S]*?)CONTACTO ADMINISTRATIVO)') for match2 in pattern2.findall(data): data2 = "".join(tuple(match2)) pattern = re.compile(r'(Organizacion:.*|Nombre:.*|Email:.*|Telefono.*)') for match3 in pattern.findall(data2): if match3.split(':')[0].strip() == 'Organizacion': domain_whois['org_name'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip() == 'Nombre': domain_whois['reg_name'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip() == 'Email': domain_whois['reg_email'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip() == 'Telefono': domain_whois['reg_phone'] = match3.split(':')[1].strip() domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def as_manage(data, domain_whois): if data.find('No match for') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern3 = re.compile(r'(Registrant:.*\n.*|Registrar:.*\n.*|Registration status:\n.*|Registered on.*|Registry fee due on.*)') for match in pattern3.findall(data): if match.find("Registered on") != -1: domain_whois['creation_date'] = match.split(':',1)[1].strip() elif match.find('Registry fee due') != -1: domain_whois['expiration_date'] = match.split('on',1)[1].strip() elif match.split('\n',1)[0].find('Registrant') != -1: domain_whois['reg_name'] = match.split('\n',1)[1].strip() elif match.split('\n',1)[0].find('Registrar') != -1: domain_whois['sponsoring_registrar'] = match.split('\n',1)[1].strip() elif match.split('\n',1)[0].find('Registration status') != -1: domain_status += match.split('\n',1)[1].strip() domain_status += ';' pattern2 = re.compile(r'(Name servers([\s\S]*?)WHOIS lookup made)') for match2 in pattern2.findall(data): data2 = "".join(tuple(match2)[0]) for line in data2.split('\n'): if line: if line.find("Name servers") == -1 and line.find("WHOIS lookup made") == -1: name_server += line.strip() name_server += ';' domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def nl_manage(domain_whois, data): if data.find('No Match for') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(Created on:.*|Last Updated on:.*)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'Created on': domain_whois['creation_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'Last Updated on': domain_whois['expiration_date'] = match.split(':')[1].strip() pattern2 = re.compile(r'(Name Servers([\s\S]*?)Created on)') for match4 in pattern2.findall(data): for line in str(match4[0]).split("\n"): if line: if line.find("Name Servers") == -1 and line.find( "Created on") == -1: name_server += line.strip() name_server += ';' domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def be_manage(data, domain_whois): if data.find('Not Registered') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(Status:.*|Created:.*|Modified:.*|Expires:.*|Registrar Name:.*)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'Status': domain_status += match.split(':')[1].strip() domain_status += ';' elif match.split(':')[0].strip() == 'Created': domain_whois['creation_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'Modified': domain_whois['updated_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'Expires': domain_whois['expiration_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'Registrar Name': domain_whois['sponsoring_registrar'] = match.split(':')[1].strip() pattern2 = re.compile(r'(Registrant([\s\S]*?)Admin Contact)') for match2 in pattern2.findall(data): pattern3 = re.compile(r'(International Name:.*|International Organisation:.*|Email Address:.*|Phone Number:.*)') data2 = "".join(tuple(match2)[0]) for match3 in pattern3.findall(data2): if match3.split(':')[0].strip().find('International Name') != -1: domain_whois['reg_name'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip().find('International Organisation') != -1: domain_whois['org_name'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip() == 'Email Address': domain_whois['reg_email'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip() == 'Phone Number': domain_whois['reg_phone'] = match3.split(':')[1].strip() pattern3 = re.compile(r'(Name Servers:([\s\S]*)Registrar Information)') for match2 in pattern3.findall(data): data2 = "".join(tuple(match2)[0]) for line in data2.split('\n'): if line: if line.find("Name Servers") == -1 and line.find("Registrar Information") == -1: name_server += line.strip() name_server += ';' domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def vg_manage(data, domain_whois): if data.find('NO OBJECT FOUND') != -1: domain_whois['domain_status'] = 'NOTEXIST' return domain_whois name_server = '' domain_status = '' pattern = re.compile(r'( Estatus del dominio:.*| Fecha de Creacion:.*| Registrado por:.*)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'Estatus del dominio': domain_status += match.split(':')[1].strip() domain_status += ';' elif match.split(':')[0].strip() == 'Fecha de Creacion': domain_whois['creation_date'] = match.split(':',1)[1].strip() elif match.split(':')[0].strip() == 'Registrado por': domain_whois['sponsoring_registrar'] = match.split(':')[1].strip().split(' ')[0].strip() pattern2 = re.compile(r'(Servidor\(es\) de Nombres de Dominio([\s\S]*?)NIC-)') for match2 in pattern2.findall(data): for line in match2[0].split('\n'): if line and line.find('Servidor(es) de Nombres de Dominio')==-1 and line.find('NIC')==-1: name_server += line.strip().strip('-').strip() name_server += ';' pattern4 = re.compile(r'(Titular([\s\S]*?) Nombre de Dominio)') for match4 in pattern4.findall(data): pattern3 = re.compile(r'.*?\d+-\d*.*|.*?@.*\..*?') data2 = "".join(tuple(match4)[0]) for match3 in pattern3.findall(data2): if match3.find('@')!=-1: for item in match3.split('\t'): if item.find('@')!=-1: domain_whois['reg_email'] = item.strip() else : if match3.find("(FAX)")!=-1: domain_whois['reg_phone'] = match3.split('(FAX)',1)[1].strip() else : domain_whois['reg_phone'] = match3.split('\t', 1)[0].strip() domain_whois['domain_whois'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def fr_manage(data, domain_whois): if data.find('AVAILABLE') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern2 = re.compile(r'(Registrant([\s\S]*?)Technical)') for match2 in pattern2.findall(data): pattern3 = re.compile(r'(Name:.*|Phone:.*|Email:.*)') data2 = "".join(tuple(match2)[0]) for match3 in pattern3.findall(data2): if match3.split(':')[0].strip().find('Name') != -1: domain_whois['reg_name'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip().find('Phone') != -1: domain_whois['reg_phone'] = match3.split(':')[1].strip() elif match3.split(':')[0].strip().find('Email') != -1: domain_whois['reg_email'] = match3.split(':')[1].strip() pattern2 = re.compile(r'(Registrar([\s\S]*?)Name servers)') for match2 in pattern2.findall(data): pattern3 = re.compile(r'(Name:.*|)') data2 = "".join(tuple(match2)[0]) for match3 in pattern3.findall(data2): if match3.split(':')[0].strip().find('Name') != -1: domain_whois['sponsoring_registrar'] = match3.split(':')[1].strip() pattern2 = re.compile(r'(Name servers([\s\S]*?)Please visit)') for match2 in pattern2.findall(data): data2 = "".join(tuple(match2)[0]) for line in data2.split('\n'): if line: if line.find('Name servers') == -1 and line.find('Please visit') == -1: name_server += line.strip() name_server += ';' domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def nz_manage(data, domain_whois): if data.find('220 Available') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(query_status:.*|domain_dateregistered:.*|domain_datebilleduntil:.*|domain_datelastmodified:.*|\ registrar_name:.*|registrant_contact_name:.*|registrant_contact_phone:.*|registrant_contact_email:.*|ns_name.*)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'registrar_name': domain_whois['sponsoring_registrar'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'query_status': domain_status += match.split(':')[1].strip() domain_status += ';' elif match.split(':')[0].strip() == 'registrant_contact_name': domain_whois['reg_name'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'domain_dateregistered': domain_whois['creation_date'] = match.split(':', 1)[1].strip() elif match.split(':')[0].strip() == 'domain_datebilleduntil': domain_whois['expiration_date'] = match.split(':', 1)[1].strip() elif match.split(':')[0].strip() == 'domain_datelastmodified': domain_whois['updated_date'] = match.split(':', 1)[1].strip() elif match.split(':')[0].strip() == 'registrant_contact_name': domain_whois['reg_name'] = match.split(':', 1)[1].strip() elif match.split(':')[0].strip() == 'registrant_contact_phone': domain_whois['reg_phone'] = match.split(':', 1)[1].strip() elif match.split(':')[0].strip() == 'registrant_contact_email': domain_whois['reg_email'] = match.split(':', 1)[1].strip() elif match.find("ns_name") != -1: name_server += match.split(':')[1].strip() name_server += ";" domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def zz_manage(data, domain_whois): if data.find('No records for') != -1: domain_whois['domain_status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(Status:.*|)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'Status': domain_status += match.split(':', 1)[1].strip() domain_status += ';' pattern4 = re.compile(r'(Registrant:([\s\S]*?)Administrative Contact)') for match4 in pattern4.findall(data): print match4 domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois
def asia_manage(data, domain_whois): if data.find('NOT FOUND') != -1: domain_whois['status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(created:.*|last modified:.*|renewal date:.*|)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'created': domain_whois['creation_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'last modified': domain_whois['updated_date'] = match.split(':')[1].strip() elif match.split(':')[0].strip() == 'renewal date': domain_whois['expiration_date'] = match.split(':')[1].strip() domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') domain_whois['details'] = str(data) return domain_whois
def gov_manage(data, domain_whois): if data.find('Invalid query') != -1: domain_whois['domain_status'] = 'NOTEXIST' return domain_whois domain_status = '' name_server = '' pattern = re.compile(r'(Creation Date:.*|Expiration Date:.*|Status:.*)') for match in pattern.findall(data): if match.split(':')[0].strip() == 'Status': domain_status += match.split(':')[1].strip() domain_status += ';' elif match.split(':')[0].strip() == 'Creation Date': domain_whois['creation_date'] = match.split(':', 1)[1].strip() elif match.split(':')[0].strip() == 'Expiration Date': domain_whois['expiration_date'] = match.split(':', 1)[1].strip() pattern2 = re.compile(r'(Owner contact([\s\S]*?)Admin contact)') for match2 in pattern2.findall(data): pattern3 = re.compile(r'(Organization:.*|Name:.*|E-mail:.*|Phone:.*)') data2 = "".join(tuple(match2)[0]) for match3 in pattern3.findall(data2): if match3.split(':')[0].strip() == 'Organization': domain_whois['org_name'] = match3.split(':', 1)[1].strip() elif match3.split(':')[0].strip() == 'Name': domain_whois['reg_name'] = match3.split(':', 1)[1].strip() elif match3.split(':')[0].strip() == 'E-mail': domain_whois['reg_email'] = match3.split(':', 1)[1].strip() elif match3.split(':')[0].strip() == 'Phone': domain_whois['reg_phone'] = match3.split(':', 1)[1].strip() pattern2 = re.compile(r'(Organisation([\s\S]*?)Domain Nameservers)') for match2 in pattern2.findall(data): pattern3 = re.compile(r'(Organization:.*|Name:.*|E-mail:.*|Phone:.*)') data2 = "".join(tuple(match2)[0]) for match3 in pattern3.findall(data2): if match3.split(':')[0].strip() == 'Organization': domain_whois['org_name'] = match3.split(':', 1)[1].strip() elif match3.split(':')[0].strip() == 'Name': domain_whois['reg_name'] = match3.split(':', 1)[1].strip() elif match3.split(':')[0].strip() == 'E-mail': domain_whois['reg_email'] = match3.split(':', 1)[1].strip() elif match3.split(':')[0].strip() == 'Phone': domain_whois['reg_phone'] = match3.split(':', 1)[1].strip() pattern3 = re.compile(r'(Domain Nameservers([\s\S]*?)Domain registered)') for match3 in pattern3.findall(data): data3 = "".join(tuple(match3)[0]) for line in data3.split('\n'): if line: if line.find("Domain Nameservers") == -1 and line.find("Domain registered") == -1: name_server += line.strip() name_server += ';' pattern3 = re.compile(r'(Domain Nameservers([\s\S]*?)Your selected domain name)') for match3 in pattern3.findall(data): data3 = "".join(tuple(match3)[0]) for line in data3.split('\n'): if line: if line.find("Domain Nameservers") == -1 and line.find("Your selected domain name") == -1: name_server += line.strip() name_server += ';' domain_whois['domain_status'] = domain_status.strip(';') domain_whois['name_server'] = name_server.strip(';') return domain_whois