Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDAP not whois #7

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions static/src/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
20 changes: 11 additions & 9 deletions tldtest/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
29 changes: 23 additions & 6 deletions tldtester/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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=['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=['inet'], name='tldtester_t_inet_b6132b_idx')],
'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')],
},
),
]
24 changes: 0 additions & 24 deletions tldtester/migrations/0002_zonecontent.py

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions tldtester/migrations/0004_zonecontent_lastedition.py

This file was deleted.

18 changes: 0 additions & 18 deletions tldtester/migrations/0005_alter_zonecontent_ttl.py

This file was deleted.

2 changes: 2 additions & 0 deletions tldtester/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 27 additions & 3 deletions tldtester/sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -131,9 +134,30 @@ def grabber(data):
except Exception as e:
print(tld + " DNSSEC " + e)
algo = 300

results = {"tld": tld, "nsserveramount": int(len((nsservers))), "v4resolvers": Arecords,
"v6resolvers": AAAArecords, "algo": algo, "amountofkeys": amountofkeys}
# 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, "unicodeTld": unicodetld, "nsserveramount": int(len((nsservers))),
"organisation": organisation, "v4resolvers": Arecords, "v6resolvers": AAAArecords, "algo": algo,
"amountofkeys": amountofkeys}
tlddbwriter(results)


Expand Down
Loading