API

The “API Endpoints” module encompasses all available API endpoints responsible for managing decoys, performing operations, configuring the Docker client, and more within the framework.

DOLOST.blueprints.api.clean_collector()[source]

Remove collector.

Returns:

Response indicating the success of the operation.

Return type:

Response

DOLOST.blueprints.api.clean_decoy(decoy)[source]

Remove decoy.

Parameters:

decoy (dict) – Decoy information.

Returns:

Response indicating the success of the operation.

Return type:

Response

DOLOST.blueprints.api.clean_env()[source]

Endpoint to remove deployed decoys.

Returns:

Response indicating the success of the operation.

Return type:

Response

DOLOST.blueprints.api.clean_networks()[source]

Remove networks.

Returns:

Response indicating the success of the operation.

Return type:

Response

DOLOST.blueprints.api.decoys_start()[source]

Start a specific decoy.

Returns:

JSON response indicating the status of the operation.

Return type:

Response

DOLOST.blueprints.api.decoys_stop()[source]

Stop a specific decoy.

Returns:

JSON response indicating the status of the operation.

Return type:

Response

DOLOST.blueprints.api.delete_decoy(operation_id)[source]

Delete a specific decoy from an operation.

Parameters:

operation_id (int) – The ID of the operation containing the decoy.

Returns:

JSON response indicating the status of the decoy deletion.

Return type:

jsonify

DOLOST.blueprints.api.deploy_collector()[source]

Deploy the collector service.

Returns:

None

DOLOST.blueprints.api.deploy_container(operation_id)[source]

Deploy a specific decoy, including building and deployment.

Parameters:

operation_id (int) – The ID of the operation associated with the decoy.

Returns:

JSON response indicating the status of the operation.

Return type:

Response

DOLOST.blueprints.api.deploy_decoy(decoy)[source]

Deploy a decoy service.

Parameters:

decoy (dict) – Decoy information including hostname, network settings, and service details.

Returns:

None

DOLOST.blueprints.api.deploy_env()[source]

Endpoint for deploying the environment.

Returns:

A response indicating the deployment status.

Return type:

Response

DOLOST.blueprints.api.deploy_service(image_name, dockerfile_path, decoy_files, service_info)[source]

Deploy a service using Docker.

Parameters:
  • image_name (str) – The name of the Docker image.

  • dockerfile_path (str) – The path to the Dockerfile.

  • decoy_files (str) – The path to service files.

  • service_info (dict) – Information about the service.

Returns:

None

DOLOST.blueprints.api.edit_operation(operation_id)[source]

Edit an existing operation.

Parameters:

operation_id (int) – The ID of the operation to edit.

Returns:

JSON response indicating the status of the operation editing.

Return type:

jsonify

DOLOST.blueprints.api.error_handling(func)[source]

Decorator for error handling.

Parameters:

func (function) – The function to be decorated.

Returns:

The wrapper function for error handling.

Return type:

function

DOLOST.blueprints.api.find_operation_by_id(operation_id)[source]

Get an operation from the database using its ID.

Parameters:

operation_id (int) – The ID of the operation to find.

Returns:

The operation data if found, otherwise None.

Return type:

dict

DOLOST.blueprints.api.generate_new_id(operations)[source]

Generate ID for a new operation based on the last ID in the JSON file.

Parameters:

operations (list) – List of existing operations.

Returns:

The ID for the new operation.

Return type:

int

DOLOST.blueprints.api.get_supported_services()[source]

Fetches the current available Dockerfile services.

Returns:

A list of supported services.

Return type:

list

DOLOST.blueprints.api.load_operations_db()[source]

Load existing operations from the JSON file.

Returns:

A list containing operations data loaded from the JSON file.

Return type:

list

DOLOST.blueprints.api.modify_docker_client()[source]

Modify the Docker client configuration.

Returns:

JSON response indicating the status of the Docker client configuration modification.

Return type:

jsonify

DOLOST.blueprints.api.new_decoy(operation_id)[source]

Create a new decoy for an operation.

Parameters:

operation_id (int) – The ID of the operation to add the decoy to.

Returns:

JSON response indicating the status of the new decoy creation.

Return type:

jsonify

DOLOST.blueprints.api.new_operation()[source]

Create a new operation.

This endpoint allows the creation of a new operation. It expects a POST request with JSON data containing the necessary information for the new operation.

Returns:

JSON response indicating the status of the operation creation.
  • status (str): Status of the operation creation (“OK” or “error”).

  • message (str): Additional message providing details about the status.

  • redirect (str, optional): URL to redirect the client to upon successful operation creation.

Return type:

jsonify

Raises:

BadRequest – If the request data is invalid or missing required fields.

DOLOST.blueprints.api.remove_operation(operation_id)[source]

Remove an operation.

Parameters:

operation_id (str) – The ID of the operation to remove.

Returns:

JSON response indicating the status of the operation removal.

Return type:

jsonify

DOLOST.blueprints.api.undeploy_container(operation_id)[source]

Undeploy a container decoy for an operation.

Parameters:

operation_id (int) – The ID of the operation containing the decoy.

Returns:

JSON response indicating the status of the container undeployment.

Return type:

jsonify

DOLOST.blueprints.api.update_operation_decoys(operation_id, decoy)[source]

Modify the operation’s decoys.

Parameters:
  • operation_id (int) – The ID of the operation.

  • decoy (dict) – Decoy information to be added to the operation.

DOLOST.blueprints.api.update_operation_entry(operation_id, new_operation_content, update_decoys: bool = False)[source]

Update an operation based on its ID.

Parameters:
  • operation_id (int) – The ID of the operation to be updated.

  • new_operation_content (dict) – The new content for the operation.

  • update_decoys (bool, optional) – Whether to update decoys data. Defaults to False.

DOLOST.blueprints.api.update_operations_db(data)[source]

Update the JSON file with modified operations data.

Parameters:

data (list) – The modified operations data to be written to the JSON file.