Closed BhagyashreeKoyande closed 4 years ago
You may take time to give more information? There is an Issue-Template you might have seen. What version of gvm-tools and python-gvm did you used?
I have clone the git directory for files and installed gvm-tools using pip3.
you may type gvm-script -V
in the console and copy the output here?
gvm-script 20.10.1 (API version 20.11.0)
Hmm interesting. I don't have any trouble with this script:
gvm-scr 192.168.178.138 ../gvm-tools/scripts/pdf-report.gmp.py 6373f0ac-9ebc-4668-a44d-057318addf88
Done. PDF created: 6373f0ac-9ebc-4668-a44d-057318addf88.pdf
Ohh, any idea what is wrong with my gvm-script command?
gvm-script scan command works for me and generates report id also. Problems occurs while generating pdf report. I am also attaching the screenshot of terminal output
Please check and guide me for what I can do
Maybe it is the report? If you want, you may try to download the report as xml?
gvm-pyshell --gmp-username=admin --gmp-password=admin socket <your_socket>
>>> from gvm.xml import pretty_print
>>> response = gmp.get_report(report_id='<your_report_id>', report_format_id='a994b278-1f62-11e1-96ac-406186ea4fc5')
>>> with open('<any_file>', 'w') as f:
... pretty_print(response, f)
...
Is this working? Is the file <any_file>
containing a valid xml Report?
The error indicates that the returned content (the XML response from our gvmd
daemon) didn't contain valid base64 encoded data. Therefore we need take a to look at XML output of the response for being able to debug the issue further. Please follow the advise from @y0urself and paste the formatted XML here.
I've you paste code please always use preformatted markdown syntax
<get_reports_response status="200" status_text="OK">
<report id="03948874-9f06-4231-ba43-04dc3c778240" format_id="a994b278-1f62-11e1-96ac-406186ea4fc5" extension="xml" content_type="text/xml">
<owner>
<name>admin</name>
</owner>
<name/>
<comment/>
<creation_time/>
<modification_time>2020-11-05T09:54:48Z</modification_time>
<writable>0</writable>
<in_use>0</in_use>
<task id="40b6c517-ba10-4fbc-811c-1435c28be1b2">
<name>Scan Suspect Host 192.168.56.1</name>
</task>
<report_format id="a994b278-1f62-11e1-96ac-406186ea4fc5">
<name>XML</name>
</report_format>
<report id="03948874-9f06-4231-ba43-04dc3c778240">
<gmp>
<version>9.0</version>
</gmp>
<sort>
<field>name<order>ascending</order></field>
</sort>
<filters id="">
<term>apply_overrides=0 min_qod=70 first=1 rows=1000 sort=name</term>
<filter>High</filter>
<filter>Medium</filter>
<filter>Low</filter>
<filter>Log</filter>
<filter>Debug</filter>
<keywords>
<keyword>
<column>apply_overrides</column>
<relation>=</relation>
<value>0</value>
</keyword>
<keyword>
<column>min_qod</column>
<relation>=</relation>
<value>70</value>
</keyword>
<keyword>
<column>first</column>
<relation>=</relation>
<value>1</value>
</keyword>
<keyword>
<column>rows</column>
<relation>=</relation>
<value>1000</value>
</keyword>
<keyword>
<column>sort</column>
<relation>=</relation>
<value>name</value>
</keyword>
</keywords>
</filters>
<severity_class id="d4c74cda-89e1-11e3-9c29-406186ea4fc5">
<name>nist</name>
<full_name>NVD Vulnerability Severity Ratings</full_name>
<severity_range>
<name>None</name>
<min>0.0</min>
<max>0.0</max>
</severity_range>
<severity_range>
<name>Low</name>
<min>0.1</min>
<max>3.9</max>
</severity_range>
<severity_range>
<name>Medium</name>
<min>4.0</min>
<max>6.9</max>
</severity_range>
<severity_range>
<name>High</name>
<min>7.0</min>
<max>10.0</max>
</severity_range>
</severity_class>
<scan_run_status>Done</scan_run_status>
<hosts>
<count>0</count>
</hosts>
<closed_cves>
<count>0</count>
</closed_cves>
<vulns>
<count>0</count>
</vulns>
<os>
<count>0</count>
</os>
<apps>
<count>0</count>
</apps>
<ssl_certs>
<count>0</count>
</ssl_certs>
<task id="40b6c517-ba10-4fbc-811c-1435c28be1b2">
<name>Scan Suspect Host </name>
<comment/>
<target id="3006db49-89c2-435b-9d52-77e0ad414f4b">
<trash>0</trash>
<name>Suspect Host 2020-11-05 15:24:48.003377</name>
<comment/>
</target>
<progress>-1</progress>
</task>
<scan>
<task/>
</scan>
<timestamp>2020-11-05T09:54:48Z</timestamp>
<scan_start/>
<timezone>Coordinated Universal Time</timezone>
<timezone_abbrev>UTC</timezone_abbrev>
<result_count>0<full>0</full><filtered>0</filtered><debug><full>0</full><filtered>0</filtered></debug><hole><full>0</full><filtered>0</filtered></hole><info><full>0</full><filtered>0</filtered></info><log><full>0</full><filtered>0</filtered></log><warning><full>0</full><filtered>0</filtered></warning><false_positive><full>0</full><filtered>0</filtered></false_positive></result_count>
<severity>
<full>-3.0</full>
<filtered>-3.0</filtered>
</severity>
<scan_end>2020-11-05T09:54:48Z</scan_end>
<errors>
<count>1</count>
<error>
<host>
<asset asset_id=""/>
</host>
<port/>
<description>Could not connect to Scanner</description>
<nvt oid="">
<type>nvt</type>
<name/>
<cvss_base/>
</nvt>
<scan_nvt_version/>
<severity>-3</severity>
</error>
</errors>
<report_format/>
</report>
</report>
<filters id="">
<term>apply_overrides=0 min_qod=70 first=1 rows=10 sort=name</term>
<keywords>
<keyword>
<column>apply_overrides</column>
<relation>=</relation>
<value>0</value>
</keyword>
<keyword>
<column>min_qod</column>
<relation>=</relation>
<value>70</value>
</keyword>
<keyword>
<column>first</column>
<relation>=</relation>
<value>1</value>
</keyword>
<keyword>
<column>rows</column>
<relation>=</relation>
<value>10</value>
</keyword>
<keyword>
<column>sort</column>
<relation>=</relation>
<value>name</value>
</keyword>
</keywords>
</filters>
<sort>
<field>name<order>ascending</order></field>
</sort>
<reports start="1" max="1000"/>
<report_count>8<filtered>1</filtered><page>1</page></report_count>
</get_reports_response>
As you said, I have pasted the xml content. Please guide me further what to be done
Your report doesn't contain any scan results. Your environment has not being set up correctly. Your scanner is not running correctly.
<description>Could not connect to Scanner</description>
In that case it could be possible that the PDF report format doesn't return any content and the example pdf download script crashes while trying to convert the non existing base64 content.
Please search in the forum for further advises about checking and fixing the scanner setup. There are a loooot of threads.
Thanks for your help @y0urself and @bjoernricks
I think this issue is fixed with #328
When I run the pdf-report.gmp.py through gvm-script command, I get an error as Incorrect Padding.