adding firewall function to firegex!
This commit is contained in:
33
backend/modules/firewall/models.py
Normal file
33
backend/modules/firewall/models.py
Normal file
@@ -0,0 +1,33 @@
|
||||
class Rule:
|
||||
def __init__(self, rule_id: int, name: str, active: bool, proto: str, ip_src:str, ip_dst:str, port_src_from:str, port_dst_from:str, port_src_to:str, port_dst_to:str, action:str, mode:str):
|
||||
self.rule_id = rule_id
|
||||
self.active = active
|
||||
self.name = name
|
||||
self.proto = proto
|
||||
self.ip_src = ip_src
|
||||
self.ip_dst = ip_dst
|
||||
self.port_src_from = port_src_from
|
||||
self.port_dst_from = port_dst_from
|
||||
self.port_src_to = port_src_to
|
||||
self.port_dst_to = port_dst_to
|
||||
self.action = action
|
||||
self.input_mode = mode in ["I"]
|
||||
self.output_mode = mode in ["O"]
|
||||
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, var: dict):
|
||||
return cls(
|
||||
rule_id=var["rule_id"],
|
||||
active=var["active"],
|
||||
name=var["name"],
|
||||
proto=var["proto"],
|
||||
ip_src=var["ip_src"],
|
||||
ip_dst=var["ip_dst"],
|
||||
port_dst_from=var["port_dst_from"],
|
||||
port_dst_to=var["port_dst_to"],
|
||||
port_src_from=var["port_src_from"],
|
||||
port_src_to=var["port_src_to"],
|
||||
action=var["action"],
|
||||
mode=var["mode"]
|
||||
)
|
||||
Reference in New Issue
Block a user