mirror of
https://github.com/cve-search/PyVulnerabilityLookup.git
synced 2024-11-26 00:37:22 +00:00
Updated somen endpoints path
This commit is contained in:
parent
51bcb96d61
commit
04c176f6c8
1 changed files with 10 additions and 10 deletions
|
@ -62,19 +62,19 @@ class PyVulnerabilityLookup():
|
|||
|
||||
def redis_up(self) -> bool:
|
||||
'''Check if redis is up and running'''
|
||||
r = self.session.get(urljoin(self.root_url, 'redis_up'))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'system','redis_up'))))
|
||||
return r.json()
|
||||
|
||||
# #### DB status ####
|
||||
|
||||
def get_info(self) -> dict[str, Any]:
|
||||
'''Get more information about the current databases in use and when it was updated'''
|
||||
r = self.session.get(urljoin(self.root_url, 'info'))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'system','dbInfo'))))
|
||||
return r.json()
|
||||
|
||||
def get_config_info(self) -> dict[str, Any]:
|
||||
'''Get more information about the current databases in use and when it was updated'''
|
||||
r = self.session.get(urljoin(self.root_url, 'configInfo'))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'system', 'configInfo'))))
|
||||
return r.json()
|
||||
|
||||
# #### Vulnerabilities ####
|
||||
|
@ -84,7 +84,7 @@ class PyVulnerabilityLookup():
|
|||
|
||||
:param vulnerability_id: The ID of the vulnerability to get (can be from any source, as long as it is a valid ID)
|
||||
'''
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('vulnerability', vulnerability_id))))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability', vulnerability_id))))
|
||||
return r.json()
|
||||
|
||||
def create_vulnerability(self, vulnerability: dict[str, Any]) -> dict[str, Any]:
|
||||
|
@ -92,7 +92,7 @@ class PyVulnerabilityLookup():
|
|||
|
||||
:param vulnerability: The vulnerability
|
||||
'''
|
||||
r = self.session.post(urljoin(self.root_url, str(PurePosixPath('vulnerability'))),
|
||||
r = self.session.post(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability'))),
|
||||
json=vulnerability)
|
||||
return r.json()
|
||||
|
||||
|
@ -101,7 +101,7 @@ class PyVulnerabilityLookup():
|
|||
|
||||
:param vulnerability_id: The vulnerability ID
|
||||
'''
|
||||
r = self.session.delete(urljoin(self.root_url, str(PurePosixPath('vulnerability', vulnerability_id))))
|
||||
r = self.session.delete(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability', vulnerability_id))))
|
||||
return r.status_code
|
||||
|
||||
def get_last(self, number: int | None=None, source: str | None = None) -> list[dict[str, Any]]:
|
||||
|
@ -115,12 +115,12 @@ class PyVulnerabilityLookup():
|
|||
path /= source
|
||||
if number is not None:
|
||||
path /= str(number)
|
||||
r = self.session.get(urljoin(self.root_url, str(path)))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability', 'last'))))
|
||||
return r.json()
|
||||
|
||||
def get_vendors(self) -> list[str]:
|
||||
'''Get the known vendors'''
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'browse'))))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability', 'browse'))))
|
||||
return r.json()
|
||||
|
||||
def get_vendor_products(self, vendor: str) -> list[str]:
|
||||
|
@ -128,7 +128,7 @@ class PyVulnerabilityLookup():
|
|||
|
||||
:params vendor: A vendor owning products (must be in the known vendor list)
|
||||
'''
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'browse', vendor))))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability', 'browse', vendor))))
|
||||
return r.json()
|
||||
|
||||
def get_vendor_product_vulnerabilities(self, vendor: str, product: str) -> list[str]:
|
||||
|
@ -137,7 +137,7 @@ class PyVulnerabilityLookup():
|
|||
:param vendor: A vendor owning products (must be in the known vendor list)
|
||||
:param product: A product owned by that vendor
|
||||
'''
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'search', vendor, product))))
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'vulnerability', 'browse', vendor, product))))
|
||||
return r.json()
|
||||
|
||||
# #### Comments ####
|
||||
|
|
Loading…
Reference in a new issue