I wrote a bash script for this purpose a while ago, you can use it and change it as you please:
[code]#!/bin/bash # Aim: submit manually created Open-Audit files to Auditserver # # usage example: find * -name '*.xml' -exec ls submit_host.sh {} \;
AUDIT_URL=<URL to auditserver>/index.php/system/add_system EXPECTED_ARGS=1 WGET=`which wget`
if [ $# -ne $EXPECTED_ARGS ] then echo "Usage: $0 hostname-<date>.xml" exit $E_BADARGS fi
# append metadata #form_systemXML= sed -i '1s/^/form_systemXML=/' "$1"
# fix special chars sed -i -e 's/+/%2B/g' "$1" sed -i -e 's/"/%22/g' "$1" sed -i -e 's/&/%26/g' "$1"
$WGET --post-file=$1 $AUDIT_URL 2>/dev/null
# switch back to std xml sed -i -e 's/form_systemXML=//g' "$1" sed -i -e 's/%2B/+/g' "$1" sed -i -e 's/%22/"/g' "$1" sed -i -e 's/%26/&/g' "$1" [/code]
_________________ Server Info: OS : Ubuntu 14.04 Auditing: ~ 500 machines (35 Windows Server, 440 Linux Server) LDAP: not yet Version: Open-AudIT Version 1.8.4
|