bot: Finish domain check
All checks were successful
Build Docker / Build Docker (push) Successful in 16s
All checks were successful
Build Docker / Build Docker (push) Successful in 16s
This commit is contained in:
parent
e7c44a8870
commit
f611aa929c
12
bot.py
12
bot.py
@ -149,6 +149,7 @@ async def ssl(ctx, domain: str):
|
|||||||
resolver = dns.resolver.Resolver()
|
resolver = dns.resolver.Resolver()
|
||||||
resolver.nameservers = ["100.74.29.146"]
|
resolver.nameservers = ["100.74.29.146"]
|
||||||
resolver.port = 53
|
resolver.port = 53
|
||||||
|
domain_check = False
|
||||||
try:
|
try:
|
||||||
# Query the DNS record
|
# Query the DNS record
|
||||||
response = resolver.resolve(domain, "A")
|
response = resolver.resolve(domain, "A")
|
||||||
@ -215,13 +216,16 @@ async def ssl(ctx, domain: str):
|
|||||||
# Extract the common name (CN) from the subject
|
# Extract the common name (CN) from the subject
|
||||||
common_name = cert_obj.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)
|
common_name = cert_obj.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)
|
||||||
if common_name:
|
if common_name:
|
||||||
domains.append(common_name[0].value)
|
if common_name[0].value not in domains:
|
||||||
|
domains.append(common_name[0].value)
|
||||||
|
|
||||||
|
|
||||||
if domains:
|
if domains:
|
||||||
message = message + "\n## SSL Domains:\n"
|
message = message + "\n## SSL Domains:\n"
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
message = message + "- " + domain + "\n"
|
message = message + "- " + domain + "\n"
|
||||||
|
if domain in domains:
|
||||||
|
domain_check = True
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -241,7 +245,11 @@ async def ssl(ctx, domain: str):
|
|||||||
message = message + "\n## Result:\n:x: No TLSA record found\n"
|
message = message + "\n## Result:\n:x: No TLSA record found\n"
|
||||||
else:
|
else:
|
||||||
if tlsa_server == tlsa_records[0]:
|
if tlsa_server == tlsa_records[0]:
|
||||||
message = message + "\n## Result:\n:white_check_mark: TLSA record matches certificate\n"
|
if domain_check:
|
||||||
|
message = message + "\n## Result:\n:white_check_mark: TLSA record matches certificate\n"
|
||||||
|
else:
|
||||||
|
message = message + "\n## Result:\n:x: TLSA record matches certificate but domain does not match\n"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
message = message + "\n## Result:\n:x: TLSA record does not match certificate\n"
|
message = message + "\n## Result:\n:x: TLSA record does not match certificate\n"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user