Giter Site home page Giter Site logo

remotediscordshell's Introduction

Fork of remoteDiscordShell:

I have made (with my spaghetti code) this bot more windows-compatable (do note that -c on windows for ping doesnt work), more discord compatible (via splitting messages with more than 2 lines into ~2000 character clumps), and have made it assume by default the executed directory contains the files, allowing one to cd w/o using absolute locations

As the original seems to be abandoned, I will push to follow the author's footsteps.

remoteDiscordShell

remoteDiscordShell is a remote shell for Linux that makes use of Discord's conection to send commands and receive messages from the computer. It has an user login system and root restriction in order to avoid malicious connections from other Discord users. "discord" module is needed. This tool is specially useful if you want to connect to a computer that is behind a private network without opening ports or just want to control your computer through Discord, without using any other ssh client.

It also has a log file for tracking users input, that registers the date, command and user ID.

alt tag

How it works

Through the configuration file, you can chose which Discord server will are accessible for the bot (non registered servers won't get any reply from the bot). To access to the computer control, Discord users must log into the system, the password will be asked by DM to any unregistered user that send any command.

Once the user is logged in, all (avaliable) commands sent will be processed by the computer and the generated output will be sent back to the user in real time.

There is a list of forbidden commands that can't be used due to unexpected behaviour (for example non generating output commands such nano or vim), if you find any allowed command that causes any error, please report it. To check the forbidden commands list use /forbidden.

There is a set of special commands for specific actions such update or upgrade the system, the list of avaliable special commands is the following:

  • /start: Send initial message with useful information about this bot.
  • /update: Update system (might need root permission).
  • /upgrade: Upgrade system (might need root permission).
  • /install: Ask for a package and install it (might need root permission).
  • /uninstall: Ask for a package, then remove and purge it (migth need root permission).
  • /forbidden: Show forbidden command list.
  • /killall To kill ALL child processes
  • /help: Show useful information about this bot.

Installation guide

First step is downloading this project using the following command:

git clone https://github.com/EnriqueMoran/remoteDiscordShell.git

After cloning the repository in your own computer (it should be Linux OS), the following step is installing discord library (notice that this bot is compatible with python 3.7+, so pip3 might be necessary to use):

pip install discord

After this, we need to create a new bot and add it to our server.

  1. Access to Discord's developer portal and click on New Application.

  2. Click on Bot, at left side menu and add a new bot.

alt tag

  1. Add the bot to your server. Go to Oauth2 on left side menu and check bot and administrator options in SCOPES and BOT PERMISSIONS.

alt tag

  1. Access to generated url on your browser and select the server you want to add the bot in.

  2. In your bot page, copy the token. Open config.txt file and fill the blanks (file paths MUST be absolute).

alt tag

Depending on the chosen directory and if sudo parameter is active, it might be necessary to change access permissions of files, this can be done with chmod command.

  1. Last step is executing .py script and start using our computer through Discord.
python3 pyDiscordShellBot.py
python3 pyDiscordShellBot.py &              (this will run the script in background)

Sending and receiving files

To send files just drag and drop on the chat, they will be stored in configured shareFolder. To download files from the computer use "getfile + path" (e.g. getfile /home/user/Desktop/test-file.txt).

alt tag

alt tag

Supported distros

Debian and Ubuntu based distros can be updated and upgraded, install and uninstall packages aswell (because apt-get is used). I am currently working on adding support for the rest of package managers and distros.

Roadmap

Future changes and features:

  • Improve compatibility with Linux distros (currently, install/uninstall commands uses apt-get).
  • Test and improve root option.
  • Improve security.
  • Improve Windows compatibility.
  • Add parameter to allow file sending.
  • Add ctrl+c command.
  • Add multiple servers usage support.
  • Add welcome message for the first time this bot is used in a server.
  • Check wether the bot has permission to write in channels.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.