Skip to content
Extraits de code Groupes Projets
Valider baaf4b68 rédigé par François De Keersmaeker's avatar François De Keersmaeker
Parcourir les fichiers

Updated IP translator for block-list firewall

parent 1e50c8e3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -17,7 +17,7 @@ class dns(Custom):
@staticmethod
def get_domain_name_rule(domain_name: str) -> dict:
"""
Retrieves the NFQueue rule to match a given domain name.
Retrieve the NFQueue rule to match a given domain name.
:param domain_name: Domain name to match.
:return: Dictionary containing the NFQueue rule to match the given domain name.
......
......@@ -145,11 +145,10 @@ class ip(Protocol):
domain_name_rule_suffix = "_addr}})"
ip_addr_rule_prefix = "compare_ip((ip_addr_t) {{.version = " + str(version) + ", .value." + self.protocol_name + " = "
ip_addr_rule_suffix = "_addr(payload)}}, ip_str_to_net(\"{}\", " + str(version) + "))"
cached_ip_rule_suffix = "_addr}}, interactions_data[{}].cached_ip)"
# Template rules for a domain name
rules_domain_name = {
"forward": "( " + ip_addr_rule_prefix + addr_dir + cached_ip_rule_suffix + " || " + domain_name_rule_prefix + addr_dir + domain_name_rule_suffix + " )",
"backward": "( " + ip_addr_rule_prefix + other_dir + cached_ip_rule_suffix + " || " + domain_name_rule_prefix + other_dir + domain_name_rule_suffix + " )"
"forward": "( " + domain_name_rule_prefix + addr_dir + domain_name_rule_suffix + " )",
"backward": "( " + domain_name_rule_prefix + other_dir + domain_name_rule_suffix + " )"
}
# Template rules for an IP address
rules_address = {
......
from ip import ip
from igmp import igmp
class ipv4(ip):
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter