Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

csle-rest-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csle-rest-api

CSLE REST API

  • 0.7.3
  • Source
  • PyPI
  • Socket score

Maintainers
1

csle-rest-api

A REST API for the CSLE management platform.

PyPI version PyPI - Downloads

Endpoints

resourcedescriptionMethod
/emulationsList of emulationsGET,DELETE
/emulations?ids=true&token=<valid_token>List of emulation ids only (fast to fetch)GET,DELETE
/emulations/<emulation_id>?token=<valid_token>Individual emulationGET,DELETE, POST (for start/stop)
/emulations/<emulation_id>/executions?token=<valid_token>List of executionsGET,DELETE
/emulations/<emulation_id>/executions/<execution_id>?token=<valid_token>Individual executionGET,DELETE
/emulations/<emulation_id>/executions/<execution_id>/monitor/<minutes>?token=<valid_token>Get last X minutes of data from an executionGET
/simulations?token=<valid_token>List of simulationsGET,DELETE
/simulations?ids=true&token=<valid_token>List of simulation ids only (fast to fetch)GET,DELETE
/simulations/<simulation_id>?token=<valid_token>Individual simulationGET,DELETE
/cadvisor?token=<valid_token>Starts/stops or gets status cadvisorGET,POST
/pgadmin?token=<valid_token>Starts/stops or gets status of pgadminGET,POST
/nodeexporter?token=<valid_token>Starts/stops or gets status of nodeexporterGET,POST
/grafana?token=<valid_token>Starts/stops or gets status of grafanaGET, POST
/clusterstatuses?token=<valid_token>Gets the status of management services of the clusterGET
/prometheus?token=<valid_token>Starts/stops or gets status of prometheusGET,POST
/postgresql?token=<valid_token>Starts/stops or gets status of postgresqlGET,POST
/docker?token=<valid_token>Starts/stops or gets status of docker engineGET,POST
/nginx?token=<valid_token>Starts/stops or gets status of nginxGET,POST
/flask?token=<valid_token>Starts/stops or gets status of flaskGET,POST
/alpha-vec-policies?token=<valid_token>List of alpha vector policiesGET,DELETE
/alpha-vec-policies?ids=true&token=<valid_token>List of alpha vector policy ids only (fast to fetch)GET,DELETE
/alpha-vec-policies/<policy_id>?token=<valid_token>Individual alpha vector policyGET,DELETE
/dqn-policies?token=<valid_token>List of DQN policiesGET,DELETE
/dqn-policies?ids=true&token=<valid_token>List of DQN policy ids only (fast to fetch)GET,DELETE
/dqn-policies/<policy_id>?token=<valid_token>Individual DQN policyGET,DELETE
/ppo-policies?token=<valid_token>List of PPO policiesGET,DELETE
/ppo-policies?ids=true&token=<valid_token>List of PPO policy ids only (fast to fetch)GET,DELETE
/ppo-policies/<policy_id>?token=<valid_token>Individual PPO policyGET,DELETE
/vector-policies?token=<valid_token>List of vector policiesGET,DELETE
/vector-policies?ids=true&token=<valid_token>List of vector policy ids only (fast to fetch)GET,DELETE
/vector-policies/<policy_id>?token=<valid_token>Individual vector policyGET,DELETE
/tabular-policies?token=<valid_token>List of tabular policiesGET,DELETE
/tabular-policies?ids=true&token=<valid_token>List of tabular policy ids only (fast to fetch)GET,DELETE
/tabular-policies/<policy_id>?token=<valid_token>Individual tabular policyGET,DELETE
/multi-threshold-policies?token=<valid_token>List of multi-threshold policiesGET,DELETE
/multi-threshold-policies?ids=true&token=<valid_token>List of multi-threshold policy ids only (fast to fetch)GET,DELETE
/multi-threshold-policies/<policy_id>?token=<valid_token>Individual multi-threshold policyGET,DELETE
/linear-threshold-policies?token=<valid_token>List of linear threshold policiesGET,DELETE
/linear-threshold-policies?ids=true&token=<valid_token>List of linear threshold policy ids only (fast to fetch)GET,DELETE
/linear-threshold-policies/<policy_id>?token=<valid_token>Individual linear threshold policyGET,DELETE
/fnn-w-softmax-policies?token=<valid_token>List of fnn-w-softmax policiesGET,DELETE
/fnn-w-softmax-policies?ids=true&token=<valid_token>List of fnn-w-softmax policy ids only (fast to fetch)GET,DELETE
/fnn-w-softmax-policies/<policy_id>?token=<valid_token>Individual fnn-w-softmax policyGET,DELETE
/training-jobs?token=<valid_token>List of training jobsGET,DELETE
/training-jobs?ids=true&token=<valid_token>List of training job ids only (fast to fetch)GET,DELETE
/training-jobs/<job_id>?token=<valid_token>Individual training jobGET,DELETE, POST (for start/stop)
/data-collection-jobs?token=<valid_token>List of data-collection jobsGET,DELETE
/data-collection-jobs?ids=true&token=<valid_token>List of data-collection job ids only (fast to fetch)GET,DELETE
/data-collection-jobs/<job_id>?token=<valid_token>Individual data-collection jobGET,DELETE, POST (for start/stop)
/system-identification-jobs?token=<valid_token>List of system-identification jobsGET,DELETE
/system-identification-jobs?ids=true&token=<valid_token>List of system-identification job ids only (fast to fetch)GET,DELETE
/system-identification-jobs/<job_id>?token=<valid_token>Individual system-identification jobGET,DELETE, POST (for start/stop)
/emulation-traces?token=<valid_token>List of emulation tracesGET,DELETE
/emulation-traces?ids=true&token=<valid_token>List of emulation trace ids only (fast to fetch)GET,DELETE
/emulation-traces/<trace_id>?token=<valid_token>Individual emulation traceGET,DELETE
/simulation-traces?token=<valid_token>List of simulation tracesGET,DELETE
/simulation-traces?ids=true&token=<valid_token>List of simulation trace ids only (fast to fetch)GET,DELETE
/simulation-traces/<trace_id>?token=<valid_token>Individual simulation traceGET,DELETE
/emulation-simulation-traces?token=<valid_token>List of emulation-simulation tracesGET,DELETE
/emulation-simulation-traces?ids=true&token=<valid_token>List of emulation-simulation trace ids only (fast to fetch)GET,DELETE
/emulation-simulation-traces/<trace_id>?token=<valid_token>Individual emulation-simulation traceGET,DELETE
/images?token=<valid_token>List of Docker imagesGET
/file?token=<valid_token>Reads a given file from diskPOST
/experiments?token=<valid_token>List of experimentsGET,DELETE
/experiments?ids=true&token=<valid_token>List of experiment ids only (fast to fetch)GET,DELETE
/experiments/<trace_id>?token=<valid_token>Individual experimentGET,DELETE
/sdn-controllers?token=<valid_token>List of SDN controllersGET,DELETE
/sdn-controllers?ids=true&token=<valid_token>List of SDN controller ids only (fast to fetch)GET,DELETE
/emulation-statistics?token=<valid_token>List of emulation statisticsGET,DELETE
/emulation-statistics?ids=true&token=<valid_token>List of emulation statistic ids only (fast to fetch)GET,DELETE
/emulation-statistics/<trace_id>?token=<valid_token>Individual emulation statisticGET,DELETE
/gaussian-mixture-system-models?token=<valid_token>List of gaussian mixture system-modelsGET,DELETE
/gaussian-mixture-system-models?ids=true&token=<valid_token>List of gaussian mixture system-model ids only (fast to fetch)GET,DELETE
/gaussian-mixture-system-models/<trace_id>?token=<valid_token>Individual gaussian mixture system modelGET,DELETE
/empirical-system-models?token=<valid_token>List of empirical system-modelsGET,DELETE
/empirical-system-models?ids=true&token=<valid_token>List of empirical system-model ids only (fast to fetch)GET,DELETE
/empirical-system-models/<trace_id>?token=<valid_token>Individual empirical system modelGET,DELETE
/mcmc-system-models?token=<valid_token>List of mcmc system-modelsGET,DELETE
/mcmc-system-models?ids=true&token=<valid_token>List of mcmc system-model ids only (fast to fetch)GET,DELETE
/mcmc-system-models/<trace_id>?token=<valid_token>Individual mcmc system modelGET,DELETE
/gp-system-models?token=<valid_token>List of gp system-modelsGET,DELETE
/gp-system-models?ids=true&token=<valid_token>List of gp system-model ids only (fast to fetch)GET,DELETE
/gp-system-models/<model_id>?token=<valid_token>Individual gp system modelGET,DELETE
/system-models?ids=true&token=<valid_token>List of all system model ids (fast to fetch)GET
/loginLogin and generate new token (credentials as payload)POST
/traces-datasets?token=<valid_token>List of traces datasetsGET,DELETE
/traces-datasets?ids=true&token=<valid_token>List of traces datasets ids only (fast to fetch)GET,DELETE
/traces-datasets/<traces_datasets_id>?token=<valid_token>Individual traces datasetGET,DELETE
/traces-datasets/<traces_datasets_id>?token=<valid_token>&download=trueDownloads and individual traces datasetGET
/statistics-datasets?token=<valid_token>List of statistics datasetsGET,DELETE
/statistics-datasets?ids=true&token=<valid_token>List of statistics datasets ids only (fast to fetch)GET,DELETE
/statistics-datasets/<statistics_datasets_id>?token=<valid_token>Individual statistics datasetGET,DELETE
/statistics-datasets/<statistics_datasets_id>?token=<valid_token>&download=trueDownloads and individual statistics datasetGET
/emulation-executions?token=<valid_token>List of emulation executionsGET,DELETE
/emulation-executions?ids=true&token=<valid_token>List of emulation execution ids only (fast to fetch)GET,DELETE
/emulation-executions/<execution_id>?token=<valid_token>Individual emulation executionGET,DELETE
/emulation-executions/<execution_id>/info?token=<valid_token>&emulation=<emulation>Runtime information about an emulation executionGET
/emulation-executions/<execution_id>/docker-stats-manager?token=<valid_token>&emulation=<emulation>Start/stop docker stats manager of an emulation executionPOST
/emulation-executions/<execution_id>/docker-stats-monitor?token=<valid_token>&emulation=<emulation>Start/stop docker stats monitor of an emulation executionPOST
/emulation-executions/<execution_id>/client-manager?token=<valid_token>&emulation=<emulation>Start/stop client manager of an emulation executionPOST
/emulation-executions/<execution_id>/client-population?token=<valid_token>&emulation=<emulation>Start/stop client population of an emulation executionPOST
/emulation-executions/<execution_id>/client-producer?token=<valid_token>&emulation=<emulation>Start/stop client producer of an emulation executionPOST
/emulation-executions/<execution_id>/kafka-manager?token=<valid_token>&emulation=<emulation>Start/stop Kafka manager of an emulation executionPOST
/emulation-executions/<execution_id>/kafka?token=<valid_token>&emulation=<emulation>Start/stop Kafka of an emulation executionPOST
/emulation-executions/<execution_id>/snort-ids-manager?token=<valid_token>&emulation=<emulation>Start/stop Snort manager of an emulation executionPOST
/emulation-executions/<execution_id>/snort-ids-monitor?token=<valid_token>&emulation=<emulation>Start/stop Snort monitor of an emulation executionPOST
/emulation-executions/<execution_id>/snort-ids?token=<valid_token>&emulation=<emulation>Start/stop Snort on an emulation executionPOST
/emulation-executions/<execution_id>/ossec-ids-manager?token=<valid_token>&emulation=<emulation>Start/stop OSSEC IDS manager of an emulation executionPOST
/emulation-executions/<execution_id>/ossec-ids?token=<valid_token>&emulation=<emulation>Start/stop OSSEC IDS of an emulation executionPOST
/emulation-executions/<execution_id>/ossec-ids-monitor?token=<valid_token>&emulation=<emulation>Start/stop OSSEC IDS monitor of an emulation executionPOST
/emulation-executions/<execution_id>/host-manager?token=<valid_token>&emulation=<emulation>Start/stop Host managers of an emulation executionPOST
/emulation-executions/<execution_id>/host-monitor?token=<valid_token>&emulation=<emulation>Start/stop Host monitors of an emulation executionPOST
/emulation-executions/<execution_id>/elk-manager?token=<valid_token>&emulation=<emulation>Start/stop ELK managers of an emulation executionPOST
/emulation-executions/<execution_id>/elastic?token=<valid_token>&emulation=<emulation>Start/stop Elasticsearch on an emulation executionPOST
/emulation-executions/<execution_id>/logstash?token=<valid_token>&emulation=<emulation>Start/stop Logstash on an emulation executionPOST
/emulation-executions/<execution_id>/kibana?token=<valid_token>&emulation=<emulation>Start/stop Kibana on an emulation executionPOST
/emulation-executions/<execution_id>/container?token=<valid_token>&emulation=<emulation>Start/stop container of an emulation executionPOST
/emulation-executions/<execution_id>/elk-stack?token=<valid_token>&emulation=<emulation>Start/stop ELK stack of an emulation executionPOST
/emulation-executions/<execution_id>/traffic-generator?token=<valid_token>&emulation=<emulation>Start/stop traffic generators of an emulation executionPOST
/emulation-executions/<execution_id>/filebeat?token=<valid_token>&emulation=<emulation>Start/stop filebeats of an emulation executionPOST
/emulation-executions/<execution_id>/packetbeat?token=<valid_token>&emulation=<emulation>Start/stop packetbeats of an emulation executionPOST
/emulation-executions/<execution_id>/metricbeat?token=<valid_token>&emulation=<emulation>Start/stop metricbeats of an emulation executionPOST
/emulation-executions/<execution_id>/ryu-manager?token=<valid_token>&emulation=<emulation>Start/stop ryu manager of an emulation executionPOST
/emulation-executions/<execution_id>/ryu-monitor?token=<valid_token>&emulation=<emulation>Start/stop ryu monitor of an emulation executionPOST
/emulation-executions/<execution_id>/ryu-controller?token=<valid_token>&emulation=<emulation>Start/stop ryu controller of an emulation executionPOST
/emulation-executions/<execution_id>/switches?token=<valid_token>&emulation=<emulation>List of SDN switchesGET
/users?token=<valid_token>Get/Update/Delete List of usersGET,DELETE, PUT
/users?ids=true&token=<valid_token>List of user ids only (fast to fetch)GET,DELETE
/users/<user_id>?token=<valid_token>Get/update/delete individual userGET,DELETE, PUT
/users/createCreate a new userPOST
/logs?token=<valid_token>Get list of log files from the log dirGET
/logs/docker-stats-manager?token=<valid_token>Get logs of the docker stats managerGET
/logs/prometheus?token=<valid_token>Get logs of PrometheusGET
/logs/grafana?token=<valid_token>Get logs of GrafanaGET
/logs/nginx?token=<valid_token>Get logs of NginxGET
/logs/postgresql?token=<valid_token>Get logs of PostgreSQLGET
/logs/docker?token=<valid_token>Get logs of Docker engineGET
/logs/flask?token=<valid_token>Get logs of FlaskGET
/logs/clustermanager?token=<valid_token>Get logs of the Cluster managerGET
/logs/cadvisor?token=<valid_token>Get logs of CAdvisorGET
/logs/pgadmin?token=<valid_token>Get logs of pgAdminGET
/logs/container?token=<valid_token>&container=<container_name>Get logs of a specific containerPOST
/logs/node-exporter?token=<valid_token>Get logs of node-exporterGET
/logs/client-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific client managerPOST
/logs/kafka-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific Kafka managerPOST
/logs/elk-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific ELK managerPOST
/logs/ryu-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific Ryu managerPOST
/logs/traffic-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific traffic managerPOST
/logs/snort-ids-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific Snort IDS managerPOST
/logs/ossec-ids-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific OSSEC IDS managerPOST
/logs/host-manager?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific host managerPOST
/logs/ossec-ids?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific OSSEC IDSPOST
/logs/snort-ids?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific Snort IDSPOST
/logs/kafka?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific Kafka serverPOST
/logs/elk-stack?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific ELK stackPOST
/logs/ryu-controller?token=<valid_token>&emulation=<emulation_name>&executionid=<execution_id>Get logs of a specific Ryu controllerPOST
/config?token=<valid_token>Get/Update system configurationGET,PUT
/config/registration-allowedGet registration policyGET
/versionGet the version of CSLE management systemGET
/about-pageGet the about pageGET
/login-pageGet the login pageGET
/server-cluster-pageGet the server-cluster pageGET
/register-pageGet the register pageGET
/emulation-statistics-pageGet the emulation-statisticsGET
/emulations-pageGet the emulation pageGET
/images-pageGet the images pageGET
/downloads-pageGet the downloads pageGET
/jobs-pageGet the jobs pageGET
/monitoring-pageGet the monitoring pageGET
/policies-pageGet the policies pageGET
/policy-examination-pageGet the policy-examination pageGET
/sdn-controllers-pageGet the SDN-controllers pageGET
/control-plane-pageGet the control-plane pageGET
/user-admin-pageGet the user administration pageGET
/system-admin-pageGet the system administration pageGET
/logs-admin-pageGet the logs administration pageGET
/simulations-pageGet the simulations pageGET
/system-models-pageGet the system models pageGET
/traces-pageGet the traces pageGET
/training-pageGet the training pageGET
/container-terminal-pageGet the container-terminal pageGET
/server-cluster?token=<valid_token>Get details of the server clusterGET
/create-emulation?token=<valid_token>Create a new emulation configurationPOST
/create-emulation-pageGet the create emulation pageGET

Requirements

  • Python 3.8+
  • flask (for HTTP server)
  • csle-base
  • csle-common
  • csle-agents
  • csle-cluster
  • csle-system-identification
  • csle-ryu
  • bcrypt (for encrypting user credentials)
  • pyopenssl (for encrypting user credentials)
  • eventlet (for HTTP server)
  • dnspython (for HTTP server)
  • gevent (for HTTP server)
  • paramiko (for terminal emulation)
  • types-paramiko (for terminal emulation)
  • requests (for making HTTP requests)
  • types-requests (for making HTTP requests)

Development Requirements

  • Python 3.8+
  • flake8 (for linting)
  • flake8-rst-docstrings (for linting docstrings)
  • tox (for automated testing)
  • pytest (for unit tests)
  • pytest-cov (for unit test coverage)
  • mypy (for static typing)
  • mypy-extensions (for static typing)
  • mypy-protobuf (for static typing)
  • types-PyYaml (for static typing)
  • types-paramiko (for static typing)
  • types-protobuf (for static typing)
  • types-requests (for static typing)
  • types-urllib3 (for static typing)
  • sphinx (for API documentation)
  • sphinxcontrib-napoleon (for API documentation)
  • sphinx-rtd-theme (for API documentation)
  • pytest-mock (for mocking tests)
  • pytest-grpc (for grpc tests)

Installation

# install from pip
pip install csle-rest-api==<version>
# local install from source
$ pip install -e csle-rest-api
# or (equivalently):
make install
# force upgrade deps
$ pip install -e csle-rest-api --upgrade
# git clone and install from source
git clone https://github.com/Limmen/csle
cd csle/simulation-system/libs/csle-rest-api
pip3 install -e .
# Install development dependencies
$ pip install -r requirements_dev.txt

Development tools

Install all development tools at once:

make install_dev

or

pip install -r requirements_dev.txt

API documentation

This section contains instructions for generating API documentation using sphinx.

Latest Documentation

The latest documentation is available at https://limmen.dev/csle/docs/csle-rest-api

Generate API Documentation

First make sure that the CSLE_HOME environment variable is set:

echo $CSLE_HOME

Then generate the documentation with the commands:

cd docs
sphinx-apidoc -f -o source/ ../src/csle_rest_api/
make html

To update the official documentation at https://limmen.dev/csle, copy the generated HTML files to the documentation folder:

cp -r build/html ../../../../docs/_docs/csle-rest-api

To run all documentation commands at once, use the command:

make docs

Static code analysis

To run the Python linter, execute the following command:

flake8 .
# or (equivalently):
make lint

To run the mypy type checker, execute the following command:

mypy .
# or (equivalently):
make types

Unit tests

To run the unit tests, execute the following command:

pytest
# or (equivalently):
make unit_tests

To run tests of a specific test suite, execute the following command:

pytest -k "ClassName"

To generate a coverage report, execute the following command:

pytest --cov=csle_rest_api

Run tests and code analysis in different python environments

To run tests and code analysis in different python environemnts, execute the following command:

tox
# or (equivalently):
make tests

Create a new release and publish to PyPi

First build the package by executing:

python3 -m build
# or (equivalently)
make build

After running the command above, the built package is available at ./dist.

Push the built package to PyPi by running:

python3 -m twine upload dist/*
# or (equivalently)
make push

To run all commands for the release at once, execute:

make release

Author & Maintainer

Kim Hammar kimham@kth.se

LICENSE

Creative Commons

(C) 2020-2025, Kim Hammar

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc