Code Monkey home page Code Monkey logo

bashbot's Introduction

BashBot

BashBot is a Discord bot that provides terminal access via chat.

Features

  • Interactive. Works with nano, htop etc
  • Buttons can be used as input keys
  • Open/Close/Select/Freeze terminal sessions
  • Run terminal session as different user
  • Support for macros
  • Users whitelisting
  • ... and more

Getting Started

These instructions will get you a bot installed and running quickly

Prerequisites

  • Python 3.5+
  • pyte library (installation instructions below)
  • discord.py library (installation instructions below)

Installing

You can download BashBot.zip from Releases which contains all required dependencies and continue to "Running" section.

or you can continue with manuall installation:

Type following commands to install dependencies:

pip install -r requirements.txt

Running

In order to run bot you have to obtain a bot account. It can be obtained through the applications page. Later you have to transform your app into app bot user

Create a Bot User

then enable "Message Content Intent"

2022-09-08_03-38

After these operations, copy your bot token using the Copy button

And run

python bashbot.py

or if you downloaded BashBot release

python BashBot.zip

Now BashBot should start and show later instructions

Docker

Copy config.toml.example to config.toml file. And in the same directory run following command:

docker run -v $(pwd)/config.toml:/BashBot/config.toml adikso/bashbot

You can add -d to run container in background

docker run -d -v $(pwd)/config.toml:/BashBot/config.toml adikso/bashbot

Now BashBot should start and show later instructions

Commands

Commands are now available as app commands, but you can still use the old way:

(Every command have to start with prefix. By default it's "$". You can change it in settings. More information about commands after typing "$.help")

Command Alias Usage Description
.about - .about Shows information about project
.open .o .open [name] Opens new terminal session
.close .c .close Closes current terminal session
.freeze .f .freeze Freezes current terminal session
.here .h .here Moves selected terminal below the user message
.select .s .select [name] Sets terminal as selected
.controls - .controls add/remove [emoji] [content..] Manages terminal controls
.repeat .r .repeat <string..> Repeats string n times and sends to the current terminal session
.rename - .rename <new_name> Changes session name
.submit - .submit Toggles auto submit mode
.macro .m .macro <macro_name> Executes macro from "macros" directory
.interactive .i .interactive Enables interactive mode where all messages are sent to terminal
.exec .e .exec <command...> Execute single command
.whitelist - .whitelist add/remove <user_tag> Add/Remove user to/from whitelist. Bot owner can execute all commands without being on the whitelist

Shortcuts

Shortcut Description
[UP] Arrow up
[DOWN] Arrow down
[LEFT] Arrow left
[RIGHT] Arrow right
[ESC] Escape
[TAB] or [T] Horizontal tab
[F1]...[F12]
[<] Clears entire input line
\a Bell (BEL)
\b Backspace (BS)
\f Formfeed (FF)
\n Linefeed(Newline) (LF)
\r Carriage Return (CR)
\t Horizontal Tab (TAB)
\v Vertical Tab (VT)
^(key) CTRL + (key)

Built With

  • Discord.py - Discord API wrapper for Python
  • Pyte - VTXXX-compatible terminal emulator

Contributing

Feel free to contribute

Authors

  • Adam Zambrzycki (Adikso)

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU License - see the LICENSE file for details

Acknowledgments

  • Bopke, tomangelo, RhAnjiE for testing

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.