DefectDojo / django-DefectDojo

DevSecOps, ASPM, Vulnerability Management. All on one platform.
https://defectdojo.com
BSD 3-Clause "New" or "Revised" License
3.62k stars 1.52k forks source link

OpenVas Import "An error has occurred in the parser, please see error log for details." #3376

Closed CyberAbwehr closed 3 years ago

CyberAbwehr commented 3 years ago

Bug description I want to import Openvas CVE Result Reports and I got following Error

An error has occurred in the parser, please see error log for details.

Steps to reproduce

Expected behavior That there is no error importing OpenVas CVE Reports

Deployment method (select with an X)

Environment information

NAME="Ubuntu" VERSION="20.04.1 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.1 LTS" VERSION_ID="20.04"

OpenVas

gsad --version Oops, secure memory pool already initialized Greenbone Security Assistant 20.08.0

gvmd --version

Greenbone Vulnerability Manager 20.08.0 Manager DB revision 233 Copyright (C) 2010-2020 Greenbone Networks GmbH License: AGPL-3.0-or-later

ospd-openvas --version

OSP Server for openvas: 20.8.0 OSP: 1.2 OSPd OpenVAS: 20.8.1 Copyright (C) 2014-2020 Greenbone Networks GmbH License GPLv2+: GNU GPL version 2 or later

openvas --version

OpenVAS 20.8.0 gvm-libs 20.8.0 Most new code since 2005: (C) 2020 Greenbone Networks GmbH Nessus origin: (C) 2004 Renaud Deraison deraison@nessus.org License GPLv2: GNU GPL version 2

DefectDojo

Version 1.10.1

Sample scan files (optional) report-6d0cb9ca-364b-46a7-9993-9360e7a34c1b.csv.zip

Screenshots (optional) Bildschirmfoto 2020-11-30 um 16 48 55

Console logs (optional)

[30/Nov/2020 15:45:29] ERROR [dojo:680] syntax error: line 1, column 0

Traceback (most recent call last):

File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1624, in feed

self.parser.Parse(data, 0)

xml.parsers.expat.ExpatError: syntax error: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "./dojo/test/views.py", line 671, in re_import_scan_results

parser = import_parser_factory(file, test, active, verified)

File "./dojo/tools/factory.py", line 228, in import_parser_factory

parser = OpenscapXMLParser(file, test)

File "./dojo/tools/openscap/parser.py", line 18, in init

tree = ET.parse(file)

File "/usr/local/lib/python3.6/site-packages/defusedxml/common.py", line 105, in parse

return _parse(source, parser)

File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1196, in parse

tree.parse(source, parser)

File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 603, in parse

parser.feed(data)

File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1626, in feed

self._raiseerror(v)

File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1525, in _raiseerror

raise err

File "", line None

xml.etree.ElementTree.ParseError: syntax error: line 1, column 0

[30/Nov/2020 15:45:29] ERROR [dojo:681] Error in parser: syntax error: line 1, column 0

[pid: 36|app: 0|req: 255/471] 10.1.1.3 () {50 vars in 1897 bytes} [Mon Nov 30 15:45:29 2020] POST /test/1/re_import_scan_results => generated 0 bytes in 14 msecs (HTTP/1.1 302) 8 headers in 465 bytes (1 switches on core 0)

[pid: 1|app: 0|req: 217/472] 10.1.1.3 () {46 vars in 1896 bytes} [Mon Nov 30 15:45:29 2020] GET /test/1/re_import_scan_results => generated 52151 bytes in 30 msecs (HTTP/1.1 200) 8 headers in 467 bytes (1 switches on core 0)

[pid: 36|app: 0|req: 256/473] 10.1.1.3 () {44 vars in 1569 bytes} [Mon Nov 30 15:45:39 2020] GET /alerts/count => generated 12 bytes in 7 msecs (HTTP/1.1 200) 6 headers in 180 bytes (1 switches on core 1)

Additional context (optional)

Regards Alexander

valentijnscholten commented 3 years ago

The screenshots shows you are (re)importing an OpenScap report? That parsers expects a XML report not a CSV report. OpenVAS is a different parser, so you should import that as openvas report.

CyberAbwehr commented 3 years ago

I am so sorry it was my fault.

It works perfect. ;-)

Thanks for your support.