#!/bin/sh
#
# OpenVAS Manager
# $Id$
# Description: Report generator script: ISM Verinice interface.
#
# Authors:
# Andre Heinecke <aheinecke@intevation.de>
#
# Copyright:
# Copyright (C) 2011 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.

#xsltproc --stringparam filename $FILENAME ./Verinice_ISM.xsl $XMLFILE | sed -e "s/\ xmlns=\"\"//g" | xmlstarlet fo > output_ism.xml
TMP=`mktemp -d` || exit 1
STARTDIR=`pwd`
XMLFILE=`readlink -f $1`
FILENAME=`basename $1`

REPORT_ID=`xmlstarlet sel -t -v /report/task/@id $XMLFILE`

cp $XMLFILE $TMP/$REPORT_ID-report-file\_$FILENAME
xsltproc ./Verinice_ITG.xsl $1 | \
        sed -e "s/\ xmlns=\"\"//g" | \
        xmlstarlet fo >  $TMP/verinice.xml && \
cd $TMP && zip - *
cd $STARTDIR
rm -r $TMP
