Hi,

Maybe you can take look of my solution @
http://ping-viini.org/get-reports-latest.zip

It exports latest reports from scanner to file and then zips and sends via
email.

requires: php-cli, zip, working sendmail binary, working omp-cli

usage like php et-reports-latest.php your@email

it also requires $HOME/omp.config for authentication details like this:

[Connection]

host=127.0.0.1

port=9390

username=admin

password=adminpassword


with very little modification it can export all reports to one file.


patch to include all in one file. not tested. may work. any questions?


--- get-reports-latest.php 2015-04-12 23:42:50.984480286 +0200

+++ get-reports-latest.php.new 2015-04-12 23:50:42.081128440 +0200

@@ -128,7 +128,7 @@

  $string = sprintf( "omp  -iX \"<get_tasks task_id='%s' details='1' />\"
|grep -A1 '<last_report' |grep id | awk -F\\\" '{ print $2 }'",$id);

  $report_id = shell_exec($string);

  $report_id = trim($report_id);

- $string2 = sprintf("omp  --get-report %s --format %s  >
/tmp/%s/full-%s.csv",$report_id,$formatstr,$today,$hostname);

+ $string2 = sprintf("omp  --get-report %s --format %s  >>
/tmp/%s/all-in-one.csv",$report_id,$formatstr,$today);

 //        echo "$string2";

  shell_exec($string2);

Eero

--
Eero

2015-03-20 11:29 GMT+02:00 Selam Uzun <[email protected]>:

> Hallo,
>
> It's me again, sorry ^^ (thanks again for the previous answers).
>
> I have a weird result that I can't explain but I think it's a base64
> encoding/decoding problem. I'd like to have your opinion.
> My aim is simple : I want to get all reports in CSV and in one file.
> I have this :
>
> -------------------------
> #!/bin/sh
>
> # Description: import of all reports generated by OpenVAS
>
> IMPORT_FILE="openvas_reports.csv"
>
> # csv format id
> REPORT_FORMAT_ID="9087b18c-626c-11e3-8892-406186ea4fc5"
>
> # Get reports
> omp -u admin -w admin -X '
> <get_reports format_id="'$REPORT_FORMAT_ID'"/>
> ' | egrep -o 'SVAsSG9zdG5hbWUsT1M[[:alnum:]]+' \
>   | base64 -d > $IMPORT_FILE
> -------------------------
>
> The egrep may seems a bit..."meh" but since all CSV reports start like
> this in base64 I though it would make the deal.
>
> I made a scan in GSA and I got a high severity (7.5), 1 high, 4 medium, 0
> low, 15 log.
> When I run the script I get :
>
> IP,Hostname,OS,Scan Start,Scan End,CVSS,Severity,High,Medium,Low,Log,False
> Positive,Total
> 127.0.0.1, ........ ,*0.0,None,0,0,0,10,0,10*
>
> I though I made a mistake in the script but I made another scan in GSA and
> I got a medium severity (4.3), 0 high, 2 medium, 0 low, 7 log (I turned off
> the service that generate the high vulnerability).
> When I run the script, I get good results for the medium severity only:
>
> IP,Hostname,OS,Scan Start,Scan End,CVSS,Severity,High,Medium,Low,Log,False
> Positive,Total
> 127.0.0.1, ........ ,
> *0.0,None,0,0,0,10,0,10 *
> IP,Hostname,OS,Scan Start,Scan End,CVSS,Severity,High,Medium,Low,Log,False
> Positive,Total
> 127.0.0.1, ........ ,*4.3,Medium,0,2,0,7,0,9*
>
> In a terminal I tried, first, to get the high severity report in csv :
> <get_reports_response status_text="OK" status="200">... extension="csv"
> type="scan" content_type="text/csv">BLABLABLA<owner><name>....
> I decoded the BLABLABLA part and
>
> *that was the good information:*IP,Hostname,OS,Scan Start,Scan
> End,CVSS,Severity,High,Medium,Low,Log,False Positive,Total
> 127.0.0.1, ........ ,*7.5,High,1,4,0,15,0,20*
>
> Then, always in the terminal, I tried to get all reports (the high and the
> medium) in CSV:
> <get_reports_response status_text="OK" status="200">... extension="csv"
> type="scan" content_type="text/csv">FIRSTBLABLA<owner><name>....
> ... extension="csv" type="scan"
> content_type="text/csv">SECONDBLABLA<owner><name>....
>
> FIRSTBLABLA correspond to the high severity report and when decoded it
> gives *wrong information* => *0.0,None,0,0,0,10,0,10*
> SECONDBLABLA correspond to the medium severity report and when decoded it
> gives *good information =>* *4.3,Medium,0,2,0,7,0,9*
>
> And now, I have X-files generic music in my mind.
>
> Some additional informations :
> Kali 1.1.0-amd64
> OpenVAS-7 (scanner 4.0.2, Manager 5.0.2, GSA 5.0.1, CLI 1.3.0)
> Everything works fine, nothing particular in logs
> I tried with TXT format, same result : when I import one by one, no
> problem. When I import all (the high and medium) I get wrong information
> for the high.
>
>
> If you have an idea, please let me know.
> Thanks a lot in advance for your time.
>
> Best regards,
> S. Uzun
>
>
> _______________________________________________
> Openvas-discuss mailing list
> [email protected]
> https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-discuss
>
_______________________________________________
Openvas-discuss mailing list
[email protected]
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-discuss

Reply via email to