Commit 774900da authored by Brian Neel's avatar Brian Neel

Add custom simple report format

parent 523628c6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJZuJTlAAoJEOMNqxHKPeq1jiIIAKoKIdE3cLdQgMwNzj2RroKz
Cizml+gDYTSnWWUWtO4rweP9yVK2RvV6ws5C4UJRG5+7AAiGsgdPLVWc8UsOqypU
XScjHIDn26BQYJQE0wCwP2TTQdhSKmzp0qaQuSUuxy6zWBrK3gp99CFNOpr5PlDo
9iE122RgKpprt8lm/1aCjWU6/i7+ldmQYey9NWH6Nbn7y97HOGaU4aj5K53m3zUB
0R8E50Y2fVCxIdk3UOj18A5n2msb3JP1Oul3ug7Se+0caE24Ykg2pLI+oukXvb/H
98oifA8O5UYTN9VilD/QyM6al24mdwJL+IQBFhw3fgmpHnGv7av0woLn4Qx1Fc4=
=AyqZ
-----END PGP SIGNATURE-----
NAME="Simple Text Summary"
UUID=`uuid`
EXTENSION=txt
CONTENT_TYPE="text/plain"
SUMMARY="Summary threat counts as text."
DESCRIPTION="Simple example for a summary of threat counts as text."
# Names must be in alphabetical order.
FNAME1=generate
FILE1=`base64 -w 0 generate`
FNAME2=pieplot.xsl
FILE2=`base64 -w 0 pieplot.xsl`
#
# PARAMS
#
PARAM1_NAME="Width"
PARAM1_VALUE="600"
PARAM1_TYPE=string
#
PARAM2_NAME="Height"
PARAM2_VALUE="400"
PARAM2_TYPE=string
echo ${UUID}${EXTENSION}${CONTENT_TYPE}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM2_NAME}${PARAM2_TYPE}${PARAM2_VALUE} > ${UUID}
gpg --homedir=/usr/local/etc/openvas/gnupg --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_text_summary.xml
cat ${UUID}.asc >> simple_text_summary.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_text_summary.xml
#!/bin/sh
#
# OpenVAS
# $Id$
# Description: Report generator script: results per threat pie plot.
#
# This report generates a PNG graphics file
# with a pie plot of the numbers of threat counts.
# The XML transformation via XSL with xsltproc
# creates a little Python program which uses the pychart
# module to create the pie chart PNG graphics.
#
# Authors:
# Jan-Oliver Wagner <[email protected]>
#
# Copyright:
# Copyright (C) 2010 Greenbone Networks GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
SRC=`pwd`
TMP=`mktemp -d` || exit 1
xsltproc ./pieplot.xsl $1 > ${TMP}/pieplot.sh 2>${TMP}/xlstproc.err \
&& cd ${TMP} 2>/dev/null \
&& bash pieplot.sh 2>${TMP}/python.err
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" indent="no" />
<xsl:strip-space elements="*"/>
<!--
OpenVAS Manager
$Id$
Description: Stylesheet for generating python code that creates a pie plot.
Authors:
Jan-Oliver Wagner <[email protected]>
Copyright:
Copyright (C) 2010 Greenbone Networks GmbH
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-->
<xsl:template name="newline">
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="report">
echo -n "High (<xsl:value-of select="count (results/result[threat='High'])"/>)",
echo -n "Medium (<xsl:value-of select="count (results/result[threat='Medium'])"/>)",
echo "Low (<xsl:value-of select="count (results/result[threat='Low'])"/>)"
<xsl:call-template name="newline"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="report/@extension='xml'">
<xsl:apply-templates select="report/report"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="report"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<get_report_formats_response status="200" status_text="OK"><report_format id="7f826a02-9829-11e7-9b58-4bdfa298bdb3"><name>Simple Text Summary</name><extension>txt</extension><content_type>text/plain</content_type><summary>Summary threat counts as text.</summary><description>Simple example for a summary of threat counts as text.</description><global>0</global><file name="generate">IyEvYmluL3NoCiMKIyBPcGVuVkFTCiMgJElkJAojIERlc2NyaXB0aW9uOiBSZXBvcnQgZ2VuZXJhdG9yIHNjcmlwdDogcmVzdWx0cyBwZXIgdGhyZWF0IHBpZSBwbG90LgojCiMgVGhpcyByZXBvcnQgZ2VuZXJhdGVzIGEgUE5HIGdyYXBoaWNzIGZpbGUKIyB3aXRoIGEgcGllIHBsb3Qgb2YgdGhlIG51bWJlcnMgb2YgdGhyZWF0IGNvdW50cy4KIyBUaGUgWE1MI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y6zWBrK3gp99CFNOpr5PlDo
9iE122RgKpprt8lm/1aCjWU6/i7+ldmQYey9NWH6Nbn7y97HOGaU4aj5K53m3zUB
0R8E50Y2fVCxIdk3UOj18A5n2msb3JP1Oul3ug7Se+0caE24Ykg2pLI+oukXvb/H
98oifA8O5UYTN9VilD/QyM6al24mdwJL+IQBFhw3fgmpHnGv7av0woLn4Qx1Fc4=
=AyqZ
-----END PGP SIGNATURE-----
</signature><param><name>Width</name><value>600</value><type>string</type><default>600</default></param><param><name>Height</name><value>400</value><type>string</type><default>400</default></param></report_format></get_report_formats_response>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment