Skip to content

Running Console Application in a Docker container

fiki574 edited this page Nov 1, 2020 · 7 revisions

Original source

To be able to even run the Console Application inside a Docker container, you must first build a Docker image out of the provided source code. The following Dockerfile snippet does exactly that.

FROM ubuntu:bionic

WORKDIR /app
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y git python2.7 python-pip

RUN git clone https://github.com/malwaredllc/byob.git . && \
    rm -rf .github .gitattributes .gitignore .travis.yml LICENSE README.md

WORKDIR /app/byob
RUN python setup.py && \
    pip install colorama

EXPOSE 8080 8081 8082
ENTRYPOINT ["python", "server.py", "--port", "8080"]

The git clone in the second RUN is not a proper way of building Docker images from source code. Instead, you are advised to remove that line, remove the git package installation and add the upper snippet as Dockerfile to the appropriate root directory. This is optional step.

NOTE: Cross-compilation within a container using this image is not supported.

To build the image with the Dockerfile snippet, run the following command in the appropriate root directory containing the mentioned Dockerfile.

docker build -t byob-cmd:latest .

To run the built image as a container in the interactive mode, simply type the following command:

docker run -p 8080:8080 -p 8081:8081 -p 8082:8082 -ti byob-cmd:latest

C2 server is running on port 8080. Port 8081 serves modules. Port 8082 serves packages.