Extracting report format via xmlstarlet

Hi There,

Trying to get a pdf report with gvm-cli in a script using the syntax:
gvm-cli socket --socketpath /var/run/openvasmd.sock --timeout -1 --gmp-username admin --gmp-password pwd -X ‘<get_reports report_id="’$reportId’" format_id="’$formatId’" filter=“apply_overrides=1 overrides=1 levels=hml” ignore_pagination=“1”/>’ | xmlstarlet sel -t -v get_reports_response/report/text() | base64 -i -d > $reportName.$ext

Fails with the following error:

-:1.10004001: xmlSAX2Characters: huge text node: out of memory

_ ^_
-:1.10004001: Extra content at the end of the document
_ ^_
_Exception ignored in: <io.TextIOWrapper name=’’ mode=‘w’ encoding=‘UTF-8’>

This doesn’t happen with smaller reports. Any idea why this is failing ?



could you please check if gvm-cli works as expected by running only the gvm-cli command like:

If you don’t get an error from gvm-cli in this case it seems to be an issue with xmlstarlet.

1 Like

I confirm it’s an xmlstarlet issue. Dumping gvm-cli command to a local file works as expected. But piping this file through xmlstarlet fails. Is there any workaround to this or an alternative to xmlstarlet perhaps ?


I’ve changed the topic accordingly.

Personally I would use the python API and write a gmp script instead


1 Like

And I’ve added an example script for creating a PDF file from a report. Should be easy to extend.

1 Like