diff --git a/openwebvulndb/common/cve.py b/openwebvulndb/common/cve.py index 6044d77..be2ee29 100644 --- a/openwebvulndb/common/cve.py +++ b/openwebvulndb/common/cve.py @@ -63,7 +63,7 @@ def load_mapping(self, *args, **kwargs): def read_file(self, file_name): with open(file_name, "r") as fp: data = json.load(fp) - for entry in data: + for entry in data.get('results'): self.read_one(entry) async def read_api(self, url): @@ -74,7 +74,7 @@ async def read_api(self, url): async def read_one_from_api(self, cve_id): try: - url = "https://cve.circl.lu/api/cve/" + cve_id + url = "https://cvepremium.circl.lu/api/cve/" + cve_id async with self.session.get(url) as response: entry = await response.json() if entry is None: diff --git a/openwebvulndb/common/parallel.py b/openwebvulndb/common/parallel.py index bc449ac..b370d75 100644 --- a/openwebvulndb/common/parallel.py +++ b/openwebvulndb/common/parallel.py @@ -44,7 +44,7 @@ async def consume(self, n): if self.timeout_per_job is not None: task = self.loop.create_task(coroutine(*args, **kwargs)) try: - with async_timeout.timeout(timeout=self.timeout_per_job): + with async_timeout.timeout(self.timeout_per_job): await task except asyncio.TimeoutError: logger.warn("Job timed out in %s: %s, %s", self.name, args, kwargs) diff --git a/openwebvulndb/wordpress/__main__.py b/openwebvulndb/wordpress/__main__.py index 7deed82..be768dc 100644 --- a/openwebvulndb/wordpress/__main__.py +++ b/openwebvulndb/wordpress/__main__.py @@ -126,7 +126,7 @@ def load_cve(loop, cve_reader, input_file): if input_file: cve_reader.read_file(input_file) else: - loop.run_until_complete(cve_reader.read_api("http://cve.circl.lu/api/search/wordpress/wordpress")) + loop.run_until_complete(cve_reader.read_api("http://cvepremium.circl.lu/api/search/wordpress/wordpress")) def change_version_format(storage): diff --git a/tests/common_test/cve_reader_test.py b/tests/common_test/cve_reader_test.py index b1711ab..4e0f8f8 100644 --- a/tests/common_test/cve_reader_test.py +++ b/tests/common_test/cve_reader_test.py @@ -536,7 +536,7 @@ async def test_read_one_from_api(self): await self.reader.read_one_from_api(entry.id) - self.reader.session.get.assert_called_once_with("https://cve.circl.lu/api/cve/" + entry.id) + self.reader.session.get.assert_called_once_with("https://cvepremium.circl.lu/api/cve/" + entry.id) # Make sure the cve entry has been converted to the usual format for the vulnerable configuration. self.reader.read_one.assert_called_once_with( {"id": "CVE-2017-1234", "cvss": 4.3,