Skip to main content

AMOSSYS Cyber Range client API

Installation

Note: it is recommanded to install the package in a virtualenv in order to avoid conflicts with version dependencies of other packages.

python3 setup.py install

Configuration

Access to the Cyber Range is possible with either of the following configuration methods.

Configuration through configuration file (CLI only)

It is possible to configure access to the Cyber Range through a configuration file, specified with the --config command line parameter:

$ cyber_range --help
(...)
--config CONFIG       Configuration file
(...)

Configuration file content should be of the form --key = value (without quotes in values), as in the following exemple:

[DEFAULT]
--core-url = https://[CORE-URL-API]
--scenario-url = https://[SCENARIO-URL-API]
--provisioning-url = https://[PROVISIONING-URL-API]
--redteam-url = https://[REDTEAM-URL-API]
--cacert = <PATH TO CA CERT>
--cert = <PATH TO CLIENT CERT>
--key = <PATH TO CLIENT PRIVATE KEY>

Configuration through command line arguments (CLI only)

It is possible to configure access to the Cyber Range through command line arguments. See cyber_range --help command line output for available parameters:

$ cyber_range --help
(...)
  --core-url CORE_API_URL
                        Set core API URL (default: 'http://127.0.0.1:5000')
  --scenario-url SCENARIO_API_URL
                        Set scenario API URL (default: 'http://127.0.0.1:5002')
  --provisioning-url PROVISIONING_API_URL
                        Set provisioning API URL (default: 'http://127.0.0.1:5003')
  --redteam-url REDTEAM_API_URL
                        Set redteam API URL (default: 'http://127.0.0.1:5004')
  --cacert CACERT       Set path to CA certs
  --cert CERT           Set path to client cert
  --key KEY             Set path to client key

Configuration through programmatic means

It is possible to configure access to the Cyber Range programmatically in Python:

import cr_api_client.core_api_client as core_api_client
import cr_api_client.core_helper as core_helper
import cr_api_client.scenario_helper as scenario_helper
import cr_api_client.provisioning_helper as provisioning_helper
import cr_api_client.attack_helper as attack_helper

# Set URL API
core_api_client.CORE_API_URL = "https://[CORE-URL-API]"
scenario_helper.SCENARIO_API_URL = "https://[SCENARIO-URL-API]"
provisioning_helper.PROVISIONING_API_URL = "https://[PROVISIONING-URL-API]"
redteam_helper.REDTEAM_API_URL = "https://[REDTEAM-URL-API]"

# Set server and client certificates for Core API
core_api_client.CA_CERT_PATH = <PATH TO CA CERT>
core_api_client.CLIENT_CERT_PATH = <PATH TO CLIENT CERT>
core_api_client.CLIENT_KEY_PATH = <PATH TO CLIENT PRIVATE KEY>

# Apply same server and client certificates to other API
redteam_helper.CA_CERT_PATH = provisioning_helper.CA_CERT_PATH = scenario_helper.CA_CERT_PATH = core_api_client.CA_CERT_PATH
redteam_helper.CLIENT_CERT_PATH = provisioning_helper.CLIENT_CERT_PATH = scenario_helper.CLIENT_CERT_PATH = core_api_client.CLIENT_CERT_PATH
redteam_helper.CLIENT_KEY_PATH = provisioning_helper.CLIENT_KEY_PATH = scenario_helper.CLIENT_KEY_PATH = core_api_client.CLIENT_KEY_PATH

CLI usage

See cyber_range --help command line output for available parameters:

$ cyber_range --help
(...)

Programmatic usage

Platform initialization API

Before starting a new simulation, the platform has to be initialized:

core_api_client.virtclient_reset()
core_api_client.reset_database()
attack_helper.reset_redteam()

Simulation API

core_helper.simu_create(architecture_file: str)  # Process YAML configuration file and request core API to create a new simulation

core_helper.simu_run(id_simulation: int, use_vm_time: bool)  # Start the simulation, with current time (by default) or time where the VM was created (use_vm_time=True)

core_helper.simu_pause(id_simulation: int)  # Pause a simulation (calls libvirt suspend API)

core_helper.simu_unpause(id_simulation: int)  # Pause a simulation (calls libvirt suspend API)

core_helper.simu_halt(id_simulation: int)  # Properly stop a simulation, by sending a shutdown signal to the operating systems

core_helper.simu_destroy(id_simulation: int)  # Stop a simulation through a hard reset

core_helper.simu_clone(id_simulation: int) -> int  # Clone a simulation and create a new simulation, and return the new ID

core_helper.simu_tap(id_simulation: int, iface: str)  # Mirror all network traffic through a local network interface

core_helper.simu_untap(id_simulation: int, iface: str)  # Stop mirroring all network traffic

core_helper.simu_delete(id_simulation: int)  # Delete a simulation in database


### Provisioning API

provisioning_helper.aging_execute(aging_configuration_file: str, id_simulation: int)  # Apply provisioning configuration defined in YAML file on simulation defined in argument ID


### Scenario API

scenario_helper.scenario_play(id_simulation: int, scenario_path: str)  # Play scenario defined in specific path on simulation defined in argument ID


### Redteam API

*In progress*

Metadata

Release files for cr-api-client 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cr-api-client 1.3.3
File Size Uploaded Provenance Actions
cr_api_client-1.3.3.tar.gz 14.0 kB Without provenance Details for cr_api_client-1.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cr-api-client 1.3.3
File Interpreter ABI Platform Actions
cr_api_client-1.3.3-py3-none-any.whl Python 3 none any Details for cr_api_client-1.3.3-py3-none-any.whl

Total release size: 41.5 kB

Release files / cr_api_client-1.3.3.tar.gz

Download URL cr_api_client-1.3.3.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2b0e7f88681201c78083068cc91fae549c54c02d73173ec86b8075d4e2fcc651
BLAKE2b-256 checksum
How to use checksums
21ad16fbb5b3e3552e159a6dac3c9357f6dcd570309b2f458489165f5c846d50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-62-generic

Release files / cr_api_client-1.3.3-py3-none-any.whl

Download URL cr_api_client-1.3.3-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ce3ab4d66fa8d272b4eabf6178c1057d6b24afc75c16d5b5627fbe43a6268ac
BLAKE2b-256 checksum
How to use checksums
8298e95796aa777ff56ad311bf9a866e2892ce1d96e19fd59d890ab4c604f4c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-62-generic

Security for cr-api-client 1.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.3.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page