From 5cc364480af37cdf5e1bffd2156ef37837e899e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20G?= Date: Tue, 18 Aug 2020 16:01:34 -0400 Subject: [PATCH] DIG --- cogs/utility.py | 39 +++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 ++- 2 files changed, 41 insertions(+), 1 deletion(-) mode change 100644 => 100755 requirements.txt diff --git a/cogs/utility.py b/cogs/utility.py index 29fdaa1..e56df5c 100755 --- a/cogs/utility.py +++ b/cogs/utility.py @@ -5,6 +5,8 @@ import random import urllib import ipinfo as ipinfoio +import pydig + from ipwhois.net import Net from ipwhois.asn import IPASN import ipwhois @@ -286,6 +288,43 @@ class Utility(commands.Cog): await ctx.send(content=f"Erreur, impossible d'avoir des informations sur l'adresse IP ``{realipaddress}``") await iploading.delete() + """---------------------------------------------------------------------""" + @commands.command(name='dig', pass_context=True) + async def _dig(self, ctx, domain, querytype="abc", dnssec="no"): + if not querytype in ['A', 'AAAA', 'CNAME', 'NS', 'DS', 'DNSKEY', 'SOA', 'TXT', 'PTR', 'MX']: + await ctx.send("Requêtes supportées : A, AAAA, CNAME, NS, DS, DNSKEY, SOA, TXT, PTR, MX") + return + + if(dnssec == "no"): + resolver = pydig.Resolver( + nameservers=[ + '80.67.169.40', + '80.67.169.12', + ] + ) + else: + resolver = pydig.Resolver( + nameservers=[ + '80.67.169.40', + '80.67.169.12', + ], + additional_args=[ + '+dnssec', + ] + ) + + resquery = resolver.query(domain, querytype) + embed = discord.Embed(title=f"Requête DIG sur {domain} pour une entrée {querytype}", color=0x5858d7) + + champ_id = 1 + for champ in resquery: + embed.add_field(name=f"Champ {champ_id} :", value=champ) + champ_id = champ_id + 1 + + if champ_id == 1: + embed.add_field(name="Ooops", value="Pas de résultat") + await ctx.send(embed=embed) + """---------------------------------------------------------------------""" @commands.command(name='getheaders', pass_context=True) async def _getheaders(self, ctx, *, adresse): diff --git a/requirements.txt b/requirements.txt old mode 100644 new mode 100755 index 0ffeefb..2590937 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ requests wikipedia pillow ipwhois -ipinfo \ No newline at end of file +ipinfo +pydig \ No newline at end of file