23 lines
766 B
Python
23 lines
766 B
Python
import whois
|
|
|
|
|
|
class WhoIS():
|
|
def __init__(self, domain):
|
|
self.domain = domain
|
|
self.getWhois(domain)
|
|
|
|
def getWhois(self, domain):
|
|
whoisData = whois.whois.Whois(domain).query()
|
|
whoisData = whois.parser.Parser(domain, whoisData[1]).parse()
|
|
self.registrar = whoisData.get('Registrar')
|
|
self.status = whoisData.get('Status')
|
|
self.registrant = self.buildRegistrantInfo(whoisData)
|
|
self.nameservers = whoisData.get('NameServer')
|
|
|
|
def buildRegistrantInfo(self, whoisData):
|
|
ret = {}
|
|
ret['registrantName'] = whoisData.get('RegistrantName')
|
|
ret['eligibilityType'] = whoisData.get('EligibilityType')
|
|
ret['registrantID'] = whoisData.get('RegistrantID')
|
|
return ret
|