Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Dockerized setup for REBot #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:22.04

# Install dependencies
RUN apt update && apt install -y git golang-go cmake python3 python3-dev python3-pip libcapstone4 libcapstone-dev

# Install Keystone from source
WORKDIR /opt/keystone
RUN git clone https://github.com/keystone-engine/keystone.git /opt/keystone
RUN mkdir /opt/keystone/build
RUN cd /opt/keystone/build
RUN ../make-share.sh
RUN cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="AArch64;X86" -G "Unix Makefiles" ..
RUN make -j8
RUN make install
RUN ldconfig

# REBot setup
WORKDIR /opt/rebot
RUN git clone https://github.com/Cryptogenic/REBot.git /opt/rebot
RUN cd /opt/rebot

## Replace 13371337 with your Discord user id for developer commands - TODO: Use environment variables or args instead
RUN sed -i 's/165177089035599873/13371337/g' main.go
RUN sed -i 's/gapstone.New(arch, uint(mode))/gapstone.New(arch, int(mode))/g' /opt/rebot/commands-asm.go
RUN go mod init github.com/Cryptogenic/rebot
RUN go get github.com/bnagy/gapstone
RUN go get github.com/bwmarrin/discordgo
RUN go get github.com/go-ini/ini
RUN go get github.com/keystone-engine/keystone/bindings/go/keystone
RUN go build

# Add REBot config with Discord Bot token
ADD config.ini /opt/rebot/config.ini

# Run
ENTRYPOINT ["/opt/rebot/rebot"]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ For Keystone and Capstone, you may have to build the libraries yourself. Follow
### Building the project
Finally, you can build the project by simply running `go build`. You will however need to add your Discord app authentication token to the `config.ini` file - or REBot won't be able to connect to discord.

## Obtaining a Discord bot token
1. Create a bot @ [Discord Development Portal](https://discord.com/developers/applications)
2. Ensure "Message Content Intent" is set to enabled
3. Copy the token from the "Bot" page, and add it to `config.ini`
4. Go to OAuth -> URL Generator
5. Make sure "bot" is checked
6. Give the bot appropriate permissions
7. Copy URL and paste in browser to invite bot to server

## Running REBot as a Docker container
Discord has a limit of how many servers (unverified) bots can join. For unverified bots, the max is 100 servers. REBot is currently unverified and has maxed the number of servers it can be invited to. You can however run the following commands to self-host REBot:
```shell
$ git clone https://github.com/Cryptogenic/REBot.git
$ cd REBot
$ docker compose up -d
```

## License
Specter (Cryptogenic) - [@SpecterDev](https://twitter.com/SpecterDev)

Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"
services:
rebot:
container_name: rebot
image: rebot
stdin_open: true
tty: true
build:
context: .
dockerfile: Dockerfile