minor fixes

This commit is contained in:
Domingo Dirutigliano
2025-03-04 16:57:15 +01:00
parent 47496287d5
commit 22b90376b3
6 changed files with 31 additions and 8 deletions

View File

@@ -57,8 +57,9 @@ def generate_filter_structure(filters: list[str], proto:str, glob:dict) -> list[
def get_filters_info(code:str, proto:str) -> list[FilterHandler]:
glob = {}
exec(code, glob, glob)
exec("import firegex.nfproxy", glob, glob)
exec("firegex.nfproxy.clear_pyfilter_registry()", glob, glob)
exec(code, glob, glob)
filters = eval("firegex.nfproxy.get_pyfilters()", glob, glob)
try:
return generate_filter_structure(filters, proto, glob)

View File

@@ -262,12 +262,15 @@ def run_proxy_simulation(filter_file:str, proto:str, target_ip:str, target_port:
if os.path.isfile(filter_file) is False:
raise Exception(f"\\[nfproxy]\\[init] Filter file {filter_file} not found")
else:
filter_file = os.path.abspath(filter_file)
proxy_process:Process|None = None
def reload_proxy_proc():
nonlocal proxy_process
if proxy_process is not None:
log_print("RELOADING", "Proxy reload triggered", level=LogLevels.WARNING)
proxy_process.kill()
proxy_process.join()
proxy_process = None