SabyasachiRana / WebMap

WebMap-Nmap Web Dashboard and Reporting
GNU General Public License v3.0
965 stars 267 forks source link

KeyError for cveobj['references'] in cve.py #23

Open BlaiseDee opened 2 years ago

BlaiseDee commented 2 years ago

First things first, Awesome piece of software! it helps me a lot and saves me a lot of time, as long as it works fully as expected, but does not.

File:

root@webmap:/opt/nmapdashboard/nmapreport/nmap# cat cve.py
...
line 80: r.=.requests.get('http://cve.circl.lu/api/cvefor/'+cpestr)t()
...

there is 2x API reference, unfortunately "cvefor" doesn't work, as below

blaise@dev:~/app$ curl -k -X 'GET'   'https://cve.circl.lu/api/cvefor/cpe%3A2.3%3Ao%3Amicrosoft%3Awindows_11%3A-%3A*%3A*%3A*%3A*%3A*%3Ax64%3A*?limit=20'   -H 'accept: application/json'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache Server at cve.circl.lu Port 443</address>
</body></html>

I launched the whole project (cve search docker) locally, changed the addresses to my own (localhost)

and now the "CHECK FOR CVE AND EXPLOITS" function works, at the bottom of the page you can see: (222 CVE FOUND) but when I click to enable preview, I get an error from django:


KeyError at /report/192.168.16.147/
'references'
...

                elif type(i) is dict:
                    listcve = [i]
                    #cveout += 'dict<hr>'
                #continue
                for cveobj in listcve:
                    cverefout = ''
                    for cveref in cveobj['references']: …
                        cverefout += '<a href="'+cveref+'">'+cveref+'</a><br>'
                    cveexdbout = ''
                    if 'exploit-db' in cveobj:
                        cveexdbout = '<br><div class="small" style="line-height:20px;"><b>Exploit DB:</b><br>'
                        for cveexdb in cveobj['exploit-db']:

'references' contains a list of urls

webmap