Skip to content

Commit

Permalink
0.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
vehemont committed Jul 19, 2022
1 parent 0128354 commit 3fb92c1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
Release History
===============
0.5.8 (2022-07-19)
-------------------
**Bugfixes**

- Update get.py and cve.py by @GamehunterKaan in https://github.com/vehemont/nvdlib/pull/5
- Removed exit() function that causes the program to abort. Modules shouldn't exit.
- Updated cve.py `searchCVE` doc string to include the `cweId` parameter.

**Improvements**

- Updated cve.py to include the `sortPublished` parameter that is supposed to sort a CVE collection by published date, rather than the default modified date. In my testing, I have not been able to get this parameter working as expected, and I receive no changes in response with or without the `sortOrder=publishedDate` parameter.
I have decided to include the parameter since it is a valid API parameter. The NVD developer guide (https://nvd.nist.gov/developers/vulnerabilities) recommends to use this parameter to prevent missing CVEs when searching for large amounts of CVEs.

0.5.7 (2022-05-18)
-------------------
Expand Down
16 changes: 16 additions & 0 deletions nvdlib/cve.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def searchCVE(
cpeName=False,
cpe_dict=False,
cweId=False,
sortPublished=False,
limit=False,
key=False,
verbose=False):
Expand Down Expand Up @@ -130,6 +131,13 @@ def searchCVE(
find vulnerabilities having those score metrics. Partial vector strings are supported.
:type cvssV2Metrics: str
:param cweId: -- Filter collection by CWE (Common Weakness Enumeration) ID. You can find a list at https://cwe.mitre.org/. A CVE can have multiple CWE IDs assigned to it.
:type cweId: str
:param sortPublished: -- Setting this parameter to true should sort the CVE collection by most recently published instead of the default of most recently modified.
**Warning**: YMMV. I have not been able to get this parameter to work as I expect. The NVD developer guide states to use this parameter when searching for large amounts of CVEs.
:type sortPublished: bool True
:param cpeMatchString: -- Use cpeMatchString when you want a broader search against the applicability statements attached to the Vulnerabilities
(e.x. find all vulnerabilities attached to a specific product).
:type cpeMatchString: str
Expand Down Expand Up @@ -168,6 +176,7 @@ def __buildCVECall(
cpeName,
cpe_dict,
cweId,
sortPublished,
limit,
key):

Expand Down Expand Up @@ -259,6 +268,12 @@ def __buildCVECall(
if cweId:
parameters['cweId'] = cweId

if sortPublished:
if sortPublished == True:
parameters['sortOrder'] = 'publishedDate'
else:
raise TypeError("sortPublished parameter can only be boolean True.")

if limit:
if limit > 2000 or limit < 1:
raise ValueError('Limit parameter must be between 1 and 2000')
Expand All @@ -284,6 +299,7 @@ def __buildCVECall(
cpeName,
cpe_dict,
cweId,
sortPublished,
limit,
key)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setup(
name='nvdlib',
packages=find_packages(include=['nvdlib']),
version='0.5.7',
version='0.5.8',
install_requires = ['requests'],
extras_require={
"dev": [
Expand Down

0 comments on commit 3fb92c1

Please sign in to comment.