CSV Report returned as binary data?


#1

Using report format id: c1645568-627a-11e3-a660-406186ea4fc5

With: gvm-cli socket --sockpath /usr/local/var/run/openvasmd.sock --gmp-username $OPENVASUSER --gmp-password $OPENVASPASS --xml '<get_reports report_id="8553f683-52f2-4732-b3fc-242737322778" format_id="c1645568-627a-11e3-a660-406186ea4fc5"/>'

I am expecting text/csv data in return, but get this instead:

<?xml version="1.0"?>
<get_reports_response status="200" status_text="OK">
  <report type="scan" id="8553f683-52f2-4732-b3fc-242737322778" format_id="c1645568-627a-11e3-a660-406186ea4fc5" extension="csv" content_type="text/csv"><owner><name>admin</name></owner><name>2018-10-23T13:04:34Z</name><comment/><creation_time>2018-10-23T13:04:34Z</creation_time><modification_time>2018-10-23T13:05:52Z</modification_time><writable>0</writable><in_use>0</in_use><task id="cce5138c-01a6-43c3-8d29-a57f2f353f6d"><name>Scan nginxsite nginxdemoshello:0.1 - 2018-10-23_14-04-15</name></task><report_format id="c1645568-627a-11e3-a660-406186ea4fc5"><name>CSV Results</name></report_format>SVAsSG9zdG5hbWUsUG9ydCxQb3J0IFByb3RvY29sLENWU1MsU2V2ZXJpdHksU29sdXRpb24gVHlwZSxOVlQgTmFtZSxTdW1tYXJ5LFNwZWNpZmljIFJlc3VsdCxOVlQgT0lELENWRXMsVGFzayBJRCxUYXNrIE5hbWUsVGltZXN0YW1wLFJlc3VsdCBJRCxJbXBhY3QsU29sdXRpb24sQWZmZWN0ZWQgU29mdHdhcmUvT1MsVnVsbmVyYWJpbGl0eSBJbnNpZ2h0LFZ1bG5lcmFiaWxpdHkgRGV0ZWN0aW9uIE1ldGhvZCxQcm9kdWN0IERldGVjdGlvbiBSZXN1bHQsQklEcyxDRVJUcyxPdGhlciBSZWZlcmVuY2VzCjE5Mi4xNjguMC40LCw4MCx0Y3AsMC4wLExvZywiIiwiQ0dJIFNjYW5uaW5nIENvbnNvbGlkYXRpb24iLCJUaGUgc2NyaXB0IGNvbnNvbGlkYXRlcyB2YXJpb3VzIGluZm9ybWF0aW9uIGZvciBDR0kgc2Nhbm5pbmcuCgogIFRoaXMgaW5mb3JtYXRpb24gaXMgYmFzZWQgb24gdGhlIGZvbGxvd2luZyBzY3JpcHRzIC8gc2V0dGluZ3M6CgogIC0gSFRUUC1WZXJzaW9uIERldGVjdGlvbiAoT0lEOiAxLjMuNi4xLjQuMS4yNTYyMy4xLjAuMTAwMDM0KQoKICAtIE5vIDQwNCBjaGVjayAoT0lEOiAxLjMuNi4xLjQuMS4yNTYyMy4xLjAuMTAzODYpCgogIC0gV2ViIG1pcnJvcmluZyAvIHdlYm1pcnJvci5uYXNsIChPSUQ6IDEuM...

Is there anyway to have the report return as usable text/csv data?

Many thanks


#2

The content after </report_format> is base64 encoded. You have to decode it.


#3

Ah ok. Thanks.

Is there a way to return just the base64 data, then? I tried using xmlstarlet but it still has some plain text info in there.

( | xmlstarlet sel -t -v "get_reports_response/report")


#4

I am not an expert for xmlstarlet, but i think this could help you.

http://www.openvas.org/src-doc/openvas-cli/index.html

There is an example with xmlstarlet.


#5

Thanks, the text\(\) fixed it! Appreciate the info.