diff --git a/static/src/output.css b/static/src/output.css index a009b1a..9a4b429 100644 --- a/static/src/output.css +++ b/static/src/output.css @@ -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)); diff --git a/tldtest/templates/home.html b/tldtest/templates/home.html index 0991a04..6beb448 100644 --- a/tldtest/templates/home.html +++ b/tldtest/templates/home.html @@ -7,22 +7,24 @@ Top Level Domain - Amount of NS servers - IPv4 compatible NS servers - IPv6 compatible NS servers - Strongest DNSSEC algo available - Amount of DNSSEC keys + Total servers + IPv4 + IPv6 + Strongest DNSSEC algo + # DNSSEC keys + Organisation {% for TLD in object_list %} - {{ TLD.tld }} - {{ TLD.nsamount }} - {{ TLD.v4nsamount }} - {{ TLD.v6nsamount }} + {{ TLD.unicodetld }} + {{ TLD.nsamount }} + {{ TLD.v4nsamount }} + {{ TLD.v6nsamount }} {{ TLD.get_dnssec_display }} {{ TLD.amountofkeys }} + {{ TLD.organisation }} {% endfor %} diff --git a/tldtester/migrations/0001_initial.py b/tldtester/migrations/0001_initial.py index 9e10584..68504ee 100644 --- a/tldtester/migrations/0001_initial.py +++ b/tldtester/migrations/0001_initial.py @@ -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=['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')], }, ), ] diff --git a/tldtester/migrations/0002_zonecontent.py b/tldtester/migrations/0002_zonecontent.py deleted file mode 100644 index f2fce85..0000000 --- a/tldtester/migrations/0002_zonecontent.py +++ /dev/null @@ -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)), - ], - ), - ] diff --git a/tldtester/migrations/0003_zonecontent_tldtester_z_name_83c518_idx.py b/tldtester/migrations/0003_zonecontent_tldtester_z_name_83c518_idx.py deleted file mode 100644 index d0eccce..0000000 --- a/tldtester/migrations/0003_zonecontent_tldtester_z_name_83c518_idx.py +++ /dev/null @@ -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'), - ), - ] diff --git a/tldtester/migrations/0004_zonecontent_lastedition.py b/tldtester/migrations/0004_zonecontent_lastedition.py deleted file mode 100644 index 5148710..0000000 --- a/tldtester/migrations/0004_zonecontent_lastedition.py +++ /dev/null @@ -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), - ), - ] diff --git a/tldtester/migrations/0005_alter_zonecontent_ttl.py b/tldtester/migrations/0005_alter_zonecontent_ttl.py deleted file mode 100644 index 7cd4923..0000000 --- a/tldtester/migrations/0005_alter_zonecontent_ttl.py +++ /dev/null @@ -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), - ), - ] diff --git a/tldtester/models.py b/tldtester/models.py index 8dc6743..891ac80 100644 --- a/tldtester/models.py +++ b/tldtester/models.py @@ -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 diff --git a/tldtester/sorter.py b/tldtester/sorter.py index fd96466..3a5c8a3 100644 --- a/tldtester/sorter.py +++ b/tldtester/sorter.py @@ -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 - - 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)