diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f6f9a9d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/ +venv/ +__pycache__/ diff --git a/py-list-vulnerabilities/list-vulnerabilities.py b/py-list-vulnerabilities/list-vulnerabilities.py index d3f7e4c..e3bb713 100755 --- a/py-list-vulnerabilities/list-vulnerabilities.py +++ b/py-list-vulnerabilities/list-vulnerabilities.py @@ -207,10 +207,6 @@ def main(): f'{name:{15}} {vector:{6}} {severity:{10}} {cve}' ) - # Only asking for one scan doesn't mean that the iterator won't happily - # ask for the next one, so stop the loop here. - break - if __name__ == '__main__': main() diff --git a/py-list-vulnerabilities/smartcheck.py b/py-list-vulnerabilities/smartcheck.py index 6c73fde..cdcff65 100644 --- a/py-list-vulnerabilities/smartcheck.py +++ b/py-list-vulnerabilities/smartcheck.py @@ -190,7 +190,13 @@ def _list(self, url, exception_kind, key, **kwargs): # We use the link in the `Link: rel='next'` header as it's easier # than building a URL based on the cursor in the body. If there is # no header then there's no more data. - if not 'next' in response.links: + if kwargs.get('params'): + limit = kwargs['params']['limit'] + + if limit == 1: + break + + if 'next' not in response.links: break # Extract the URL from the `Link: rel='next'` header.