ssl: Add arg to show certificate
All checks were successful
Build Docker / Build Docker (push) Successful in 16s

This commit is contained in:
Nathan Woodburn 2023-10-01 13:32:19 +11:00
parent f988e49cdc
commit c782e17028
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

5
bot.py
View File

@ -131,7 +131,7 @@ async def curl(ctx, url: str):
await ctx.response.send_message(f"An error occurred: {e}")
@tree.command(name="ssl", description="Check SSL certificate")
async def ssl(ctx, domain: str):
async def ssl(ctx, domain: str, showcert: bool = False):
# Verify that the domain is valid
if not domain:
await ctx.response.send_message("Please provide a domain to check")
@ -184,7 +184,8 @@ async def ssl(ctx, domain: str):
if certificates:
cert = certificates[0]
message = message + "\n## Website Certificate:\n```\n" + cert + "\n```\n"
if showcert:
message = message + "\n## Website Certificate:\n```\n" + cert + "\n```\n"
with tempfile.NamedTemporaryFile(mode="w", delete=False) as temp_cert_file:
temp_cert_file.write(cert)