Results 1 to 1 of 1

Thread: Rcon Protocol and your Discord bot.

  1. #1

    Default Rcon Protocol and your Discord bot.

    Creating Bot acc: https://discordpy.readthedocs.io/en/latest/discord.html
    API needed: https://discordpy.readthedocs.io/en/...tml#installing
    HZM_Warden(if you are lazy and want to copypaste also some other things): https://github.com/Crimewavezz/HZM_Warden


    import discord
    import socket
    from discord.ext import commands

    DISCORD_BOT_TOKEN = "whateva"

    #client = commands.Bot()
    bot = commands.Bot(command_prefix='!')

    #=========================================================================
    @bot.command(name = 'rcon', help = 'Syntax: !rcon <ip> <port> <password> <command> <arg1(optionally)>')
    async def rcon(ctx, ip=None, port=None, password=None, command=None, arg1=None):
    #=========================================================================
    if ip is None or port is None or password is None or command is None:
    await ctx.send('One or more arguments are missing, type `!help` to check the syntax.')
    return

    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.connect((ip, int(port)))

    if arg1 != None:
    sock.send(b"\xFF\xFF\xFF\xFF\x02rcon " + str.encode(password) + b" " + str.encode(command) + b" " + str.encode(arg1))
    else:
    sock.send(b"\xFF\xFF\xFF\xFF\x02rcon " + str.encode(password) + b" " + str.encode(command))

    receive = sock.recv(65565)
    embed = discord.Embed(title = "HZM Breakthrough Co-Op Server")
    embed.add_field(name = "Response:", value = str(receive, 'utf-8', 'ignore'), inline = True)
    await ctx.send(embed = embed)
    sock.close()

    bot.run(DISCORD_BOT_TOKEN)


    Results:
    Click image for larger version. 

Name:	result.png 
Views:	18 
Size:	61.3 KB 
ID:	2167
    Last edited by Criminal; February 6th, 2020 at 04:04 AM.
    Feel like talking to me? DM me on:
    a) Facebook: Send nudes first to receive.
    b) Discord tag: Crimewavez#2468

    Shitposting on x-null since 2017. ~<3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •