Здраствуйте. пожалуйста помогите мне.
Хочу сделать порт сканер с дискорд командами типо >скан айпи
Сделал код. И выскакивают такие ошибки
[2022-08-30 12:12:24] [ERROR ] discord.ext.commands.bot: Ignoring exception in command scan
Traceback (most recent call last):
File "D:\пайтон\lib\site-packages\discord\ext\commands\core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "D:\PortScannerDiscord\PortScannerBot.py", line 18, in scan
ipserver = socket.gethostbyname(arg)
socket.gaierror: [Errno 11001] getaddrinfo failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\пайтон\lib\site-packages\discord\ext\commands\bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "D:\пайтон\lib\site-packages\discord\ext\commands\core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "D:\пайтон\lib\site-packages\discord\ext\commands\core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: gaierror: [Errno 11001] getaddrinfo failed
Мод код:
import discord
from discord.ext import commands
import requests
import socket
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='>', intents=discord.Intents.all())
async def scan_port(ip, port):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@bot.command()
async def scan(ctx, arg):
ipserver = socket.gethostbyname(arg)
await ctx.send(f"Идет поиск портов по {ip}")
for i in range(1000, 30000):
scan_port(ipserver, i)
if client.connect_ex((ip, port)):
pass
else:
await ctx.send(f"Порт {port} открыт")
token = 'токен'
bot.run(token)
ПОЖАЛУЙСТА ПОМОГИТЕ!