|
Smart Home firewall
Profile-based Smart Home firewall
|


Public Member Functions | |
| bool | is_ip (self, Union[str, list] addr) |
| str | explicit_address (self, Union[str, list] addr) |
| None | add_addr_nfqueue (self, str addr_dir, bool is_backward=False) |
| None | add_addr (self, str addr_dir, bool is_backward=False, str initiator="") |
| dict | parse (self, bool is_backward=False, str initiator="") |
Public Member Functions inherited from protocols.Protocol.Protocol | |
| None | __init__ (self, dict protocol_data, dict device) |
| Protocol | init_protocol (c, str protocol_name, dict protocol_data, dict device) |
| str | format_list (self, list l, func=lambda x:x) |
| None | add_field (self, str field, dict template_rules, bool is_backward=False, func=lambda x:x, backward_func=lambda x:x) |
Static Public Member Functions | |
| bool | is_ip_static (Union[str, list] addr, str version="ipv4") |
Static Public Member Functions inherited from protocols.Protocol.Protocol | |
| Union[str, int] | convert_value (str value) |
Static Public Attributes | |
| int | layer = 3 |
| bool | custom_parser = False |
| list | supported_keys |
| dictionary | addrs |
Additional Inherited Members | |
Public Attributes inherited from protocols.Protocol.Protocol | |
| protocol_data | |
| device | |
| rules | |
| None protocols.ip.ip.add_addr | ( | self, | |
| str | addr_dir, | ||
| bool | is_backward = False, |
||
| str | initiator = "" |
||
| ) |
Add a new IP address match to the accumulator, in two possible ways:
- If the address is a well-known alias or an explicit IP address, add an nftables match.
- If the address is a domain name, add an nfqueue match.
:param addr_dir: Address direction to add the rule to (src or dst)
:param is_backward: Whether the field to add is for a backward rule.
:param initiator: Optional, initiator of the connection (src or dst).
| None protocols.ip.ip.add_addr_nfqueue | ( | self, | |
| str | addr_dir, | ||
| bool | is_backward = False |
||
| ) |
Add a new IP address match to the nfqueue accumulator. :param addr_dir: Address direction to add the rule to (src or dst) :param is_backward: Whether the field to add is for a backward rule.
| str protocols.ip.ip.explicit_address | ( | self, | |
| Union[str,list] | addr | ||
| ) |
Return the explicit version of an IP address alias, or a list of IP address aliases. Example: "local" -> "192.168.0.0/16" :param addr: IP address alias(es) to explicit. :return: Explicit IP address(es). :raises ValueError: If the address is not a well-known alias or an explicit address.
| bool protocols.ip.ip.is_ip | ( | self, | |
| Union[str, list] | addr | ||
| ) |
Check whether a (list of) string is a well-known IP alias or an explicit IP address. :param addr: (list of) string to check. :return: True if the (list of) string is an IP address, False otherwise.
|
static |
Check whether a (list of) string is a well-known IP alias or an explicit IP address. :param addr: (list of) string to check. :param version: IP version (ipv4 or ipv6). Default is "ipv4". :return: True if the (list of) string is an IP address, False otherwise.
| dict protocols.ip.ip.parse | ( | self, | |
| bool | is_backward = False, |
||
| str | initiator = "" |
||
| ) |
Parse the IP (v4 or v6) protocol.
:param is_backward (optional): Whether the protocol must be parsed for a backward rule.
Optional, default is `False`.
:param initiator (optional): Connection initiator (src or dst).
Optional, default is "src".
:return: Dictionary containing the (forward and backward) nftables and nfqueue rules for this policy.
Reimplemented from protocols.Protocol.Protocol.
|
static |
|
static |