This commit is contained in:
Mael G. 2020-08-18 16:01:34 -04:00
parent ecdde52ca3
commit 5cc364480a
2 changed files with 41 additions and 1 deletions

View file

@ -5,6 +5,8 @@ import random
import urllib import urllib
import ipinfo as ipinfoio import ipinfo as ipinfoio
import pydig
from ipwhois.net import Net from ipwhois.net import Net
from ipwhois.asn import IPASN from ipwhois.asn import IPASN
import ipwhois 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 ctx.send(content=f"Erreur, impossible d'avoir des informations sur l'adresse IP ``{realipaddress}``")
await iploading.delete() 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) @commands.command(name='getheaders', pass_context=True)
async def _getheaders(self, ctx, *, adresse): async def _getheaders(self, ctx, *, adresse):

3
requirements.txt Normal file → Executable file
View file

@ -8,4 +8,5 @@ requests
wikipedia wikipedia
pillow pillow
ipwhois ipwhois
ipinfo ipinfo
pydig