Giter Club home page Giter Club logo

discord-python-interpreter-bot's Introduction

Discord Python Interpreter Bot

In my continuing quest to think of things that are terrible security loophole ridden ideas - I've made a bot that can interpret python code on Discord. What could possibly go wrong aside from literally everything.

Usage

Add the bot to your server via this link

Command examples

All of these are valid

>> print("Hello world")
>> `print("Hello world")`
>> ```
print("Hello world")
```
>> ```python
print("Hello world")
```

Gotcha(s)

There are few things that you can't really do in this python interpreter. One thing is that printing is really weird. Printing is done to a local variable called printed, if you want to acess the output you'll have to do a top-level print. This is a side-effect of RestrictedPython.

For example:

def print_num(num):
  print(num)
  return printed

print(print_num(num))

a bit awkward, I know, but there's not much I can do about it.

Libraries

It's on my mind, but I don't think it'll be possible without a much heaver layer of virtualization. Let me know if you have any ideas.

My Attempts to Not Get Hacked

So, I'm not naive, I know how dangerous this stuff is, so I haven't just plugged user input into an eval or something. I'm using the library RestrictedPython to provide a (hopefully) safe execution environment and set up a 10 second timeout to avoid hangups on infinite loops. I'm really hoping I didn't miss anything, but please open and issue if I did.

discord-python-interpreter-bot's People

Contributors

benjaminhinchliff avatar robertquitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

discord-python-interpreter-bot's Issues

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.