A discord bot capable of accessing remote shell.
src/main.js source code of the bot.
src/registering_commands.js used to register the command.
Start an ssh session. After logging in for the first time, the bot will automatically save the credential.
leave the options blank and the bot will use the saved credential.
/sshd [<host> <port> <username> <password>]
Execute a command in the current ssh session.
leave the option blank to update the ssh output. (not yet implemented)
/ssh [command]
Exit the current ssh session.
/exit
Delete your saved ssh credential.
/purge
Note: You must have Git
, Node.js
and npm
installed prior to this setup.
- Clone the repository on your machine:
git clone https://github.com/yuan-miranda/dissh.git
- Download the following modules inside the
dissh
directory:
npm install dotenv ssh2 node-cron discord.js -y
- Setting up the discord bot:
- Go to https://discord.com/developers/applications and select or create a bot.
- Copy the Application ID. (discord bot id)
- On the left side panel, go to
Bot
section and copy the bot's token. (when its 'Reset Token', just do what it says) - Scroll down and under the Privileged Gateway Intents, enable the following:
- And on the
OAuth2
section, go toOAuth2 URL Generator
, and selectbot > Administrator
and copy the generated url and enter it on your browser to invite your bot on the server.
- Create a
.env
file inside thesrc
directory with the following values.
# .env contents
TOKEN=YOUR_DISCORD_BOT_TOKEN
BOT_ID=YOUR_DISCORD_BOT_ID
- To run the bot, execute the following commands inside the
src
directory.
node register_commands.js
node main.js