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
8
bot.py
8
bot.py
@ -149,6 +149,7 @@ async def ssl(ctx, domain: str):
|
||||
resolver = dns.resolver.Resolver()
|
||||
resolver.nameservers = ["100.74.29.146"]
|
||||
resolver.port = 53
|
||||
domain_check = False
|
||||
try:
|
||||
# Query the DNS record
|
||||
response = resolver.resolve(domain, "A")
|
||||
@ -215,6 +216,7 @@ async def ssl(ctx, domain: str):
|
||||
# Extract the common name (CN) from the subject
|
||||
common_name = cert_obj.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)
|
||||
if common_name:
|
||||
if common_name[0].value not in domains:
|
||||
domains.append(common_name[0].value)
|
||||
|
||||
|
||||
@ -222,6 +224,8 @@ async def ssl(ctx, domain: str):
|
||||
message = message + "\n## SSL Domains:\n"
|
||||
for domain in domains:
|
||||
message = message + "- " + domain + "\n"
|
||||
if domain in domains:
|
||||
domain_check = True
|
||||
|
||||
|
||||
else:
|
||||
@ -241,7 +245,11 @@ async def ssl(ctx, domain: str):
|
||||
message = message + "\n## Result:\n:x: No TLSA record found\n"
|
||||
else:
|
||||
if tlsa_server == tlsa_records[0]:
|
||||
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:
|
||||
message = message + "\n## Result:\n:x: TLSA record does not match certificate\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user