Merge pull request #25 from tldtest/link-and-rdap
adding code for RDAP and TLD websites
This commit is contained in:
commit
ed633dffb1
|
@ -771,6 +771,11 @@ video {
|
|||
font-weight: 600;
|
||||
}
|
||||
|
||||
.text-blue-600 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(37 99 235 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.text-gray-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
|
@ -932,6 +937,11 @@ video {
|
|||
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.dark\:text-blue-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(59 130 246 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.dark\:text-gray-400 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||
|
|
1
staticfiles/CACHE/css/output.184c6e037351.css
Normal file
1
staticfiles/CACHE/css/output.184c6e037351.css
Normal file
File diff suppressed because one or more lines are too long
|
@ -771,6 +771,11 @@ video {
|
|||
font-weight: 600;
|
||||
}
|
||||
|
||||
.text-blue-600 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(37 99 235 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.text-gray-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
|
@ -932,6 +937,11 @@ video {
|
|||
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.dark\:text-blue-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(59 130 246 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.dark\:text-gray-400 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<th class="border border-slate-600 text-green-600">IPv6</th>
|
||||
<th class="border border-slate-600">Strongest DNSSEC algo</th>
|
||||
<th class="border border-slate-600"># DNSSEC keys</th>
|
||||
<th class="border border-slate-600">RDAP</th>
|
||||
<th class="border border-slate-600">Organisation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -22,9 +23,17 @@
|
|||
<td class="border border-slate-700 text-l-blue-600">{{ TLD.nsamount }}</td>
|
||||
<td class="border border-slate-700 text-red-700">{{ TLD.v4nsamount }}</td>
|
||||
<td class="border border-slate-700 text-green-600">{{ TLD.v6nsamount }}</td>
|
||||
<td class="border border-slate-700">{% if TLD.dnssec != 400 %} Algo {{ TLD.dnssec }} {{ TLD.get_dnssec_display }} {% else %} {{ TLD.get_dnssec_display }} {% endif %}</td>
|
||||
<td class="border border-slate-700">{% if TLD.dnssec != 400 %} Algo {{ TLD.dnssec }}
|
||||
{{ TLD.get_dnssec_display }} {% else %} {{ TLD.get_dnssec_display }} {% endif %}</td>
|
||||
<td class="border border-slate-700">{{ TLD.amountofkeys }}</td>
|
||||
<td class="border border-slate-700">{{ TLD.organisation }}</td>
|
||||
{% if TLD.rdap == "Yes" %}
|
||||
<td class="border border-slate-700 text-green-600">{{ TLD.rdap }}</td>
|
||||
{% else %}
|
||||
<td class="border border-slate-700 text-red-700">{{ TLD.rdap }}</td>
|
||||
{% endif %}
|
||||
<td class="border border-slate-700"><a href="{{ TLD.link }}"
|
||||
class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{{ TLD.organisation }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -37,6 +37,8 @@ class TLD(models.Model):
|
|||
amountofkeys = models.IntegerField(default=0)
|
||||
lastEdition = models.DateTimeField(auto_now=True)
|
||||
organisation = models.CharField(max_length=100)
|
||||
rdap = models.CharField(max_length=10, default="No")
|
||||
link = models.CharField(max_length=800, default="https://tldtest.net/")
|
||||
|
||||
def __str__(self):
|
||||
return self.tld
|
||||
|
|
|
@ -3,6 +3,7 @@ This file is dumping the IANA root zone and sorting it in the database
|
|||
Link to IANA website : https://www.internic.net/domain/root.zone
|
||||
"""
|
||||
import json
|
||||
import config
|
||||
import urllib.request
|
||||
from tldtester.models import TLD, RootZone
|
||||
from django.core.exceptions import MultipleObjectsReturned
|
||||
|
@ -44,6 +45,8 @@ def zonesorter(zonefile):
|
|||
Takes the zonefile as an input and writes the records to the database
|
||||
"""
|
||||
for line in zonefile:
|
||||
if config.DEBUG is True:
|
||||
print(line)
|
||||
value = ""
|
||||
record = line.split()
|
||||
if len(record) >= 5:
|
||||
|
@ -56,6 +59,8 @@ def zonesorter(zonefile):
|
|||
value = value + record[i + 4] + " "
|
||||
towrite = {"name": name, "type": recordtype, "value": value}
|
||||
zonedbwriter(towrite)
|
||||
if config.DEBUG is True:
|
||||
print("Done Parsing the Zones")
|
||||
|
||||
|
||||
def zonedbwriter(recs):
|
||||
|
@ -85,20 +90,25 @@ def tlddbwriter(recs):
|
|||
db.dnssec = recs["algo"]
|
||||
db.amountofkeys = recs["amountofkeys"]
|
||||
db.organisation = recs["organisation"]
|
||||
db.link = recs["link"]
|
||||
db.rdap = recs["rdap"]
|
||||
db.save()
|
||||
|
||||
|
||||
def grabber(data):
|
||||
def grabber(data, rdaptlds):
|
||||
"""
|
||||
This function takes the TLD's and makes querrys to the DNS. It looks up how many authoritative DNS's there are and
|
||||
analyses the v4, v6 and DNSSEC. Returns a list of dictionaries with all the vallues to write in the database
|
||||
"""
|
||||
for tld in data:
|
||||
if config.DEBUG is True:
|
||||
print("starting with " + tld)
|
||||
nsservers = []
|
||||
dnsseckeys = []
|
||||
Arecords = 0
|
||||
AAAArecords = 0
|
||||
amountofkeys = 0
|
||||
link = "https://tldtest.net"
|
||||
nses = RootZone.objects.all().filter(name=tld + ".", rectype="NS")
|
||||
for ns in nses:
|
||||
nsservers.append(ns.value)
|
||||
|
@ -154,23 +164,54 @@ def grabber(data):
|
|||
organisation = entity["vcardArray"][1][2][3]
|
||||
except:
|
||||
organisation = "Reserved"
|
||||
try:
|
||||
link = data["links"][2]["href"]
|
||||
except Exception as e:
|
||||
print("link not found for " + tld)
|
||||
print(e)
|
||||
if tld in rdaptlds:
|
||||
rdap = "Yes"
|
||||
else:
|
||||
rdap = "No"
|
||||
|
||||
results = {"tld": tld, "unicodeTld": unicodetld, "nsserveramount": int(len((nsservers))),
|
||||
"organisation": organisation, "v4resolvers": Arecords, "v6resolvers": AAAArecords, "algo": algo,
|
||||
"amountofkeys": amountofkeys}
|
||||
"amountofkeys": amountofkeys, "link": link, "rdap": rdap}
|
||||
if config.DEBUG is True:
|
||||
print(results)
|
||||
tlddbwriter(results)
|
||||
|
||||
|
||||
def rdaper():
|
||||
"""
|
||||
Downloads the RDAP link database from IANA and creates a list of all the tlds that currently support it.
|
||||
returns either a full or an empty list.
|
||||
"""
|
||||
rdaptlds = []
|
||||
url = urllib.request.urlopen("https://data.iana.org/rdap/dns.json")
|
||||
if url.getcode() == 200:
|
||||
raw = url.read()
|
||||
raw = raw.decode("utf-8")
|
||||
else:
|
||||
raw = None
|
||||
data = json.loads(raw)
|
||||
for i in data["services"]:
|
||||
for j in i[0]:
|
||||
rdaptlds.append(j)
|
||||
return rdaptlds
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
zonefile = zonedownloader().splitlines(True)
|
||||
rdaptlds = rdaper()
|
||||
if zonefile is not None:
|
||||
# First delete the entire zone database if file polling is successful and re write
|
||||
RootZone.objects.all().delete()
|
||||
zonesorter(zonefile)
|
||||
tlds = tlddownloader()
|
||||
if tlds is not None:
|
||||
grabber(tlds)
|
||||
grabber(tlds, rdaptlds)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
|
Loading…
Reference in a new issue