mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Add DNS filtering
This commit is contained in:
parent
538896dae0
commit
4047c11f1d
2 changed files with 11 additions and 0 deletions
|
@ -3,6 +3,7 @@ import io
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
import dns.resolver
|
||||||
from time import sleep as time_sleep
|
from time import sleep as time_sleep
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
from typing import Tuple, Optional, Dict
|
from typing import Tuple, Optional, Dict
|
||||||
|
@ -376,6 +377,15 @@ class OtherCog(commands.Cog):
|
||||||
if re.match(line.strip(), url.netloc):
|
if re.match(line.strip(), url.netloc):
|
||||||
return await ctx.edit(content="That domain is blacklisted.")
|
return await ctx.edit(content="That domain is blacklisted.")
|
||||||
|
|
||||||
|
try:
|
||||||
|
for response in await asyncio.to_thread(dns.resolver.resolve, url.netloc, "A"):
|
||||||
|
if response.address == "0.0.0.0":
|
||||||
|
return await ctx.edit(content="That domain is filtered.")
|
||||||
|
except dns.resolver.NXDOMAIN:
|
||||||
|
return await ctx.edit(content="That domain does not exist.")
|
||||||
|
except dns.resolver.NoAnswer:
|
||||||
|
return await ctx.edit(content="DNS resolver did not respond.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
screenshot = await self.screenshot_website(
|
screenshot = await self.screenshot_website(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
|
@ -8,3 +8,4 @@ nltk==3.7
|
||||||
psutil==5.9.4
|
psutil==5.9.4
|
||||||
selenium==4.7.2
|
selenium==4.7.2
|
||||||
chromedriver==2.24.1
|
chromedriver==2.24.1
|
||||||
|
dnspython==2.2.1
|
||||||
|
|
Loading…
Reference in a new issue