Skip to content
Snippets Groups Projects
Commit b73f07b9 authored by Nadin El-Yabroudi's avatar Nadin El-Yabroudi
Browse files

Fix xml parser when host is up but not ports are open (#46). Also fix error...

Fix xml parser when host is up but not ports are open (#46). Also fix error when getting description from the cache. The entire vuln description object should be saved in the cache not just the string of the description. Also added all __pycache__ files to gitignore
parent 0240604f
No related branches found
No related tags found
No related merge requests found
__pycache__
...@@ -29,8 +29,9 @@ class CveProjectProvider(VulnDescriptionProvider): ...@@ -29,8 +29,9 @@ class CveProjectProvider(VulnDescriptionProvider):
response.raise_for_status() response.raise_for_status()
cve_json = response.json() cve_json = response.json()
description = cve_json['description']['description_data'][0]['value'] description = cve_json['description']['description_data'][0]['value']
self.cache[vuln] = description vuln_description = VulnDescription(description, self.nist_uri_template.format(vuln))
return VulnDescription(description, self.nist_uri_template.format(vuln)) self.cache[vuln] = vuln_description
return vuln_description
except HTTPError as he: except HTTPError as he:
return VulnDescription('', 'Description fetching error: ' + str(he)) return VulnDescription('', 'Description fetching error: ' + str(he))
......
...@@ -113,7 +113,7 @@ class FlanXmlParser: ...@@ -113,7 +113,7 @@ class FlanXmlParser:
if not ip_addr: if not ip_addr:
return return
if host['status']['@state'] == 'up' and 'port' in host['ports']: if host['status']['@state'] == 'up' and 'ports' in host.keys() and 'port' in host['ports']:
ports = host['ports']['port'] ports = host['ports']['port']
if isinstance(ports, list): if isinstance(ports, list):
for p in ports: for p in ports:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment