#!/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 version 2,
# or, at your option, any later version as published by the Free
# Software Foundation
#
# 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 ./gsm_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 ./gsm_verinice_itg.xsl $1 | \
        sed -e "s/\ xmlns=\"\"//g" | \
        xmlstarlet fo >  $TMP/verinice.xml && \
cd $TMP && zip - *
cd $STARTDIR
rm -r $TMP
