From 52effec67c726463e831ad5d383b8a2c55857184 Mon Sep 17 00:00:00 2001 From: altf4arnold Date: Fri, 1 Mar 2024 02:15:29 +0100 Subject: [PATCH 1/2] RDAP not whois --- tldtest/templates/home.html | 4 +- tldtester/migrations/0001_initial.py | 88 ++++++++++++++++--- tldtester/migrations/0002_zonecontent.py | 24 ----- ...zonecontent_tldtester_z_name_83c518_idx.py | 17 ---- .../0004_zonecontent_lastedition.py | 18 ---- .../migrations/0005_alter_zonecontent_ttl.py | 18 ---- tldtester/models.py | 2 + tldtester/sorter.py | 30 ++++++- 8 files changed, 110 insertions(+), 91 deletions(-) delete mode 100644 tldtester/migrations/0002_zonecontent.py delete mode 100644 tldtester/migrations/0003_zonecontent_tldtester_z_name_83c518_idx.py delete mode 100644 tldtester/migrations/0004_zonecontent_lastedition.py delete mode 100644 tldtester/migrations/0005_alter_zonecontent_ttl.py diff --git a/tldtest/templates/home.html b/tldtest/templates/home.html index 0991a04..149bf49 100644 --- a/tldtest/templates/home.html +++ b/tldtest/templates/home.html @@ -12,17 +12,19 @@ IPv6 compatible NS servers Strongest DNSSEC algo available Amount of DNSSEC keys + Organisation {% for TLD in object_list %} - {{ TLD.tld }} + {{ 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..67827ab 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 00:20 from django.db import migrations, models @@ -7,21 +7,89 @@ class Migration(migrations.Migration): initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='TLD', + name="RootZone", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("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=[ - ('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)), - ('lastEdition', models.DateTimeField(auto_now=True)), + ( + "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) From 596169e39de0bb18cbaffb8bfcede1c46a513bfe Mon Sep 17 00:00:00 2001 From: altf4arnold Date: Fri, 1 Mar 2024 03:12:49 +0100 Subject: [PATCH 2/2] Webdseign --- static/src/output.css | 10 +++ tldtest/templates/home.html | 16 ++--- tldtester/migrations/0001_initial.py | 93 +++++++--------------------- 3 files changed, 39 insertions(+), 80 deletions(-) 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 149bf49..6beb448 100644 --- a/tldtest/templates/home.html +++ b/tldtest/templates/home.html @@ -7,11 +7,11 @@ 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 @@ -19,9 +19,9 @@ {% for TLD in object_list %} {{ TLD.unicodetld }} - {{ TLD.nsamount }} - {{ TLD.v4nsamount }} - {{ TLD.v6nsamount }} + {{ TLD.nsamount }} + {{ TLD.v4nsamount }} + {{ TLD.v6nsamount }} {{ TLD.get_dnssec_display }} {{ TLD.amountofkeys }} {{ TLD.organisation }} diff --git a/tldtester/migrations/0001_initial.py b/tldtester/migrations/0001_initial.py index 67827ab..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-03-01 00:20 +# Generated by Django 5.0.2 on 2024-03-01 02:02 from django.db import migrations, models @@ -7,89 +7,38 @@ class Migration(migrations.Migration): initial = True - dependencies = [] + dependencies = [ + ] operations = [ migrations.CreateModel( - name="RootZone", + name='RootZone', fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("name", models.CharField(max_length=50)), - ("rectype", models.CharField(max_length=10)), - ("value", models.CharField(max_length=4096)), - ("lastEdition", models.DateTimeField(auto_now=True)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('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" - ), - ], + '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", + 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)), + ('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" - ), - ], + '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')], }, ), ]