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