CLI commands

fit_ctf_backend

A tool for CTF competition management.

fit_ctf_backend [OPTIONS] COMMAND [ARGS]...

Commands

project

A command for project management.

user

A command for user management.


fit_ctf_backend project

A command for project management.

fit_ctf_backend project [OPTIONS] COMMAND [ARGS]...

active-users

Get list of active users that are enrolled to the PROJECT_NAME.

Displays following states:
  • user ID

  • active state

  • account username

  • account role

  • path to the shadow file

  • email

  • path to home mounting directory/volume

  • forwarded port (visible from the outside)

fit_ctf_backend project active-users [OPTIONS] PROJECT_NAME

Arguments

PROJECT_NAME

Required argument

create

Create and initialize a new project.

This command generate a basic project from the template and stores it in the dest_dir directory. Make sure that dest_dir exists.

fit_ctf_backend project create [OPTIONS]

Options

-n, --name <name>

Required Project’s name (also serves as project id).

-dd, --dest-dir <dest_dir>

Required A directory in which the tool will store project configurations.

-mu, --max-nof-users <max_nof_users>

Max number of users.

Default:

1000

-p, --starting-port-bind <starting_port_bind>

A starting port value for each user. Each user will received a port from the range from <starting-port-bind>to <starting-port-bind + max-nof-users>. If set to -1, the tool will automatically assign an available port value.User can choose a number between 10_000 to 65_535.

Default:

-1

-vd, --volume-mount-dirname <volume_mount_dirname>

A directory name that will contain all user home volumes for the given project. This directory will be created inside project configuration directory (<dest-dir>/<dir-name>/<volume-mount-dirname>).

Default:

'_mounts'

-dn, --dir-name <dir_name>

Name of the directory that will be created inside <dest-dir>. If no name is set, the directory name will be generated using project name.

Default:

''

-de, --description <description>

A project description.

Default:

''

-cf, --compose-file <compose_file>

Compose filename used for managing CTF server pods.

Default:

'server_compose.yaml'

delete

Delete an existing project PROJECT_NAME.

Deletes all project configuration files and sets project activity state to inactive.

fit_ctf_backend project delete [OPTIONS] PROJECT_NAME

Arguments

PROJECT_NAME

Required argument

export

Export PROJECT_NAME configurations.

Generates a ZIP file containing all the project configuration files, including mounts and modules.

fit_ctf_backend project export [OPTIONS] PROJECT_NAME

Options

-o, --output <output>

Final ZIP file name.

Arguments

PROJECT_NAME

Required argument

flush-db

Removes all inactive projects from the database.

fit_ctf_backend project flush-db [OPTIONS]

generate-firewall-rules

Generate a BASH script with port forwarding rules for PROJECT_NAME.

The command used in the script are written for firewalld application.

fit_ctf_backend project generate-firewall-rules [OPTIONS] PROJECT_NAME

Options

-ip, --ip-addr <ip_addr>

Required The destination IP address.

-o, --output <output>

Destination file where the script content will be written.

Arguments

PROJECT_NAME

Required argument

get-config

Return path to PROJECT_NAME’s configuration directory.

fit_ctf_backend project get-config [OPTIONS] PROJECT_NAME

Arguments

PROJECT_NAME

Required argument

get-info

Display project PROJECT_NAME’s information.

Dumps all information about a selected project.

fit_ctf_backend project get-info [OPTIONS] PROJECT_NAME

Arguments

PROJECT_NAME

Required argument

ls

Display existing projects.

This command by default displays only active projects. Use -a flag to display inactive projects.

Displays following states:
  • active state

  • project name

  • max number of users

  • number of active users enrolled to the project

fit_ctf_backend project ls [OPTIONS]

Options

-a, --all

Display both active and inactive projects.)

module

Manage modules.

fit_ctf_backend project module [OPTIONS] COMMAND [ARGS]...

general

A set of general module operations.

NOT IMPLEMENTED YET.

fit_ctf_backend project module general [OPTIONS] COMMAND [ARGS]...

project

Manage project modules.

fit_ctf_backend project module project [OPTIONS] COMMAND [ARGS]...

Options

-n, --name <name>

Required Project’s name

create

Create a new module.

fit_ctf_backend project module project create [OPTIONS]

Options

-n, --name <name>

Required Name of the service module.

ls

List all available modules.

fit_ctf_backend project module project ls [OPTIONS]
remove

Remove a module.

fit_ctf_backend project module project remove [OPTIONS]

Options

-n, --name <name>

Required Name of the service module.

user

Manage user modules.

fit_ctf_backend project module user [OPTIONS] COMMAND [ARGS]...

Options

-n, --name <name>

Required Project’s name

create

Create a module.

fit_ctf_backend project module user create [OPTIONS]

Options

-n, --name <name>

Required Name of the service module.

ls

List available modules.

fit_ctf_backend project module user ls [OPTIONS]
remove

Remove a module.

fit_ctf_backend project module user remove [OPTIONS]

Options

-n, --name <name>

Required Name of the service module.

reserved-ports

Returns list of reserved ports.

Displays a list of projects and their reserved port range.

fit_ctf_backend project reserved-ports [OPTIONS]

resources

Display PROJECT_NAME current resource usage.

fit_ctf_backend project resources [OPTIONS] PROJECT_NAME

Arguments

PROJECT_NAME

Required argument

server

Manage project instances.

The server command manages server nodes. User can start and stop nodes, check if it’s running or build a new image and compile compose files.

fit_ctf_backend project server [OPTIONS] COMMAND [ARGS]...

Options

-n, --name <name>

Required Project’s name

build

Build or update project’s images.

Run this command when you changed any server node image. If the image is not found try recompiling the compose file first.

fit_ctf_backend project server build [OPTIONS]

compile

Recompile project compose file.

fit_ctf_backend project server compile [OPTIONS]

health_check

fit_ctf_backend project server health_check [OPTIONS]

is-running

Check if project is running.

fit_ctf_backend project server is-running [OPTIONS]

restart

Stop login nodes and restart server nodes.

fit_ctf_backend project server restart [OPTIONS]

shell_admin

Shell into the admin container.

fit_ctf_backend project server shell_admin [OPTIONS]

start

Start server nodes.

fit_ctf_backend project server start [OPTIONS]

status

Check server nodes status.

Print output of podman ps command.

fit_ctf_backend project server status [OPTIONS]

stop

Stop server nodes.

fit_ctf_backend project server stop [OPTIONS]

fit_ctf_backend user

A command for user management.

fit_ctf_backend user [OPTIONS] COMMAND [ARGS]...

active-projects

Get a list of active projects that a user is enrolled to.

fit_ctf_backend user active-projects [OPTIONS]

Options

-u, --username <username>

Required Account username.

build

Update images from user’s compose.yaml file.

This step is usually done after compiling the YAML file.

fit_ctf_backend user build [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

cancel

Remove user from the project.

fit_ctf_backend user cancel [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

cancel-multiple

Remove multiple users from the project.

fit_ctf_backend user cancel-multiple [OPTIONS] FILENAME

Options

-pn, --project-name <project_name>

Required Project’s name.

Arguments

FILENAME

Required argument

change-password

Update user’s password.

fit_ctf_backend user change-password [OPTIONS]

Options

-u, --username <username>

Required Account username.

-p, --password <password>

Required New password.

compile

Compiles user’s compose.yaml file.

This step is usually done after editing its list of modules.

fit_ctf_backend user compile [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

create

Create a new user.

fit_ctf_backend user create [OPTIONS]

Options

-u, --username <username>

Required Account username.

-p, --password <password>

Account password.

--generate-password

Computer generate a password.

-sd, --shadow-dir <shadow_dir>

Required A directory where a shadow file will be created.

-e, --email <email>

Account email.

create-multiple

Create multiple new users.

fit_ctf_backend user create-multiple [OPTIONS] FILENAME

Options

-sd, --shadow-dir <shadow_dir>

Required A directory where a shadow file will be created.

-dp, --default-password <default_password>

Set default passwords to all new users.

Arguments

FILENAME

Required argument

delete

Remove user from the database.

fit_ctf_backend user delete [OPTIONS] [USERNAMES]...

Arguments

USERNAMES

Optional argument(s)

enroll

enroll user to the project.

fit_ctf_backend user enroll [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

enroll-multiple

Enroll multiple users to the project.

fit_ctf_backend user enroll-multiple [OPTIONS] FILENAME

Options

-pn, --project-name <project_name>

Required Project’s name.

Arguments

FILENAME

Required argument

get

Get user information.

fit_ctf_backend user get [OPTIONS]

Options

-u, --username <username>

Required Account username.

is-running

Check if user instance is running.

fit_ctf_backend user is-running [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

ls

Get a list of registered users in the database.

fit_ctf_backend user ls [OPTIONS]

Options

-a, --all

Display all users (even inactive).

module

Manages user modules.

fit_ctf_backend user module [OPTIONS] COMMAND [ARGS]...

add

Attach a project module to the user.

fit_ctf_backend user module add [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

-mn, --module-name <module_name>

Required Module’s name.

ls

Display a list of modules attached to the user in the selected module.

fit_ctf_backend user module ls [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

remove

Remove the attached module from the user.

fit_ctf_backend user module remove [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

-mn, --module-name <module_name>

Required Module’s name.

restart

Restart user instance.

fit_ctf_backend user restart [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

start

Start user instance.

fit_ctf_backend user start [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.

stop

Stop user instance.

fit_ctf_backend user stop [OPTIONS]

Options

-u, --username <username>

Required Account username.

-pn, --project-name <project_name>

Required Project’s name.