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

Added submodule: protocol-translators

parent 1cf232d9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
[submodule "src/parsers"]
path = src/parsers
url = git@github.com:smart-home-network-security/protocol-parsers.git
[submodule "src/translator/protocols"]
path = src/translator/protocols
url = git@github.com:smart-home-network-security/protocol-translators.git
Subproject commit 1e50c8e334b64826fa8477ccb996cf18f6e3e8d5
......@@ -5,11 +5,19 @@ of NFTables firewall script and NFQueue C source code.
# Libraries
import os
import sys
from pathlib import Path
import argparse
import yaml
import jinja2
from typing import Tuple
# Paths
script_name = os.path.basename(__file__)
script_path = Path(os.path.abspath(__file__))
script_dir = script_path.parents[0]
sys.path.insert(0, os.path.join(script_dir, "protocols"))
# Custom classes
from LogType import LogType
from Policy import Policy
......@@ -157,12 +165,11 @@ if __name__ == "__main__":
parser.add_argument("-t", "--test", action="store_true", help="Test mode: use VM instead of router")
args = parser.parse_args()
# Retrieve useful paths
script_path = os.path.abspath(os.path.dirname(__file__)) # This script's path
device_path = os.path.abspath(os.path.dirname(args.profile)) # Device profile's path
# Retrieve device profile's path
device_path = os.path.abspath(os.path.dirname(args.profile))
# Jinja2 loader
loader = jinja2.FileSystemLoader(searchpath=f"{script_path}/templates")
loader = jinja2.FileSystemLoader(searchpath=f"{script_dir}/templates")
env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
# Add custom Jinja2 filters
env.filters["debug"] = debug
......
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