gvm-script -c ./gvm-tools.conf tls --hostname 127.0.0.1 --port 9390 pdf-report.gmp f06bdf89-c29c-4565-923a-d64908012067
PDF file produced command above can not be opened. GVM versions
**gsad:8.0.1 (‘gsad --version’)
**gvmd: 8.0.1 (‘gvmd --version’)
**openvas:6.0.1 (‘openvassd --version’)
gvm-tools:2.0.0 release version
python-gvm:1.0.0 release version Environment
**Operating system:linux fedora x86_64
**Kernel:Linux 126.96.36.199-106.fc14.x86_64 (‘uname -a’)
**Installation method / source:source code installation
Please ensure you have installed the required packages e.g. xsltproc and xmlstarlet. There are a lot of topics regarding the missing packages for different distributions in this forum. E.g.
I am new to openvas and Greenbone security assistant, I have installed openvas in rhel 7. I am able to add the target and scan it, also i am able to see the results in CSV format but unable to see the results in PDF. PDF file is empty .
So kindly help me how to resovle it. I need the reports in PDF format.
Thank you very much for your suggestion.
I have installed xsltproc，xmlstarlet and pdflatex, pdf doc produced by scripts/pdf-report.gmp can be display successly now.
Hi, I have the same problem. I obtain a corrupted or ureadable PDF file by running pdf-report.gmp.
Sometimes I have also these errors:
binascii.Error: Invalid base64-encoded string: number of data characters (521125) cannot be 1 more than a multiple of 4
binascii.Error: Incorrect padding
I installed xsltproc, xmlstarlet, texlive*
gsad:8.0.1 (‘gsad --version’)
gvmd: 8.0.1 (‘gvmd --version’)
openvas:6.0.1 (‘openvassd --version’)
gvm-tools:2.0.0 release version
python-gvm:1.0.0 release version
Operating system: Linux kali-server 5.2.0-kali2-amd64 # SMP Debian 5.2.9-2kali1 (2019-08-22) x86_64 1
Note that from the dashboard I correctly download the report in pdf format. The problem is to create the pdf using the pdf-report.gmp script. Thanks
I have exactly the same issues currently…
Via GSA, PDF generation works fine. If I use the pdf-report.gmp script respectively embed the code in my own scripts, I sometimes get the same Errors and sometimes a file is created but unreadable (filetype application/octet-stream).
What is conspicuous, is that the size of the unreadable file is almost twice as much as the same pdf report file exported via GSA.
pdf-report.gmp is an example script! You have to add some additional exception handling and debug output to get the root cause of the issue.
So, there was probably a parsing issue going on.
Firstly I temporarily saved the XML response and removed all nodes from <report> but the text node. Parsing of this modified XML worked fine with the
But instead of removing nodes I applied the solution suggested from
@gormami posted in:
After spending way too much time on this, I think i have found that the return from the get_report() call is not XML compliant. THe problem is that the value of the is not explicitly tagged, and follows several embedded elements within the report element. I am not an XML expert, to say definitively, but all the parsers I tried parsed the tree, but not the value. I added a regex to put tags in, and everything worked fine.
Can anyone confirm if the reply is XML compliant or not?
To achieve this, the codeline of
pdf_filename = args.argv + ".pdf"
pdf_report_format_id = "c402cc3e-b531-11e1-9163-406186ea4fc5"
response = gmp.get_report(
report_element = response
# get the full content of the report element
content = "".join(report_element.itertext())
# convert content to 8-bit ASCII bytes
binary_base64_encoded_pdf = content.encode('ascii')
# decode base64
binary_pdf = b64decode(binary_base64_encoded_pdf)
# write to file and support ~ in filename path
pdf_path = Path(pdf_filename).expanduser()
had to be rewritten as follows:
from lxml import etree
# get the content of the report element
report = report_response
report = etree.tostring(report).decode('ascii')
report = re.sub('</report_format>', '</report_format><value>', report)
report = re.sub('</report>', '</value></report>', report)
report = etree.fromstring(report)
content = report.xpath('value').text
In my case, this results in a correct PDF report. Of course, this is just a workaround. But obviously there are some parser which cannot handle the XML structure of <report>. So maybe an adjustment should be considered.
Good job man, it works. It would be interesting to know in which part of the GCE python source code GSA generates pdf from xml…
After changing the mentioned line of code with the new code, i am getting the following error
" ‘NoneType’ object has no attribute ‘encode’ "
Can you please check it?
Maybe it’s the same problem as
08:36AM - 02 May 19 UTC
When I call get_report function with XML report_format_id I got this error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/gvm/connections.py", line 71, in...
Thanks for the response.
So, is it there any other possibility to get the report?