2022-07-21 20:25:39 +02:00
|
|
|
import base64
|
|
|
|
|
|
|
|
|
|
class Service:
|
2025-02-18 17:36:15 +01:00
|
|
|
def __init__(self, service_id: str, status: str, port: int, name: str, proto: str, ip_int: str, fail_open: bool, **other):
|
2023-09-29 16:10:28 +02:00
|
|
|
self.id = service_id
|
2022-07-21 20:25:39 +02:00
|
|
|
self.status = status
|
|
|
|
|
self.port = port
|
|
|
|
|
self.name = name
|
|
|
|
|
self.proto = proto
|
|
|
|
|
self.ip_int = ip_int
|
2025-02-18 17:36:15 +01:00
|
|
|
self.fail_open = fail_open
|
2022-07-21 20:25:39 +02:00
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def from_dict(cls, var: dict):
|
2023-09-29 16:10:28 +02:00
|
|
|
return cls(**var)
|
2022-07-21 20:25:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Regex:
|
2025-02-02 22:27:12 +01:00
|
|
|
def __init__(self, regex_id: int, regex: bytes, mode: str, service_id: str, blocked_packets: int, is_case_sensitive: bool, active: bool, **other):
|
2022-07-21 20:25:39 +02:00
|
|
|
self.regex = regex
|
|
|
|
|
self.mode = mode
|
|
|
|
|
self.service_id = service_id
|
|
|
|
|
self.blocked_packets = blocked_packets
|
2023-09-29 16:10:28 +02:00
|
|
|
self.id = regex_id
|
2022-07-21 20:25:39 +02:00
|
|
|
self.is_case_sensitive = is_case_sensitive
|
|
|
|
|
self.active = active
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def from_dict(cls, var: dict):
|
2024-04-09 03:52:10 +02:00
|
|
|
var['regex'] = base64.b64decode(var['regex'])
|
2023-09-29 16:10:28 +02:00
|
|
|
return cls(**var)
|