-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from networktocode/develop
Merge 1.9.0 into main
- Loading branch information
Showing
22 changed files
with
845 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# v1.9 Release Notes | ||
|
||
## Release Overview | ||
|
||
- Added NIST URL creation and platform mapper. | ||
- Added DNA Center platform mappings. | ||
- Improved error message when duplicate line is parsed. | ||
|
||
## [v1.9.0] 2024-07 | ||
|
||
### Added | ||
|
||
- [489](https://github.com/networktocode/netutils/pull/489) Added NIST URL creation and platform mapper. | ||
- [519](https://github.com/networktocode/netutils/pull/519) Added DNA Center forward and reverse platform mappings. | ||
|
||
### Changed | ||
|
||
- [539](https://github.com/networktocode/netutils/pull/539) Provide more descriptive error message when duplicate line is parsed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# NIST URLs | ||
|
||
::: netutils.nist | ||
options: | ||
show_submodules: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
| DNA_CENTER | | NORMALIZED | | ||
| ---------- | -- | ------ | | ||
| IOS | → | cisco_ios | | ||
| IOS-XE | → | cisco_ios | | ||
| IOS-XR | → | cisco_xr | | ||
| NX-OS | → | cisco_nxos | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
| NORMALIZED | | DNA_CENTER | | ||
| ---------- | -- | ------ | | ||
| cisco_ios | → | IOS | | ||
| cisco_nxos | → | NX-OS | | ||
| cisco_xr | → | IOS-XR | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
| NIST | | NORMALIZED | | ||
| ---------- | -- | ------ | | ||
| adaptive_security_appliance_software | → | cisco_asa | | ||
| eos | → | arista_eos | | ||
| ios | → | cisco_ios | | ||
| ios_xe | → | cisco_xe | | ||
| ios_xr | → | cisco_xr | | ||
| junos | → | juniper_junos | | ||
| nx-os | → | cisco_nxos | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
| NORMALIZED | | NIST | | ||
| ---------- | -- | ------ | | ||
| arista_eos | → | eos | | ||
| cisco_asa | → | adaptive_security_appliance_software | | ||
| cisco_ios | → | ios | | ||
| cisco_nxos | → | nx-os | | ||
| cisco_xe | → | ios_xe | | ||
| cisco_xr | → | ios_xr | | ||
| juniper_junos | → | junos | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# NIST | ||
|
||
The NIST utility is used for functionality based around NIST DB Queries, and is primarily used to create URLs for the API based queries. | ||
|
||
## Requirements | ||
|
||
In order to use the URLs generated by `netutils.nist.get_nist_urls*`, you will need an api key provided by NIST [here]('https://nvd.nist.gov/developers/request-an-api-key'). This key will need to be passed in as an additional header in your request in the form of `{"apiKey": "<key_value>"}` as stated by NIST in their [Getting Started]('https://nvd.nist.gov/developers/start-here') section. | ||
|
||
|
||
## Custom URLs | ||
|
||
The largest caveat in this functionality is the consistency of the URL values needed to obtain the CVE information. NIST NVD has specific parameters that can be used for standardization, however this does not mean that entries are standardized. Manually combing through a large amount of CPE Vendor submissions has shown that there are variations in how CPE Vendor data is presented. | ||
|
||
For this reason, for certain Vendor/OS combinations, a custom URL needs to be built. | ||
- **Cisco IOS CPE String** - `cpe:2.3:o:cisco:ios:15.5\\(2\\)s1c:*` | ||
- `15.5\\(2\\)s1c:*` - As seen here, Cisco uses CPE strings that do not include the `:` delimiter, which can be queried using escape characters in the search string. **This is the format of ALL "generic" OS/Other platforms that do not have their own custom NIST URL builder when querying NIST.** | ||
- Default URL Output - `'https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:o:cisco:ios:15.5\\(2\\)s1c:*'` | ||
|
||
- **Juniper JunOS CPE String** - `cpe:2.3:o:juniper:junos:10.2:r2:*:*:*:*:*:*` | ||
- `10.2:r2:*:*:*:*:*:*` - As noted here, one of the provided URLs to query for this Juniper JunOS OS platform includes additional values that follow NIST delimiter structures. In the case where the parser provides multiple URLs, they will both be evaluated and the CVE from both will be added and associated. | ||
- Custom URL Output - `['https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:o:juniper:junos:10.2r2:*:*:*:*:*:*:*', 'https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:o:juniper:junos:10.2:r2:*:*:*:*:*:*']` | ||
|
||
|
||
## Examples | ||
Here are a few examples showing how to use this in your python code. | ||
|
||
```python | ||
|
||
from netutils.nist import get_nist_urls | ||
|
||
# Get NIST URL for the Cisco IOS object | ||
get_nist_urls("cisco_ios", "15.5(2)S1c") | ||
# ['https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:o:cisco:ios:15.5\\(2\\)s1c:*'] | ||
|
||
# Get NIST URL(s) for the Juniper JunOS object | ||
get_nist_urls("juniper_junos", "10.2R2.11") | ||
# ['https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:o:juniper:junos:10.2r2:*:*:*:*:*:*:*', 'https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=cpe:2.3:o:juniper:junos:10.2:r2:*:*:*:*:*:*'] | ||
``` | ||
|
||
Currently known OS/Other Platform types that require a custom NIST URL: | ||
|
||
- Juniper JunOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# OS Version Tools | ||
|
||
The OS Version Tools are used for working with versioning systems. | ||
|
||
## Version Parsing/Deconstruction | ||
Version parsing takes the software version given as a string, and deconstructs that value into the standards of the vendor. The version parsing takes place in the `netutils.os_version` module. This is necessary when specific values or flags from a software version are required to make a logical decision. | ||
|
||
Current Version Parsers: | ||
|
||
- Default Parser | ||
- Juniper JunOS | ||
|
||
**See the following Default and Juniper JunOS parsed versions:** | ||
|
||
```python | ||
>>> from netutils.os_version import version_metadata | ||
|
||
>>> version_metadata("Cisco", "IOS", "15.5") | ||
{ | ||
"major": "15", | ||
"minor": "5", | ||
"vendor_metadata": False, | ||
} | ||
>>> version_metadata("juniper", "junos", "12.4R") | ||
{ | ||
"isservice": False, | ||
"ismaintenance": False, | ||
"isfrs": True, | ||
"isspecial": False, | ||
"service": None, | ||
"service_build": None, | ||
"service_respin": None, | ||
"main": "12", | ||
"minor": "4", | ||
"type": "R", | ||
"build": None, | ||
"major": "12", | ||
"patch": None, | ||
"vendor_metadata": True, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.