创建自己的Discord Bot用于漏洞赏金侦察

创建自己的Discord Bot用于漏洞赏金侦察

在这篇文章中,您将学习如何创建 Discord BOT 并将其用于 Bug Bounty Recon。

create your own discord bot for recon bug bounty.

设置

首先,我们将在我们的系统上安装所有这些必需的软件

对于Windows:

  1. 从Microsoft Store安装 python
  2. 使用此https://phoenixnap.com/kb/install-pip-windows安装 pip
  3. 使用以下命令安装 pip 包:
pip3 install discord.py
pip3 install python-dotenv

对于Linux:

sudo apt update
sudo apt install python3.8
sudo apt-get -y install python3-pip
sudo pip3 install discord.py
pip3 install python-dotenv

设置 Discord 开发者应用程序

  • 转到https://discord.com/developers/applications
  • 单击右上角的新应用程序按钮
  • 输入您的应用程序名称,例如“Jarvis BOT”,然后单击创建
  • 您可以根据需要添加图标(可选)
  • 左侧,点击菜单中的“Bot”,然后点击 Add BOT 按钮 -> 点击“Yes Do it”按钮
创建自己的Discord Bot用于漏洞赏金侦察
  • 单击重置令牌按钮,然后单击“是的”按钮
  • 现在复制此令牌并将其粘贴到记事本中以备将来使用
  • 单击左侧菜单上的“OAuth2”->单击其下的URL生成器
  • 在 Scopes 中,选中“Bot”
创建自己的Discord Bot用于漏洞赏金侦察
  • 向下滚动并授予权限,可以授予Administrator权限进行测试
  • 向下滚动并复制生成的 URL
创建自己的Discord Bot用于漏洞赏金侦察

现在访问这个生成的 URL 并选择你想要添加这个 BOT 的服务器

创建自己的Discord Bot用于漏洞赏金侦察
  • 点击继续并授权
  • 检查您的 Discord 服务器
创建自己的Discord Bot用于漏洞赏金侦察

编码 BOT

首先,我们将使用此代码创建简单的消息 BOT

#import the packages
import discord
from dotenv import load_dotenv
import os

#load .env file and replace your token in Token varaible
load_dotenv()
TOKEN = "replace-your-token"

client = discord.Client()

@client.event
async def on_ready():
    print(f'{client.user.name} has connected to Discord!')

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    msg=message.content
    if msg == '+hello':
        await message.channel.send("Hello World!")
    else:
        await message.channel.send("Wrong command")

client.run(TOKEN)

我们必须专注于这部分代码:-

创建自己的Discord Bot用于漏洞赏金侦察

因为我们必须更改 if-else 代码以使我们的 BOT 对我们自己的侦察方法有用。

现在使用 python 运行这段代码

创建自己的Discord Bot用于漏洞赏金侦察

现在检查您的 Discord 服务器,您的 BOT 在线

创建自己的Discord Bot用于漏洞赏金侦察

在聊天中键入 BOT 命令

创建自己的Discord Bot用于漏洞赏金侦察

所以这个 if-else 条件由你想使用的 BOT 命令组成,就像我们在这里使用“+hello”来返回这个消息

创建自己的Discord Bot用于漏洞赏金侦察

对于侦察

现在让我们使用这个 BOT if-else 代码进行侦察

创建自己的Discord Bot用于漏洞赏金侦察

在这里,我们正在检查来自用户的消息是否包含“+recon”以及之后的内容:

  • 它将通过拆分消息来获取 url
  • 使用该 url 向我们发送消息

现在让我们尝试使用“subfinder”进行子域枚举

创建自己的Discord Bot用于漏洞赏金侦察
  • 上面的代码将从您的消息中获取 url
  • 它将在您的 url 上运行 subfinder 并在消息中返回结果
创建自己的Discord Bot用于漏洞赏金侦察

因此,如果您在大目标上运行此命令,您的代码将返回错误,因为 discord 有 2000 个字符的限制。要解决此问题,您可以使用文本文件

创建自己的Discord Bot用于漏洞赏金侦察

现在我们正在使用带有输出的 subfinder 命令,并且我们正在使用以下代码附加我们的输出文件

await message.channel.send(file=discord.File(cmd.txt"))
创建自己的Discord Bot用于漏洞赏金侦察

完整的代码在此:

import discord
from dotenv import load_dotenv
import os

load_dotenv()
TOKEN = "your-bot-token"

client = discord.Client()

@client.event
async def on_ready():
    print(f'{client.user.name} has connected to Discord!')

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    msg=message.content
    if '+recon' in msg:
        url = str.strip(msg.split("+recon",1)[1])
        await message.channel.send("Scanning Started on : "+url)
        stream = os.popen("subfinder -d "+url+" -silent -o out.txt")
        output = stream.read()
        await message.channel.send("Your result:- \n")
        await message.channel.send(file=discord.File("out.txt"))
    else:
        await message.channel.send("Wrong command")
        

client.run(TOKEN)

因此,这就是您可以创建和使用discord机器人进行侦察并创建自己的自动化方法的方法。如果你想7×24小时运行你的 BOT ,你需要 VPS,你可以从 DigitalOcean/Linode 或 Contabo 购买(最便宜的)。

from

转载请注明出处及链接

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注