[Openvas-commits] r9270 - in trunk/openvas-manager: . doc report_formats/simple_pie_chart report_formats/simple_topo_plot
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Oct 25 19:03:58 CEST 2010
Author: mattm
Date: 2010-10-25 19:03:56 +0200 (Mon, 25 Oct 2010)
New Revision: 9270
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/doc/report-format-HOWTO
trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import
trunk/openvas-manager/report_formats/simple_pie_chart/pieplot.xsl
trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import
trunk/openvas-manager/report_formats/simple_topo_plot/generate
trunk/openvas-manager/report_formats/simple_topo_plot/hostvisdot-summary.xsl
Log:
* doc/report-format-HOWTO: Note the extra report element.
* report_formats/simple_pie_chart/create_report_import: Add param Height.
* report_formats/simple_pie_chart/pieplot.xsl: Read height from new param.
* report_formats/simple_topo_plot/create_report_import: Add params "Graph
Type" and "Node Distance".
* report_formats/simple_topo_plot/generate: Read plot tool from param.
* report_formats/simple_topo_plot/hostvisdot-summary.xsl: Read nodesep
from param.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/ChangeLog 2010-10-25 17:03:56 UTC (rev 9270)
@@ -1,5 +1,21 @@
2010-10-25 Matthew Mundell <matthew.mundell at greenbone.net>
+ * doc/report-format-HOWTO: Note the extra report element.
+
+ * report_formats/simple_pie_chart/create_report_import: Add param Height.
+
+ * report_formats/simple_pie_chart/pieplot.xsl: Read height from new param.
+
+ * report_formats/simple_topo_plot/create_report_import: Add params "Graph
+ Type" and "Node Distance".
+
+ * report_formats/simple_topo_plot/generate: Read plot tool from param.
+
+ * report_formats/simple_topo_plot/hostvisdot-summary.xsl: Read nodesep
+ from param.
+
+2010-10-25 Matthew Mundell <matthew.mundell at greenbone.net>
+
* src/omp.c (omp_xml_handle_end_element): Increase GET_VERSION version.
2010-10-25 Matthew Mundell <matthew.mundell at greenbone.net>
Modified: trunk/openvas-manager/doc/report-format-HOWTO
===================================================================
--- trunk/openvas-manager/doc/report-format-HOWTO 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/doc/report-format-HOWTO 2010-10-25 17:03:56 UTC (rev 9270)
@@ -45,9 +45,16 @@
- Test the generate script
- - Get an OMP report (download the report with the GSA, or do a GET_REPORTS
- request with some other client like the omp command).
+ - Get an OMP report (download the report with the GSA or do a GET_REPORTS
+ request with some other client like the omp command, and extract the
+ innermost REPORT element).
+ A command like
+
+ omp -R REPORT_ID | xmlstarlet sel -t -m /report -c report
+
+ will do the trick.
+
- Run the command
. generate report.xml
Modified: trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import 2010-10-25 17:03:56 UTC (rev 9270)
@@ -15,11 +15,15 @@
PARAM1_NAME="Width"
PARAM1_VALUE="600"
PARAM1_TYPE=string
+#
+PARAM2_NAME="Height"
+PARAM2_VALUE="400"
+PARAM2_TYPE=string
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_VALUE}${PARAM1_TYPE}${PARAM1_VALUE} > ${UUID}
+echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_VALUE}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM2_NAME}${PARAM2_VALUE}${PARAM2_TYPE}${PARAM2_VALUE} > ${UUID}
gpg --detach-sign --armor ${UUID}
rm ${UUID}
echo -n '<get_report_formats_response status="200" status_text="OK"><report_format id="'$UUID'"><name>'$NAME'</name><extension>'$EXTENSION'</extension><content_type>'$CONTENT_TYPE'</content_type><summary>'$SUMMARY'</summary><description>'$DESCRIPTION'</description><global>0</global><file name="'$FNAME1'">'$FILE1'</file><file name="'$FNAME2'">'$FILE2'</file><signature>' > simple_pie_chart.xml
cat ${UUID}.asc >> simple_pie_chart.xml
-echo '</signature><param><name>'$PARAM1_NAME'</name><value>'$PARAM1_VALUE'</value><type>'$PARAM1_TYPE'</type><default>'$PARAM1_VALUE'</default></param></report_format></get_report_formats_response>' >> simple_pie_chart.xml
+echo '</signature><param><name>'$PARAM1_NAME'</name><value>'$PARAM1_VALUE'</value><type>'$PARAM1_TYPE'</type><default>'$PARAM1_VALUE'</default></param><param><name>'$PARAM2_NAME'</name><value>'$PARAM2_VALUE'</value><type>'$PARAM2_TYPE'</type><default>'$PARAM2_VALUE'</default></param></report_format></get_report_formats_response>' >> simple_pie_chart.xml
Modified: trunk/openvas-manager/report_formats/simple_pie_chart/pieplot.xsl
===================================================================
--- trunk/openvas-manager/report_formats/simple_pie_chart/pieplot.xsl 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/report_formats/simple_pie_chart/pieplot.xsl 2010-10-25 17:03:56 UTC (rev 9270)
@@ -45,7 +45,7 @@
("Low (<xsl:value-of select="count (report/results/result[threat='Low'])"/>)",
<xsl:value-of select="count (report/results/result[threat='Low'])"/>)]
-ar = area.T(size=(<xsl:value-of select="report/report_format/param[name='Width']/value"/>,<xsl:value-of select="report/report_format/param[name='Width']/value"/>), legend=None,
+ar = area.T(size=(<xsl:value-of select="report/report_format/param[name='Width']/value"/>,<xsl:value-of select="report/report_format/param[name='Height']/value"/>), legend=None,
x_grid_style = None, y_grid_style = None)
# The "High" element is pulled out of the pie with offset=10
Modified: trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import 2010-10-25 17:03:56 UTC (rev 9270)
@@ -9,11 +9,26 @@
FILE1=`base64 -w 0 generate`
FNAME2=hostvisdot-summary.xsl
FILE2=`base64 -w 0 hostvisdot-summary.xsl`
+#
+# PARAMS
+#
+PARAM1_NAME="Graph Type"
+PARAM1_TYPE=selection
+PARAM1_OPTION1="circo"
+PARAM1_OPTION2="dot"
+PARAM1_OPTION3="twopi"
+PARAM1_VALUE=$PARAM1_OPTION3
+#
+PARAM2_NAME="Node Distance"
+PARAM2_VALUE="8"
+PARAM2_TYPE=integer
+PARAM2_TYPE_MIN=1
+PARAM2_TYPE_MAX=20
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${FNAME3}${FILE3} > ${UUID}
+echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${FNAME3}${FILE3}${PARAM2_NAME}${PARAM2_VALUE}${PARAM2_TYPE}${PARAM2_TYPE_MIN}${PARAM2_TYPE_MAX}${PARAM2_VALUE}${PARAM1_NAME}${PARAM1_VALUE}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM1_OPTION1}${PARAM1_OPTION2}${PARAM1_OPTION3} > ${UUID}
gpg --detach-sign --armor ${UUID}
rm ${UUID}
echo -n '<get_report_formats_response status="200" status_text="OK"><report_format id="'$UUID'"><name>'$NAME'</name><extension>'$EXTENSION'</extension><content_type>'$CONTENT_TYPE'</content_type><summary>'$SUMMARY'</summary><description>'$DESCRIPTION'</description><global>0</global><file name="'$FNAME1'">'$FILE1'</file><file name="'$FNAME2'">'$FILE2'</file><signature>' > simple_topology.xml
cat ${UUID}.asc >> simple_topology.xml
-echo '</signature></report_format></get_report_formats_response>' >> simple_topology.xml
+echo '</signature><param><name>'$PARAM1_NAME'</name><value>'$PARAM1_VALUE'</value><type>'$PARAM1_TYPE'</type><options><option>'$PARAM1_OPTION1'</option><option>'$PARAM1_OPTION2'</option><option>'$PARAM1_OPTION3'</option></options><default>'$PARAM1_VALUE'</default></param><param><name>'$PARAM2_NAME'</name><value>'$PARAM2_VALUE'</value><type>'$PARAM2_TYPE'<min>'$PARAM2_TYPE_MIN'</min><max>'$PARAM2_TYPE_MAX'</max></type><default>'$PARAM2_VALUE'</default></param></report_format></get_report_formats_response>' >> simple_topology.xml
Modified: trunk/openvas-manager/report_formats/simple_topo_plot/generate
===================================================================
--- trunk/openvas-manager/report_formats/simple_topo_plot/generate 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/report_formats/simple_topo_plot/generate 2010-10-25 17:03:56 UTC (rev 9270)
@@ -8,11 +8,11 @@
# network topology. In a first step, the OMP report is
# transformed via XSL with the tool xsltproc.
# Next duplicate lines are removed with awk and finally
-# twopi of GraphViz creates the SVG file.
+# twopi of GraphViz creates the SVG file.
#
# Authors:
# Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
-#
+#
# Copyright:
# Copyright (C) 2010 Greenbone Networks GmbH
#
@@ -37,7 +37,8 @@
# remove duplicate lines:
awk '!($0 in a) {a[$0];print}' ${TMP}/summary-rgb.dot > ${TMP}/summary-rgb-nondup.dot
-# use twopi (or dot or any other GraphViz module) to generate an SVG graphic
-twopi -Tsvg ${TMP}/summary-rgb-nondup.dot -o ${TMP}/summary-rgb-nondup.svg
+# Generate an SVG graphic using one of the GraphViz modules.
+`cat $1 | xmlstarlet sel -t -v "/report/report_format/param[name='Graph Type']/value"` \
+ -Tsvg ${TMP}/summary-rgb-nondup.dot -o ${TMP}/summary-rgb-nondup.svg
cat ${TMP}/summary-rgb-nondup.svg
Modified: trunk/openvas-manager/report_formats/simple_topo_plot/hostvisdot-summary.xsl
===================================================================
--- trunk/openvas-manager/report_formats/simple_topo_plot/hostvisdot-summary.xsl 2010-10-25 15:05:08 UTC (rev 9269)
+++ trunk/openvas-manager/report_formats/simple_topo_plot/hostvisdot-summary.xsl 2010-10-25 17:03:56 UTC (rev 9270)
@@ -34,7 +34,7 @@
<xsl:template match="report">
digraph scan {
- nodesep = 8;
+ nodesep = <xsl:value-of select="report_format/param[name = 'Node Distance']/value"/>;
ranksep = 2;
overlap = "true";
fontsize = 8.0;
More information about the Openvas-commits
mailing list