rxt1077 / cyber_range_demo

The demonstrates how a Flask app can be used in conjunction with Docker to spawn environments for offensive security practice.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cyber Range Demo

User environment

Make sure this is run as a non-root user with access to Docker (in the docker group). You will need to define a DB_FILE where you want the sqlite3 database file. Your environment will need SECRET_KEY defined for signing session cookies. You can put it in a .env file and generate it via python -c 'import secrets; print(secrets.token_hex())' You environment will also need a DEFAULT_ADMIN_PASSWORD set.

Python packages

Python packages for this demo can be installed with pip install -r requirements.txt. I'd recommend using a virtual environment.

Database

An sqlite3 database stored in database.db is used. If the file doesn't exist a new database will be created with the correct schema.

Images

A few Docker images are used in this demo. Since they are supposed to be built locally they are configured to never be pulled. This configuration is either in the subprocess.run parameters or in the docker-compose.yml file. There's a helper script to build the images: build_images.sh.

When the server starts it's expected that these images are built and locally available. They can be rebuilt at any time and new environments will use the updated images.

Running via the Flask development server

flask run

Running via gunicorn

gunicorn -w 1 -b 0.0.0.0 'app:create_app()'

Tests

The beginnings of a test suite can be run with python3 -m pytest in the project root. It may take a long time to run as it starts, stops, starts, and submits a flag for each challenge.

About

The demonstrates how a Flask app can be used in conjunction with Docker to spawn environments for offensive security practice.

License:GNU General Public License v3.0


Languages

Language:Python 56.9%Language:HTML 33.3%Language:Shell 7.6%Language:Dockerfile 2.0%Language:CSS 0.2%