From c782e1702839927889aa44ed1e4b57c39d1ce97c Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sun, 1 Oct 2023 13:32:19 +1100 Subject: [PATCH] ssl: Add arg to show certificate --- bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index e211c68..057a5ff 100644 --- a/bot.py +++ b/bot.py @@ -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)