Coder Social home page Coder Social logo

openvasreporting's People

Contributors

cr0hn avatar dependabot[bot] avatar dhoetger avatar dudacgf avatar emi420 avatar finsysbml avatar flvernon avatar ididwhat avatar lacapitainerie avatar lgtm-migrator avatar noifp avatar presianbg avatar scrdpg avatar snyk-bot avatar thegroundzero avatar thorfin avatar tothi avatar zeridon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openvasreporting's Issues

Host AttributeError:

This seems to be similar to the error in: #9

I'm running this off xml files generated from OpenVAS. Most of the devices I scanned don't return a hostname, so the error makes sense. As far as I can tell it should just put N/A as the host though, correct? Any help would be appreciated. Thanks!

Error:
File "/var/lib/openvasreporting/openvasreporting/libs/parser.py", line 115, in openvas_parser
vuln_host_name = vuln.find("./host/hostname").text
AttributeError: 'NoneType' object has no attribute 'text'

File:

Parser.py
# VULN_HOST
vuln_host = vuln.find("./host").text
vuln_host_name = vuln.find("./host/hostname").text
if vuln_host_name is None:
vuln_host_name = "N/A"
logging.debug("* hostname:\t{}".format(vuln_host_name)) # DEBUG
vuln_port = vuln.find("./port").text
logging.debug(
"* vuln_host:\t{} port:\t{}".format(vuln_host, vuln_port)) # DEBUG

error when export docx... PermissionError: [WinError 32] The process cannot access the file because it is being used by another process

when exporting "-f docx" returns error:

  File "<base_path_removed>\openvasreporting\libs\export.py", line 545, in export_to_word
    os.remove(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\someuser\\AppData\\Local\\Temp\\tmpbdnxw19g.png'

solution is in libs/export.py to comment out the first "os.remove(path)" in "export_to_word" and add the line "os.close(fd) between the second run_chart... and os.remove(path)...
ie
...
run_chart.add_picture(path, width=Cm(8.0))
# os.remove(path)
...
run_chart.add_picture(path, width=Cm(8.0))
os.close(fd)
os.remove(path)
...

error while generating report

Hi,

I am getting below error while executing the script, can anyone guide please

sudo python3 -m openvasreporting -i openvas.xml -f xlsx

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/yogesh/openvasreporting/openvasreporting/__main__.py", line 19, in <module>
    main()
  File "/home/yogesh/openvasreporting/openvasreporting/openvasreporting.py", line 70, in main
    config = Config(args.input_files, 
  File "/home/yogesh/openvasreporting/openvasreporting/libs/config.py", line 86, in __init__
    raise ValueError("Invalid value for level parameter, \
ValueError: Invalid value for level parameter,                 must be one of: c[ritical], h[igh], m[edium], l[low], n[one]

Errors when generating excel with xmls from GVM11

Due to the fact that openvas had its life cycle at the end, I needed to install GVM11, however the XML is different from openvas 9 and the script you provided does not work with it. Did you have any plans to make the new version available to us?
Note: You did a great job, helped a lot with scripting.
an example of xml generated by gvm11

admin2020-05-29T00:26:38-03:00<creation_time>2020-05-29T00:26:38-03:00</creation_time><modification_time>2020-05-29T00:33:45-03:00</modification_time>0<in_use>0</in_use>Target 171<report_format id="a994b278-1f62-11e1-96ac-406186ea4fc5">XML</report_format>9.0severitydescendingapply_overrides=0 levels=hml rows=1000 min_qod=70 first=1 sort-reverse=severity notes=1 overrides=1HighMediumLowapply_overrides=0levels=hmlrows=1000min_qod=70first=1sort-reverse=severitynotes=1overrides=1<severity_class id="d4c74cda-89e1-11e3-9c29-406186ea4fc5">nist<full_name>NVD Vulnerability Severity Ratings</full_name><severity_range>None0.00.0</severity_range><severity_range>Low0.13.9</severity_range><severity_range>Medium4.06.9</severity_range><severity_range>High7.010.0</severity_range></severity_class><scan_run_status>Done</scan_run_status>1<closed_cves>3</closed_cves>1310<ssl_certs>0</ssl_certs>Target 1710teste1711002020-05-29T00:26:18-03:00<scan_start>2020-05-29T00:26:38-03:00</scan_start>America/Sao_Paulo<timezone_abbrev>-03</timezone_abbrev>3general/tcp172.16.0.1712.6Low445/tcp172.16.0.1719.3High135/tcp172.16.0.1715.0MediumMicrosoft Windows SMB Server Multiple Vulnerabilities-Remote (4013389)admin<modification_time>2020-05-29T00:32:15-03:00</modification_time><creation_time>2020-05-29T00:32:15-03:00</creation_time>172.16.0.171445/tcpnvtMicrosoft Windows SMB Server Multiple Vulnerabilities-Remote (4013389)Windows : Microsoft Bulletins<cvss_base>9.3</cvss_base>cvss_base_vector=AV:N/AC:M/Au:N/C:C/I:C/A:C|summary=This host is missing a critical security
update according to Microsoft Bulletin MS17-010.|insight=Multiple flaws exist due to the way that the
Microsoft Server Message Block 1.0 (SMBv1) server handles certain requests.|affected=- Microsoft Windows 10 x32/x64 Edition

    Microsoft Windows Server 2012 Edition

    Microsoft Windows Server 2016

    Microsoft Windows 8.1 x32/x64 Edition

    Microsoft Windows Server 2012 R2 Edition

    Microsoft Windows 7 x32/x64 Edition Service Pack 1

    Microsoft Windows Vista x32/x64 Edition Service Pack 2

    Microsoft Windows Server 2008 R2 x64 Edition Service Pack 1

    Microsoft Windows Server 2008 x32/x64 Edition Service Pack 2|impact=Successful exploitation will allow remote
    attackers to gain the ability to execute code on the target server, also
    could lead to information disclosure from the server.|solution=The vendor has released updates. Please see the references for more information.|vuldetect=Send the crafted SMB transaction request
    with fid = 0 and check the response to confirm the vulnerability.|solution_type=VendorFix<scan_nvt_version></scan_nvt_version>High9.395<original_threat>High</original_threat><original_severity>9.3</original_severity>DCE/RPC and MSRPC Services Enumeration Reportingadmin<modification_time>2020-05-29T00:31:05-03:00</modification_time><creation_time>2020-05-29T00:31:05-03:00</creation_time>172.16.0.171135/tcpnvtDCE/RPC and MSRPC Services Enumeration ReportingWindows<cvss_base>5.0</cvss_base>cvss_base_vector=AV:N/AC:L/Au:N/C:P/I:N/A:N|summary=Distributed Computing Environment / Remote Procedure Calls (DCE/RPC) or MSRPC services running
    on the remote host can be enumerated by connecting on port 135 and doing the appropriate queries.|insight=|affected=|impact=An attacker may use this fact to gain more knowledge
    about the remote host.|solution=Filter incoming traffic to this ports.|vuldetect=|solution_type=Mitigation<scan_nvt_version></scan_nvt_version>Medium5.080Here is the list of DCE/RPC or MSRPC services running on this host via the TCP protocol:

Port: 49152/tcp

 UUID: d95afe70-a6d5-4259-822e-2c84da1ddb0d, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49152]

Port: 49153/tcp

 UUID: 06bba54a-be05-49f9-b0a0-30f790261023, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49153]
 Annotation: Security Center

 UUID: 30adc50c-5cbc-46ce-9a0e-91914789e23c, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49153]
 Annotation: NRP server endpoint

 UUID: 3c4728c5-f0ab-448b-bda1-6ce01eb0a6d5, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49153]
 Annotation: DHCP Client LRPC Endpoint

 UUID: 3c4728c5-f0ab-448b-bda1-6ce01eb0a6d6, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49153]
 Annotation: DHCPv6 Client LRPC Endpoint

 UUID: f6beaff7-1e19-4fbb-9f8f-b89e2018337c, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49153]
 Annotation: Event log TCPIP

Port: 49154/tcp

 UUID: 552d076a-cb29-4e44-8b6a-d15e59e2c0af, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49154]
 Annotation: IP Transition Configuration endpoint

 UUID: 86d35949-83c9-4044-b424-db363231fd0c, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49154]

 UUID: 98716d03-89ac-44c7-bb8c-285824e51c4a, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49154]
 Annotation: XactSrv service

 UUID: a398e520-d59a-4bdd-aa7a-3c1e0303a511, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49154]
 Annotation: IKE/Authip API

Port: 49155/tcp

 UUID: 12345778-1234-abcd-ef00-0123456789ac, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49155]
 Named pipe : lsass
 Win32 service or process : lsass.exe
 Description : SAM access

Port: 49184/tcp

 UUID: 367abb81-9844-35f1-ad32-98f038001003, version 2
 Endpoint: ncacn_ip_tcp:172.16.0.171[49184]

Port: 49186/tcp

 UUID: 12345678-1234-abcd-ef00-0123456789ab, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49186]
 Annotation: IPSec Policy agent endpoint
 Named pipe : spoolss
 Win32 service or process : spoolsv.exe
 Description : Spooler service

 UUID: 6b5bdd1e-528c-422c-af8c-a4079be4fe48, version 1
 Endpoint: ncacn_ip_tcp:172.16.0.171[49186]
 Annotation: Remote Fw APIs

Note: DCE/RPC or MSRPC services running on this host locally were identified. Reporting this list is not enabled by default due to the possible large size of this list. See the script preferences to enable this reporting.
<original_threat>Medium</original_threat><original_severity>5</original_severity>TCP timestampsadmin<modification_time>2020-05-29T00:28:09-03:00</modification_time><creation_time>2020-05-29T00:28:09-03:00</creation_time>172.16.0.171general/tcpnvtTCP timestampsGeneral<cvss_base>2.6</cvss_base>cvss_base_vector=AV:N/AC:H/Au:N/C:P/I:N/A:N|summary=The remote host implements TCP timestamps and therefore allows to compute
the uptime.|insight=The remote host implements TCP timestamps, as defined by RFC1323.|affected=TCP/IPv4 implementations that implement RFC1323.|impact=A side effect of this feature is that the uptime of the remote
host can sometimes be computed.|solution=To disable TCP timestamps on linux add the line 'net.ipv4.tcp_timestamps = 0' to
/etc/sysctl.conf. Execute 'sysctl -p' to apply the settings at runtime.

To disable TCP timestamps on Windows execute 'netsh int tcp set global timestamps=disabled'

Starting with Windows Server 2008 and Vista, the timestamp can not be completely disabled.

The default behavior of the TCP/IP stack on this Systems is to not use the
Timestamp options when initiating TCP connections, but use them if the TCP peer
that is initiating communication includes them in their synchronize (SYN) segment.

See the references for more information.|vuldetect=Special IP packets are forged and sent with a little delay in between to the
target IP. The responses are searched for a timestamps. If found, the timestamps are reported.|solution_type=Mitigation<scan_nvt_version></scan_nvt_version>Low2.680It was detected that the host implements RFC1323.

The following timestamps were retrieved with a delay of 1 seconds in-between:
Packet 1: 101882
Packet 2: 101991
<original_threat>Low</original_threat><original_severity>2.6</original_severity><result_count>1414300111111011<false_positive>00</false_positive></result_count>9.39.3172.16.0.1712020-05-29T00:26:43-03:002020-05-29T00:32:59-03:00<port_count>2</port_count><result_count>31110<false_positive>0</false_positive></result_count>EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.902782EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11913EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.103549EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.10879OSMicrosoft Windowsnvt1.3.6.1.4.1.25623.1.0.108044DCE/RPC and MSRPC Services EnumerationEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11024Services139,tcp,smbnvt1.3.6.1.4.1.25623.1.0.11011Service detection (1.3.6.1.4.1.25623.1.0.11011)EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.802726traceroute172.17.0.2,172.16.0.171nvt1.3.6.1.4.1.25623.1.0.51662Traceroutecpe:/o:microsoft:windows_7:-:sp1general/tcpnvt1.3.6.1.4.1.25623.1.0.105937EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.902269scanned_with_feedversion202005270936nvt1.3.6.1.4.1.25623.1.0.103739Host Scan EndClosed CVECVE-2006-3439openvasmd1.3.6.1.4.1.25623.1.0.902782Microsoft Windows Server Service Remote Code Execution Vulnerability (921883)10.0EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.902815OSWindows 7 Professional 7601 Service Pack 1nvt1.3.6.1.4.1.25623.1.0.102011SMB NativeLanMantcp_ports135,139,445nvt1.3.6.1.4.1.25623.1.0.900239Check Open TCP PortsEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11367EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11159OS-Detectioncpe:/o:microsoft:windows_7:-:sp1nvt1.3.6.1.4.1.25623.1.0.105937Services445,tcp,cifsnvt1.3.6.1.4.1.25623.1.0.11011Service detection (1.3.6.1.4.1.25623.1.0.11011)scanned_with_feedtypeGreenbone Community Feednvt1.3.6.1.4.1.25623.1.0.103739Host Scan EndEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11880ports135,139,445nvt1.3.6.1.4.1.25623.1.0.900239Check Open TCP PortsEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.15571EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11905EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11903best_os_txtWindows 7 Professional 7601 Service Pack 1nvt1.3.6.1.4.1.25623.1.0.102011;SMB NativeLanManscanned_with_scanner11.0.1nvt1.3.6.1.4.1.25623.1.0.103739Host Scan EndEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.14687EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.10927Closed CVECVE-2009-2526, CVE-2009-2532, CVE-2009-3103openvasmd1.3.6.1.4.1.25623.1.0.900965Microsoft Windows SMB2 Negotiation Protocol Remote Code Execution Vulnerability10.0Closed CVECVE-2010-0020, CVE-2010-0021, CVE-2010-0022, CVE-2010-0231openvasmd1.3.6.1.4.1.25623.1.0.902269Microsoft Windows SMB Server NTLM Multiple Vulnerabilities (971468)10.0Services135,tcp,epmap,A DCE endpoint resolution service seems to be running on this port.nvt1.3.6.1.4.1.25623.1.0.108044DCE/RPC and MSRPC Services EnumerationEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11901OScpe:/o:microsoft:windowsnvt1.3.6.1.4.1.25623.1.0.108044DCE/RPC and MSRPC Services EnumerationEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.900965hostname_determination172.16.0.171,172.16.0.171,IP-addressnvt1.3.6.1.4.1.25623.1.0.108449Hostname Determination ReportingEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.103674OScpe:/o:microsoft:windows_7:-:sp1nvt1.3.6.1.4.1.25623.1.0.102011SMB NativeLanManbest_os_cpecpe:/o:microsoft:windows_7:-:sp1nvt1.3.6.1.4.1.25623.1.0.102011;SMB NativeLanManEXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.10832EXIT_CODEEXIT_NOTVULNnvt1.3.6.1.4.1.25623.1.0.11881<scan_end>2020-05-29T00:33:45-03:00</scan_end>0<report_format></report_format>

Host AttributeError

This seems to be similar to the error in: #9

I'm running this off xml files generated from OpenVAS. Most of the devices I scanned don't return a hostname, so the error makes sense. As far as I can tell it should just put N/A as the host though, correct? I used the old version a couple of years with no issue, the only change is that we are running in docker now. This is on Version 7.0.3. Thanks!!

Error:
File "/var/lib/openvasreporting/openvasreporting/libs/parser.py", line 115, in openvas_parser
vuln_host_name = vuln.find("./host/hostname").text
AttributeError: 'NoneType' object has no attribute 'text'

File:

Parser.py
# VULN_HOST
vuln_host = vuln.find("./host").text
vuln_host_name = vuln.find("./host/hostname").text
if vuln_host_name is None:
vuln_host_name = "N/A"
logging.debug("* hostname:\t{}".format(vuln_host_name)) # DEBUG
vuln_port = vuln.find("./port").text
logging.debug(
"* vuln_host:\t{} port:\t{}".format(vuln_host, vuln_port)) # DEBUG

How to edit the docx template

Hi,

First of all, many thanks for this project, it comes sooo handy and time saving !!

One question though, how can I edit the included template ? when I open it on libreoffice on linux or in google drive I get a blank empty file.

wrong ip adresses in my reports

i get wrong IPs in my reports, in the 127.0.0.X range

example:

127.0.0.8 - 443 tcp
127.0.0.8 - 80 tcp
127.0.0.1 - 443 tcp
127.0.0.2 - 443 tcp

not well-formed (invalid token)

Good afternoon,

I stumbled on the following error, not sure what's causing it:

kali:~/Downloads/openvasreporting$ python3 -m openvasreporting -i report.xml -f xlsx Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/user/Downloads/openvasreporting/openvasreporting/__main__.py", line 17, in <module> main() File "/home/user/Downloads/openvasreporting/openvasreporting/openvasreporting.py", line 33, in main convert(config) File "/home/user/Downloads/openvasreporting/openvasreporting/openvasreporting.py", line 87, in convert openvas_info = openvas_parser(config.input_files, config.min_level) File "/home/user/Downloads/openvasreporting/openvasreporting/libs/parser.py", line 58, in openvas_parser root = Et.parse(f_file).getroot() File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1197, in parse tree.parse(source, parser) File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 598, in parse self._root = parser._parse_whole(source) xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 35, column 1349

I looked in my xml-report, but on line 35 column 1349 is an "n". Any clue?

Report came from GVM virtual appliance running Greenbone OS 6.0.0. Played around with utf-8 and BOM, but that didn't help.

Cheers and thanks,

David

AttributeError errors when running

Running into issues, I am seeing the following error when running

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/openvasreporting/openvasreporting/__main__.py", line 17, in <module>
    main()
  File "/home/user/openvasreporting/openvasreporting/openvasreporting.py", line 33, in main
    convert(config)
  File "/home/user/openvasreporting/openvasreporting/openvasreporting.py", line 87, in convert
    openvas_info = openvas_parser(config.input_files, config.min_level)
  File "/home/user/openvasreporting/openvasreporting/libs/parser.py", line 150, in openvas_parser
    vuln_cves = nvt_tmp.find("./cve").text
AttributeError: 'NoneType' object has no attribute 'text'

I am using the current version of the reporting tool. The XML was generated using Greenbone Security Manager version 6.0.0

Empty table of contents on docx report

Hi,

I was creating a report and noticed that the table of contents in the generated document appears empty, update index does not regenerate it. This is on libreoffice.

Unique hosts on Affected Hosts on Vulnerability Summary

Hello and thank you for the work done here.

I was trying to figure out how to change the "Total" column on "Affected Hosts" to show only the number of unique real hosts across all the Treat Levels instead of the sum of the Threat Levels.

I see a similar request was asked but I didn't find the option/code to change this value, so a few hours facing this problem with no solution for me, the last bullet I have its asking here so maybe anyone can help me.

Kind regards!

"--template openvasreporting/src/openvas-template.docx" is forced regardless of "--format xlsx" argument

Using --format xlsx returns this error:

Traceback (most recent call last):
  File "./server.py", line 78, in <module>
    main()
  File "./server.py", line 33, in main
    setup_socket(args.ip, args.port, args.format)
  File "./server.py", line 62, in setup_socket
    openvasreporting.convert(config)
  File "/usr/local/lib/python3.7/site-packages/openvasreporting/openvasreporting.py", line 88, in convert
    exporters()[config.filetype](openvas_info, config.template, config.output_file)
  File "/usr/local/lib/python3.7/site-packages/openvasreporting/libs/export.py", line 59, in export_to_excel
    raise NotImplementedError("Use of template is not supported in XSLX-output.")
NotImplementedError: Use of template is not supported in XSLX-output.

Not sure how to fix this one. Maybe a separate convert_docx function if you want docx format?

Cannot Generate XLSX reports

Hi I read that the pip version was not working so I cloned the git repo.
I am using Greenbone Security Manager - Greenbone OS 6.0.7

When trying to generate the report for the multiple XML files (generated them as XML not Anonymous XML). I get the following:

└──╼ $sudo python3 -m openvasreporting XML-Files/* -f xlsx
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/marduk/openvasreporting/openvasreporting/__main__.py", line 6, in <module>
    from openvasreporting.openvasreporting import main
  File "/home/marduk/openvasreporting/openvasreporting/openvasreporting.py", line 10, in <module>
    from .libs.parser import openvas_parser
  File "/home/marduk/openvasreporting/openvasreporting/libs/parser.py", line 164
    else:
        ^
IndentationError: unindent does not match any outer indentation level

Same thing happens if I run it without sudo.
I am not sure how to fix it.

Docx Template spacing issue

Using the OV-Default style, it seems to have the correct spacing as seen here in a sample report
image

However further down the report, it seems to add spaces. Is this due to how the XML is being parsed?

image

Having a look at the XML, there are no rogue spaces there as part of the export. Wondering if it is a word thing? Opened in Libre and Word, same result.

image

NotImplementedError("Use of template is not supported in XSLX-output.") even though --template is not provided

Hello,

I am encountering the following problem.

Command: python3 -m openvasreporting --input *.xml --format xlsx --output report.xlsx

Error: Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/__main__.py", line 17, in <module> main() File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/openvasreporting.py", line 32, in main convert(config) File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/openvasreporting.py", line 88, in convert exporters()[config.filetype](openvas_info, config.template, config.output_file) File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/libs/export.py", line 60, in export_to_excel raise NotImplementedError("Use of template is not supported in XSLX-output.") NotImplementedError: Use of template is not supported in XSLX-output.

Replacing the following line with print("1") or sleep 1 is my current workaround ^^

raise NotImplementedError("Use of template is not supported in XSLX-output.")

This check should clearly not result in 'True' because neither '-t' or '--template' are passed to openvasreporting.

if template is not None:

I have installed openvasreporting via pip:
pip3 install OpenVAS-Reporting

My current version is 1.4.3:
pip3 freeze | grep OpenVAS OpenVAS-Reporting==1.4.3

Am I doing something wrong, because looking at the code 'template' is set to 'None' per default everywhere?

Pip installed version doesn't work

If you install openvasreporting through pip (pip3 install OpenVAS-Reporting) and then attempt to use the tool (openvasreporting -i <xml files> -o <output file>) you get an error:

Traceback (most recent call last):
  File "/usr/local/bin/openvasreporting", line 6, in <module>
    from openvasreporting import main
ImportError: cannot import name 'main' from 'openvasreporting' (/usr/local/lib/python3.7/dist-packages/openvasreporting/__init__.py)

Tested on Kali Linux and Ubuntu

$ python3 --version
Python 3.7.4
$ pip3 --version
pip 19.2.1 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)
$ which openvasreporting 
/usr/local/bin/openvasreporting

Current resolution is to "run from source" by downloading the repo and running from there.

git clone https://github.com/TheGroundZero/openvasreporting.git
cd openvasreporting
python3 -m openvasreporting -i <xml files> -o <output file>

Preferred solution is one in which both methods (from source, using pip) work.

ImportError: attempted relative import with no known parent package

Hello,
I am running Greenbone Security Assistant : Version 7.0.3.
Latest version of openvasreporting.
When running the following command : python3 openvasreporting.py -i openvasreport.xml -f xlsx
I get :
Traceback (most recent call last):
File "openvasreporting.py", line 9, in
from .libs.config import Config
ImportError: attempted relative import with no known parent package

Any idea?
Thanks,
Klaas

Dependency to pyyaml missing

Describe the bug
When building and installing the package it doesn't install the required module pyyaml.

Application usage
Building and installing

From repo

Application version
1.5.post3-py3-none-any

Python version

python --version 3.10.2
python -m pip --version 22.0.4

Command + output
What's the command you're trying to run and what's the output?

openvasreporting
Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python310\Scripts\openvasreporting.exe\__main__.py", line 4, in <module>
  File "C:\Python310\lib\site-packages\openvasreporting\__init__.py", line 37, in <module>
    from .openvasreporting import main, convert
  File "C:\Python310\lib\site-packages\openvasreporting\openvasreporting.py", line 9, in <module>
    from .libs.config import Config, Config_YAML
  File "C:\Python310\lib\site-packages\openvasreporting\libs\config.py", line 13, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'
...

Expected behavior
Output should be
usage: openvasreporting [-h] -i [INPUT_FILES ...] [-o OUTPUT_FILE] [-c CONFIG_FILE] [-l {c,h,m,l,n}]
[-f {xlsx,docx,csv}] [-t TEMPLATE] [-T {h,host,v,vulnerability}]
[-n NETWORKS_INCLUDED] [-N NETWORKS_EXCLUDED] [-r REGEX_INCLUDED]

[BUG]

Describe the bug
I am using the Pip Module on Release: 2024.1. The report contains IP addresses as 127.0.0.x and no the exact IP addresses.

Application usage
How are you using the application?
OpenVAS-Reporting-1.5.2

From repo / pip package / ...

Application version
The version/release you're working with.

vX.X.X

Python version
Version of your Python and Pip install

python3 --version
Python 3.11.8
python3 -m pip --version
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.11)

Command + output
What's the command you're trying to run and what's the output?

openvasreporting -i 3.xml -o openvasreport3 -f xlsx

I dont get the correct IP addresses

...

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.
This could be screenshots, the XML of your report, ...

Reporting does not work with GVM21

Hello @TheGroundZero

since we updated our GVM to Version 21.4.5 the openvasreporting tool does not work anymore giving us this error message:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/gvmreport/openvasreporting/openvasreporting/__main__.py", line 19, in <module>
    main()
  File "/home/gvmreport/openvasreporting/openvasreporting/openvasreporting.py", line 83, in main
    convert(config)
  File "/home/gvmreport/openvasreporting/openvasreporting/openvasreporting.py", line 102, in convert
    openvas_info = parsers()[config.report_type](config)
  File "/home/gvmreport/openvasreporting/openvasreporting/libs/parser.py", line 62, in openvas_parser_by_vuln
    raise IOError("Invalid report format")
OSError: Invalid report format

There might have been a change in xml parsing in newer version.

no dns name in report

Hi,
in the generated reports are no dns name to ip address assigned.
If I generate a pdf file, it is. The data source for creating reports is the same (xml) for every kind of report in openvas, isn't it?
How is it possible to print out corresponding dns names to addresses in xsl sheets?
Attached you can find an example (pdf and xls, both with the same system 172.31.71.100)

Thx.
pdf-ip-has-dnsname
xls_ip_nas_no_dnsname

python issue

Hi , I tried to work this tool on Ubuntu , kali and centos7. This code is not working on every OS. Are you sure is it working ?

[BUG] Loss of information when creating a report

Hi, in my case, when generating a report, I lose a record with 541 ports.

I have the following scan results:
Снимок экрана 2024-02-05 183828

This information is in the xml file:
Снимок экрана 2024-02-05 184419

And in the generated report, I see only 1 entry
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.