Merge pull request #7 from tldtest/whois

RDAP not whois
This commit is contained in:
Arnold Dechamps 2024-03-01 03:14:58 +01:00 committed by GitHub
commit e8b3afc7fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 72 additions and 94 deletions

View file

@ -781,6 +781,16 @@ video {
color: rgb(17 24 39 / var(--tw-text-opacity));
}
.text-green-600 {
--tw-text-opacity: 1;
color: rgb(22 163 74 / var(--tw-text-opacity));
}
.text-red-700 {
--tw-text-opacity: 1;
color: rgb(185 28 28 / var(--tw-text-opacity));
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));

View file

@ -7,22 +7,24 @@
<thead>
<tr>
<th class="border border-slate-600">Top Level Domain</th>
<th class="border border-slate-600">Amount of NS servers</th>
<th class="border border-slate-600">IPv4 compatible NS servers</th>
<th class="border border-slate-600">IPv6 compatible NS servers</th>
<th class="border border-slate-600">Strongest DNSSEC algo available</th>
<th class="border border-slate-600">Amount of DNSSEC keys</th>
<th class="border border-slate-600 text-l-blue-600">Total servers</th>
<th class="border border-slate-600 text-red-700">IPv4</th>
<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">Organisation</th>
</tr>
</thead>
<tbody>
{% for TLD in object_list %}
<tr>
<td class="border border-slate-700">{{ TLD.tld }}</td>
<td class="border border-slate-700">{{ TLD.nsamount }}</td>
<td class="border border-slate-700">{{ TLD.v4nsamount }}</td>
<td class="border border-slate-700">{{ TLD.v6nsamount }}</td>
<td class="border border-slate-700">{{ TLD.unicodetld }}</td>
<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">{{ TLD.get_dnssec_display }}</td>
<td class="border border-slate-700">{{ TLD.amountofkeys }}</td>
<td class="border border-slate-700">{{ TLD.organisation }}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-02-12 16:08
# Generated by Django 5.0.2 on 2024-03-01 02:02
from django.db import migrations, models
@ -12,16 +12,33 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='TLD',
name='RootZone',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tld', models.CharField(max_length=30)),
('dnssec', models.IntegerField(choices=[(0, 'Delete DS'), (1, 'RSA/MD5'), (2, 'Diffie-Hellman'), (3, 'DSA/SHA1'), (5, 'RSA/SHA-1'), (6, 'DSA-NSEC3-SHA1'), (7, 'RSASHA1-NSEC3-SHA1'), (8, 'RSA/SHA-256'), (10, 'RSA/SHA-512'), (12, 'GOST R 34.10-2001'), (13, 'ECDSA Curve P-256 with SHA-256'), (14, 'ECDSA Curve P-384 with SHA-384'), (15, 'Ed25519'), (16, 'Ed448'), (17, 'SM2 signing algorithm with SM3 hashing algorithm'), (23, 'GOST R 34.10-2012'), (252, 'Reserved for Indirect Keys'), (253, 'private algorithm'), (254, 'private algorithm OID'), (300, 'Unknown')], default=300)),
('inet', models.IntegerField(choices=[(0, 'IPv4'), (1, 'IPv6'), (2, 'IPv4 + IPv6')], default=0)),
('name', models.CharField(max_length=50)),
('rectype', models.CharField(max_length=10)),
('value', models.CharField(max_length=4096)),
('lastEdition', models.DateTimeField(auto_now=True)),
],
options={
'indexes': [models.Index(fields=['tld'], name='tldtester_t_tld_b4cdc5_idx'), models.Index(fields=['dnssec'], name='tldtester_t_dnssec_694343_idx'), models.Index(fields=['inet'], name='tldtester_t_inet_b6132b_idx')],
'indexes': [models.Index(fields=['name'], name='tldtester_r_name_40033d_idx'), models.Index(fields=['rectype'], name='tldtester_r_rectype_1bc68d_idx')],
},
),
migrations.CreateModel(
name='TLD',
fields=[
('tld', models.CharField(max_length=30, primary_key=True, serialize=False)),
('unicodetld', models.CharField(max_length=30)),
('nsamount', models.IntegerField(default=0)),
('v4nsamount', models.IntegerField(default=0)),
('v6nsamount', models.IntegerField(default=0)),
('dnssec', models.IntegerField(choices=[(0, 'Delete DS'), (1, 'RSA/MD5'), (2, 'Diffie-Hellman'), (3, 'DSA/SHA1'), (5, 'RSA/SHA-1'), (6, 'DSA-NSEC3-SHA1'), (7, 'RSASHA1-NSEC3-SHA1'), (8, 'RSA/SHA-256'), (10, 'RSA/SHA-512'), (12, 'GOST R 34.10-2001'), (13, 'ECDSA Curve P-256 with SHA-256'), (14, 'ECDSA Curve P-384 with SHA-384'), (15, 'Ed25519'), (16, 'Ed448'), (17, 'SM2 signing algorithm with SM3 hashing algorithm'), (23, 'GOST R 34.10-2012'), (252, 'Reserved for Indirect Keys'), (253, 'private algorithm'), (254, 'private algorithm OID'), (300, 'Unknown'), (400, 'None')], default=300)),
('amountofkeys', models.IntegerField(default=0)),
('lastEdition', models.DateTimeField(auto_now=True)),
('organisation', models.CharField(max_length=30)),
],
options={
'indexes': [models.Index(fields=['tld'], name='tldtester_t_tld_b4cdc5_idx'), models.Index(fields=['dnssec'], name='tldtester_t_dnssec_694343_idx'), models.Index(fields=['nsamount'], name='tldtester_t_nsamoun_8ca22f_idx')],
},
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 5.0.2 on 2024-02-12 19:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tldtester', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='zonecontent',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('rtype', models.CharField(max_length=10)),
('name', models.CharField(max_length=100)),
('rclass', models.CharField(max_length=10)),
('ttl', models.IntegerField(default=0)),
('data', models.CharField(max_length=1000)),
],
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 5.0.2 on 2024-02-12 19:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tldtester', '0002_zonecontent'),
]
operations = [
migrations.AddIndex(
model_name='zonecontent',
index=models.Index(fields=['name'], name='tldtester_z_name_83c518_idx'),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 5.0.2 on 2024-02-12 19:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tldtester', '0003_zonecontent_tldtester_z_name_83c518_idx'),
]
operations = [
migrations.AddField(
model_name='zonecontent',
name='lastEdition',
field=models.DateTimeField(auto_now=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 5.0.2 on 2024-02-12 20:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tldtester', '0004_zonecontent_lastedition'),
]
operations = [
migrations.AlterField(
model_name='zonecontent',
name='ttl',
field=models.CharField(max_length=5),
),
]

View file

@ -29,12 +29,14 @@ class TLD(models.Model):
(400, "None"),
)
tld = models.CharField(max_length=30, primary_key=True)
unicodetld = models.CharField(max_length=30)
nsamount = models.IntegerField(default=0)
v4nsamount = models.IntegerField(default=0)
v6nsamount = models.IntegerField(default=0)
dnssec = models.IntegerField(default=300, choices=DNSSECALGOS)
amountofkeys = models.IntegerField(default=0)
lastEdition = models.DateTimeField(auto_now=True)
organisation = models.CharField(max_length=30)
def __str__(self):
return self.tld

View file

@ -2,6 +2,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 urllib.request
from tldtester.models import TLD, RootZone
from django.core.exceptions import MultipleObjectsReturned
@ -77,11 +78,13 @@ def tlddbwriter(recs):
else:
db = TLD()
db.tld = recs["tld"]
db.unicodetld = recs["unicodeTld"]
db.nsamount = recs["nsserveramount"]
db.v4nsamount = recs["v4resolvers"]
db.v6nsamount = recs["v6resolvers"]
db.dnssec = recs["algo"]
db.amountofkeys = recs["amountofkeys"]
db.organisation = recs["organisation"]
db.save()
@ -131,9 +134,30 @@ def grabber(data):
except Exception as e:
print(tld + " DNSSEC " + e)
algo = 300
# Who registers the thing and get unicode
rdap = urllib.request.urlopen("https://root.rdap.org/domain/" + tld)
if rdap.getcode() == 200:
raw = rdap.read()
raw = raw.decode("utf-8")
data = json.loads(raw)
try:
if "xn--" in tld:
unicodetld = data["unicodeName"]
else:
unicodetld = tld
except Exception as e:
unicodetld = tld
print(tld)
print(e)
for entity in data["entities"]:
try:
organisation = entity["vcardArray"][1][2][3]
except:
organisation = "Reserved"
results = {"tld": tld, "nsserveramount": int(len((nsservers))), "v4resolvers": Arecords,
"v6resolvers": AAAArecords, "algo": algo, "amountofkeys": amountofkeys}
results = {"tld": tld, "unicodeTld": unicodetld, "nsserveramount": int(len((nsservers))),
"organisation": organisation, "v4resolvers": Arecords, "v6resolvers": AAAArecords, "algo": algo,
"amountofkeys": amountofkeys}
tlddbwriter(results)