diff --git a/docs/user/lib_mapper/nist.md b/docs/user/lib_mapper/nist.md index d23e4a4b..0fd7ce01 100644 --- a/docs/user/lib_mapper/nist.md +++ b/docs/user/lib_mapper/nist.md @@ -7,5 +7,6 @@ | cisco:ios_xe | → | cisco_xe | | cisco:ios_xr | → | cisco_xr | | cisco:nx-os | → | cisco_nxos | +| hpe:arubaos-cx | → | aruba_aoscx | | juniper:junos | → | juniper_junos | -| paloaltonetworks:pan-os | → | paloalto_panos | \ No newline at end of file +| paloaltonetworks:pan-os | → | paloalto_panos | diff --git a/docs/user/lib_mapper/nist_reverse.md b/docs/user/lib_mapper/nist_reverse.md index 4016104e..85456818 100644 --- a/docs/user/lib_mapper/nist_reverse.md +++ b/docs/user/lib_mapper/nist_reverse.md @@ -1,6 +1,7 @@ | NORMALIZED | | NIST | | ---------- | -- | ------ | | arista_eos | → | arista:eos | +| aruba_aoscx | → | hpe:arubaos-cx | | aruba_os | → | arubanetworks:arubaos | | cisco_asa | → | cisco:adaptive_security_appliance_software | | cisco_ios | → | cisco:ios | @@ -8,4 +9,4 @@ | cisco_xe | → | cisco:ios_xe | | cisco_xr | → | cisco:ios_xr | | juniper_junos | → | juniper:junos | -| paloalto_panos | → | paloaltonetworks:pan-os | \ No newline at end of file +| paloalto_panos | → | paloaltonetworks:pan-os | diff --git a/netutils/lib_mapper.py b/netutils/lib_mapper.py index 1a1ec184..1e35250a 100644 --- a/netutils/lib_mapper.py +++ b/netutils/lib_mapper.py @@ -555,9 +555,10 @@ "arubanetworks:arubaos": "aruba_os", "cisco:adaptive_security_appliance_software": "cisco_asa", "cisco:ios": "cisco_ios", - "cisco:nx-os": "cisco_nxos", "cisco:ios_xe": "cisco_xe", "cisco:ios_xr": "cisco_xr", + "cisco:nx-os": "cisco_nxos", + "hpe:arubaos-cx": "aruba_aoscx", "juniper:junos": "juniper_junos", "paloaltonetworks:pan-os": "paloalto_panos", } @@ -741,6 +742,7 @@ # Normalized | NIST NIST_LIB_MAPPER_REVERSE: t.Dict[str, str] = { "arista_eos": "arista:eos", + "aruba_aoscx": "hpe:arubaos-cx", "aruba_os": "arubanetworks:arubaos", "cisco_asa": "cisco:adaptive_security_appliance_software", "cisco_ios": "cisco:ios", diff --git a/netutils/nist.py b/netutils/nist.py index a3162805..2fbd8491 100644 --- a/netutils/nist.py +++ b/netutils/nist.py @@ -21,6 +21,11 @@ ("buildmetadata", str, dataclasses.field(default=None)), # pylint: disable=[E3701] ("vendor_metadata", bool, dataclasses.field(default=False)), # pylint: disable=[E3701] ], + "hpe": { + "arubaos-cx": [ + ("release", str, dataclasses.field(default=None)), + ], + }, "juniper": { "junos": [ ("main", str, dataclasses.field(default=None)), # pylint: disable=[E3701] @@ -63,6 +68,18 @@ def __getitem__(self, key: str) -> t.Any: return getattr(self, key) +def _get_nist_urls_hpe_arubaos_cx(os_platform_data: t.Dict[str, t.Any]) -> t.List[str]: + """Create NIST URLs for HPE Aruba AOS-CX.""" + base_url = "https://services.nvd.nist.gov/rest/json/cves/2.0?cpeName=cpe:2.3:o:" + version = ( + f"{os_platform_data['major']}." + f"{os_platform_data['minor']}." + f"{os_platform_data['patch']}" + ) + + return [f"{base_url}{os_platform_data['vendor']}:{os_platform_data['os_type']}:{version}:*"] + + def _get_nist_urls_juniper_junos(os_platform_data: t.Dict[str, t.Any]) -> t.List[str]: # pylint: disable=R0911 """Create a list of possible NIST Url strings for JuniperPlatform. @@ -233,6 +250,9 @@ def _os_platform_object_builder(vendor: str, platform: str, version: str) -> obj get_nist_url_funcs: t.Dict[str, t.Any] = { "default": _get_nist_urls_default, + "hpe": { + "arubaos-cx": _get_nist_urls_hpe_arubaos_cx, + }, "juniper": {"junos": _get_nist_urls_juniper_junos}, } @@ -255,9 +275,10 @@ def get_nist_vendor_platform_urls(vendor: str, platform: str, version: str) -> t >>> """ platform_data = _os_platform_object_builder(vendor, platform, version).__dict__ + get_nist_urls_func = get_nist_url_funcs.get(vendor.lower(), {}).get(platform.lower()) - if vendor.lower() == "juniper" and platform.lower() == "junos": - return _get_nist_urls_juniper_junos(platform_data) + if get_nist_urls_func: + return get_nist_urls_func(platform_data) return _get_nist_urls_default(platform_data)