TheGroundZero / openvasreporting

OpenVAS Reporting: Convert OpenVAS XML report files to reports
Other
131 stars 45 forks source link

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

Closed ghost closed 5 years ago

ghost commented 5 years ago

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?

TheGroundZero commented 5 years ago

Hi Thank you for notifying me of this issue. I'll give it a look once I have time.

ghost commented 5 years ago

Hi Thank you for notifying me of this issue. I'll give it a look once I have time.

So this isn't really a solution but more of a workaround. Since --template is only used for creating a .docx, it doesn't make sense for the export_to_csv & export_to_excel functions to even care about the --template argument. So I just removed lines 85-86:

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

& 657-658:

    if template is not None:
        raise NotImplementedError("Use of template is not supported in CSV-output.")

from export.py and it works fine. I say this is a workaround because using templates for those outputs as a future implementation would be cool.

Thanks for keeping up development of these tools. I use OpenVAS a lot and its reporting capabilities are the worst, so these sorts of things are very valuable to me.

TheGroundZero commented 5 years ago

Could you give me some more info about your situation?

This error is thrown when someone uses the --template parameter while exporting to xlsx or csv. Since this functionality is (currently) unsupported, the error is raised.

You could indeed claim that passing the --template when unsupported should just be ignored.

TheGroundZero commented 5 years ago

Will continue this in #2