Added whois lookup functionality
This commit is contained in:
parent
191ab4ed66
commit
1b77f05cad
@ -9,7 +9,7 @@ api = Api(app)
|
||||
|
||||
class Domain():
|
||||
def __init__(self, domain):
|
||||
self.whois = utils.whois.WhoIS(domain).__dict__
|
||||
self.whois = utils.whoisData.WhoIS(domain).__dict__
|
||||
self.dns = utils.dns.DNS(domain).__dict__
|
||||
|
||||
|
||||
@ -28,8 +28,6 @@ class DNSLookup(Resource):
|
||||
|
||||
api.add_resource(DNSLookup, '/lookup', '/lookup/<string:domain>')
|
||||
|
||||
print(dir())
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
from . import dns
|
||||
from . import whois
|
||||
from . import whoisData
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
class WhoIS():
|
||||
def __init__(self, domain):
|
||||
self.domain = domain
|
||||
self.getWhois()
|
||||
|
||||
def getWhois(self):
|
||||
self.registrar = 'Synergy Wholesale'
|
||||
self.status = ['clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited', 'clientTransferProhibited https://icann.org/epp#clientTransferProhibited', 'clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited',
|
||||
'serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited', 'serverTransferProhibited https://icann.org/epp#serverTransferProhibited', 'serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited']
|
||||
self.registrant = {'name': 'Test Case', 'email': 'tcase@test.com',
|
||||
'eligibilitytype': 'Company', 'eligibilityid': '123456789'}
|
||||
self.nameservers = ['ns1.dommain.tld', 'ns2.domain.tld']
|
||||
14
utils/whoisData.py
Normal file
14
utils/whoisData.py
Normal file
@ -0,0 +1,14 @@
|
||||
import whois
|
||||
|
||||
|
||||
class WhoIS():
|
||||
def __init__(self, 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 = whoisData.get('RegistrantName')
|
||||
self.nameservers = whoisData.get('NameServer')
|
||||
Loading…
x
Reference in New Issue
Block a user