csle_collector.host_manager.dao package

Submodules

csle_collector.host_manager.dao.failed_login_attempt module

class csle_collector.host_manager.dao.failed_login_attempt.FailedLoginAttempt[source]

Bases: csle_base.json_serializable.JSONSerializable

Class representing a failed login event on some server in the emulation

static from_dict(parsed_stats_dict: Dict[str, Any]) csle_collector.host_manager.dao.failed_login_attempt.FailedLoginAttempt[source]

Parses a FailedLoginAttempt object from a dict

Parameters

parsed_stats_dict – the dict to parse

Returns

the parsed FailedLoginAttempt object

static from_json_file(json_file_path: str) csle_collector.host_manager.dao.failed_login_attempt.FailedLoginAttempt[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

static parse_from_str(login_attempt_str: str) csle_collector.host_manager.dao.failed_login_attempt.FailedLoginAttempt[source]

Parses a failed login event DTO from a string

Parameters

login_attempt_str – the string to parse

Returns

the parsed DTO

to_dict() Dict[str, Any][source]

Converts the object to a dict representation

Returns

a dict representation of the object

csle_collector.host_manager.dao.host_metrics module

class csle_collector.host_manager.dao.host_metrics.HostMetrics(num_logged_in_users: int = 0, num_failed_login_attempts: int = 0, num_open_connections: int = 0, num_login_events: int = 0, num_processes: int = 0, num_users: int = 0, ip: Optional[str] = None, ts: Union[None, float] = None)[source]

Bases: csle_base.json_serializable.JSONSerializable

DTO class containing host metrics

copy() csle_collector.host_manager.dao.host_metrics.HostMetrics[source]
Returns

a copy of the object

static from_dict(d: Dict[str, Any]) csle_collector.host_manager.dao.host_metrics.HostMetrics[source]

Converts a dict representation to an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_collector.host_manager.dao.host_metrics.HostMetrics[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

static from_kafka_record(record: str) csle_collector.host_manager.dao.host_metrics.HostMetrics[source]

Converts the Kafka record string to a DTO

Parameters

record – the kafka record

Returns

the created DTO

get_deltas(stats_prime: csle_collector.host_manager.dao.host_metrics.HostMetrics) Tuple[List[int], List[str]][source]

Get the deltas between two stats objects

Parameters
  • stats_prime – the stats object to compare with

  • max_counter – the maximum counter_value

Returns

the deltas and the labels

get_values() Tuple[List[int], List[str]][source]

Get the current values

Returns

the values and the labels

num_attributes() int[source]
Returns

The number of attributes of the DTO

static schema() csle_collector.host_manager.dao.host_metrics.HostMetrics[source]
Returns

get the schema of the DTO

to_dict() Dict[str, Any][source]
Returns

a dict representation of the instance

to_dto(ip: str) host_manager_pb2.HostMetricsDTO[source]

Converts the object into a gRPC DTO for serialization

Parameters

ip – the ip to add to the DTO in addition to the metrics

Returns

a csle_collector.host_manager.host_manager_pb2.HostMetricsDTO

to_kafka_record(ip: str) str[source]

Converts the DTO into a Kafka record string

Parameters

ip – the IP to add to the record in addition to the metrics

Returns

a comma separated string representing the kafka record

update_with_kafka_record(record: str, ip: str) None[source]

Updates the DTO based on a kafka record

Parameters
  • record – the kafka record

  • ip – the host ip

Returns

None

csle_collector.host_manager.dao.successful_login module

class csle_collector.host_manager.dao.successful_login.SuccessfulLogin[source]

Bases: csle_base.json_serializable.JSONSerializable

DTO Class representing a parsed successful login event from a server in the emulation

static from_dict(parsed_stats_dict: Dict[str, Any]) csle_collector.host_manager.dao.successful_login.SuccessfulLogin[source]

Parses a FailedLoginAttempt object from a dict

Parameters

parsed_stats_dict – the dict to parse

Returns

the parsed FailedLoginAttempt object

static from_json_file(json_file_path: str) csle_collector.host_manager.dao.successful_login.SuccessfulLogin[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

static parse_from_str(login_attempt_str: str, year: int)[source]

Parses a login event from a string

Parameters
  • login_attempt_str – the string to parse

  • year – the current year

Returns

the parsed login event

to_dict() Dict[str, Any][source]

Converts the object to a dict representation

Returns

a dict representation of the object

Module contents