Compare commits
3 Commits
98442178ac
...
117ce36da5
| Author | SHA1 | Date | |
|---|---|---|---|
| 117ce36da5 | |||
| 1b77f05cad | |||
| 191ab4ed66 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
env/
|
||||
.vscode/
|
||||
.vscode/
|
||||
*.pyc
|
||||
@ -1,43 +1,16 @@
|
||||
from flask import Flask, request
|
||||
from flask_restful import Resource, Api
|
||||
import utils
|
||||
import json
|
||||
|
||||
app = Flask(__name__)
|
||||
api = Api(app)
|
||||
|
||||
|
||||
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']
|
||||
|
||||
|
||||
class DNS():
|
||||
def __init__(self, domain):
|
||||
self.domain = domain
|
||||
self.getRecords()
|
||||
|
||||
def getRecords(self):
|
||||
self.a = '1.2.3.4'
|
||||
self.aaaa = '2001:0db8:85a3:0000:0000:8a2e:0370:7334'
|
||||
self.mx = {'mail.domain.tld': 10}
|
||||
self.txt = 'v=spf1 +a +mx +include:spf.hostingplatform.net.au'
|
||||
self.ns = ['ns1.domain.tld', 'ns2.domain.tld']
|
||||
self.soa = 'ns1.domain.tld. webmaster.domain.tld. 310875860 900 900 1800 60'
|
||||
|
||||
|
||||
class Domain():
|
||||
def __init__(self, domain):
|
||||
self.whois = WhoIS(domain).__dict__
|
||||
self.dns = DNS(domain).__dict__
|
||||
self.whois = utils.whoisData.WhoIS(domain).__dict__
|
||||
self.dns = utils.dns.DNS(domain).__dict__
|
||||
|
||||
|
||||
class DNSLookup(Resource):
|
||||
|
||||
2
utils/__init__.py
Normal file
2
utils/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from . import dns
|
||||
from . import whoisData
|
||||
12
utils/dns.py
Normal file
12
utils/dns.py
Normal file
@ -0,0 +1,12 @@
|
||||
class DNS():
|
||||
def __init__(self, domain):
|
||||
self.domain = domain
|
||||
self.getRecords()
|
||||
|
||||
def getRecords(self):
|
||||
self.a = '1.2.3.4'
|
||||
self.aaaa = '2001:0db8:85a3:0000:0000:8a2e:0370:7334'
|
||||
self.mx = {'mail.domain.tld': 10}
|
||||
self.txt = 'v=spf1 +a +mx +include:spf.hostingplatform.net.au'
|
||||
self.ns = ['ns1.domain.tld', 'ns2.domain.tld']
|
||||
self.soa = 'ns1.domain.tld. webmaster.domain.tld. 310875860 900 900 1800 60'
|
||||
22
utils/whoisData.py
Normal file
22
utils/whoisData.py
Normal file
@ -0,0 +1,22 @@
|
||||
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
|
||||
Loading…
x
Reference in New Issue
Block a user