models package

Subpackages

Submodules

models.configuration module

class app.models.configuration.Configuration(**kwargs)[source]

Bases: Base

config_type
container
containerRuleset
description
file_path
file_type
id
name
async read_content() str[source]
class app.models.configuration.DeploymentConfig(**kwargs)[source]

Bases: Configuration

config_type
container
containerRuleset
description
file_path
file_type
id
name
class app.models.configuration.RulesetConfig(**kwargs)[source]

Bases: Configuration

config_type
container
containerRuleset
description
file_path
file_type
id
name
class app.models.configuration.RuntimeConfig(**kwargs)[source]

Bases: Configuration

config_type
container
containerRuleset
description
file_path
file_type
id
name
async app.models.configuration.add_config(db: AsyncSession, configuration: Configuration)[source]
async app.models.configuration.get_all_configurations(db: AsyncSession)[source]
async app.models.configuration.get_all_configurations_by_type(db: AsyncSession, file_type: str)[source]
async app.models.configuration.get_config_by_id(db: AsyncSession, config_id: int)[source]
async app.models.configuration.get_serialized_configuration(configuration)[source]
async app.models.configuration.remove_configuration_by_id(db: AsyncSession, config_id: int)[source]

models.dataset module

class app.models.dataset.Dataset(**kwargs)[source]

Bases: Base

ammount_benign
ammount_malicious
data_file_path
dataset_type
dataset_type_id
description
id
labels_file_path
name
timestamp_precision
async app.models.dataset.add_dataset(db: AsyncSession, dataset: Dataset)[source]
async app.models.dataset.get_all_datasets(db: AsyncSession)[source]
async app.models.dataset.get_dataset_by_id(db: AsyncSession, dataset_id: int)[source]
async app.models.dataset.remove_dataset_by_id(db: AsyncSession, id: int)[source]

models.dataset_types module

class app.models.dataset_types.DatasetType(**kwargs)[source]

Bases: Base

async calculate_precision(labels_file_text_stream)[source]
dataset
description
function_prefix
async get_benign_and_malicious_counts(labels_file_text_stream)[source]
async get_positives_and_negatives_from_dataset(dataset, alerts: list)[source]
id
name
async app.models.dataset_types.get_all_dataset_types(db: AsyncSession)[source]
async app.models.dataset_types.get_dataset_type_by_id(db: AsyncSession, id: int)[source]

models.docker_host_system module

class app.models.docker_host_system.DockerHostSystem(**kwargs)[source]

Bases: Base

async check_host_health(db: AsyncSession | None = None)[source]
async choose_metric_service_port() int[source]
container
docker_port
get_host_and_docker_port() tuple[source]
get_metric_service_container_name() str[source]
get_metric_service_core_base_url() str[source]
get_metric_service_image() str[source]
get_metric_service_image_name() str[source]
get_metric_service_image_version() str[source]
get_metric_service_metric_endpoint() str[source]
get_metric_service_prometheus_job_name() str[source]
get_metric_service_pushgateway_base_url() str[source]
get_metric_service_registration_endpoint() str[source]
get_metric_service_registration_ip() str[source]
async get_metric_service_registration_ip_async() str[source]
host
id
is_core_host() bool[source]
async is_host_reachable(timeout: float = 2.0) bool[source]
async is_metric_service_port_available(port: int, timeout: float = 0.5) bool[source]
metric_service
name
async remove_metric_service_container() None[source]
resolve_host_aliases() set[str][source]
status
async update_availability(db: AsyncSession)[source]
async app.models.docker_host_system.add_host_system(db: AsyncSession, host: DockerHostSystem)[source]
async app.models.docker_host_system.get_all_hosts(db: AsyncSession)[source]
async app.models.docker_host_system.get_host_by_id(db: AsyncSession, id: int)[source]
async app.models.docker_host_system.remove_host(db: AsyncSession, host_id: int)[source]
async app.models.docker_host_system.set_host_status(db: AsyncSession, host: DockerHostSystem, status: DOCKER_HOST_STATUS)[source]

models.ensemble module

class app.models.ensemble.Ensemble(**kwargs)[source]

Bases: Base

async add_container(db: AsyncSession, container_id: int)[source]
async container_is_last_one_running(db: AsyncSession, container)[source]
current_analysis_id
description
ensemble_ids
ensemble_technique
async generate_new_analysis_id(db: AsyncSession)[source]
async get_assigned_containers(db: AsyncSession)[source]
async get_ensemble_ids(db: AsyncSession)[source]
id
async is_container_running()[source]
name
async remove_container(db: AsyncSession, container_id: int)[source]
async start_network_analysis(db: AsyncSession, network_analysis_data)[source]
async start_static_analysis(db: AsyncSession, dataset_id: int)[source]
status
async stop_analysis(db: AsyncSession)[source]
technique_id
async unset_analysis_id(db: AsyncSession)[source]
async app.models.ensemble.add_ensemble(db: AsyncSession, ensemble: Ensemble)[source]
async app.models.ensemble.get_all_ensembles(db: AsyncSession)[source]
async app.models.ensemble.get_ensemble_by_id(db: AsyncSession, id: int)[source]
async app.models.ensemble.remove_ensemble(db: AsyncSession, ensemble: Ensemble)[source]
async app.models.ensemble.update_ensemble(db: AsyncSession, ensemble: EnsembleUpdate)[source]
async app.models.ensemble.update_ensemble_status(db: AsyncSession, status: STATUS, ensemble: Ensemble)[source]

models.ensemble_ids module

class app.models.ensemble_ids.EnsembleIds(**kwargs)[source]

Bases: Base

ensemble_id
id
ids_system_id
status
async app.models.ensemble_ids.get_all_ensemble_container(db: AsyncSession)[source]
async app.models.ensemble_ids.get_ensemble_ids_by_ids(db: AsyncSession, ensemble_id: int, system_id: int)[source]
async app.models.ensemble_ids.last_container_sending_logs(db: AsyncSession, container, ensemble)[source]
async app.models.ensemble_ids.update_sendig_logs_status(db: AsyncSession, container, ensemble, status: ANALYSIS_STATUS)[source]

models.ensemble_technique module

class app.models.ensemble_technique.EnsembleTechnique(**kwargs)[source]

Bases: Base

description
ensemble
async execute_technique_by_name_on_alerts(alerts_dict: dict, ensemble)[source]
function_name
id
name
async app.models.ensemble_technique.get_all_ensemble_techniques(db: AsyncSession)[source]
async app.models.ensemble_technique.get_ensemble_technique_by_id(db: AsyncSession, id: int)[source]

models.ids_container module

class app.models.ids_component.IdsComponent(**kwargs)[source]

Bases: Base

Represents a component of a CIDS deployment (sensor, aggregator, etc.)

container
count
get_http_url() str[source]

Get the HTTP URL for communicating with this component.

host_system
host_system_id
id
ids_id
name
port
role
runtime_configuration
runtime_configuration_id
service_name

models.ids_tool module

class app.models.ids_tool.IdsTool(**kwargs)[source]

Bases: Base

analysis_method
container
deployment_type
id
ids_type
image_name
image_tag
name
required_env_vars
requires_ruleset
async app.models.ids_tool.add_ids_tool(db: AsyncSession, tool: IdsTool)[source]
async app.models.ids_tool.delete_ids_tool(db: AsyncSession, tool_id: int)[source]
async app.models.ids_tool.get_all_tools(db: AsyncSession)[source]
async app.models.ids_tool.get_ids_by_id(db: AsyncSession, ids_id: int)[source]
async app.models.ids_tool.update_ids_tool(db: AsyncSession, tool_update)[source]