diff --git a/profile_translator_blocklist/Policy.py b/profile_translator_blocklist/Policy.py index 7981449dd6834b3c49ea11f1b542488de55e704f..042192eb86883cfeed9e6a3832fb2434b089c18c 100644 --- a/profile_translator_blocklist/Policy.py +++ b/profile_translator_blocklist/Policy.py @@ -436,8 +436,16 @@ class Policy: Returns: str: Identifier for this Policy. """ - highest_protocol = list(dict.keys(self.profile_data["protocols"]))[-1] - id = highest_protocol - for key, value in dict.items(self.profile_data["protocols"][highest_protocol]): - id += f"_{key}_{value}" + profile_data_protocols: dict = self.profile_data["protocols"] + protocols = profile_data_protocols.keys() + id = "" + + for protocol in protocols: + if id: + id += "_" + id += protocol + protocol_data: dict = profile_data_protocols[protocol] + for key, value in protocol_data.items(): + id += f"_{key}_{value}" + return id diff --git a/pyproject.toml b/pyproject.toml index 70877a74d4d29d619e12a09b3cf30501f2d9cded..446788e24b1db17d644b6420da4d63d675a21076 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "profile-translator-blocklist" -version = "0.6.0" +version = "0.7.0" description = "Translate IoT YAML profiles to NFTables / NFQueue files for a block-list firewall." readme = "README.md" requires-python = ">=3.8" diff --git a/setup.py b/setup.py deleted file mode 100644 index ea51e11b9a0b191eccf42dbdd385f9a938ca7671..0000000000000000000000000000000000000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name='profile-translator-blocklist', - version='0.4.0', - author='François De Keersmaeker', - author_email='francois.dekeersmaeker@uclouvain.be', - description='Translate IoT YAML profiles to NFTables / NFQueue files for a block-list firewall.', - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - url='https://github.com/smart-home-network-security/profile-translator-blocklist', - license='GPLv3+', - packages=find_packages(), - classifiers=[ - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', - 'Operating System :: OS Independent' - ], - python_requires='>=3.8', - install_requires=[ - "PyYAML", - "Jinja2", - "pyyaml-loaders" - ], - package_data={ - 'profile_translator_blocklist': ['templates/*'] - }, - include_package_data=True -)