Merge pull request #293 from SietsevanderMolen/fix-json

fix json output
This commit is contained in:
Dirk Wetter 2016-02-12 15:11:45 +01:00
commit 79445ebe5b

View File

@ -453,23 +453,22 @@ fileout_footer() {
} }
fileout() { # ID, SEVERITY, FINDING fileout() { # ID, SEVERITY, FINDING
local finding="$5" local finding=$(strip_lf "$(newline_to_spaces "$(strip_quote "$3")")")
if "$do_json"; then if "$do_json"; then
"$FIRST_FINDING" || echo "," >> $JSONFILE "$FIRST_FINDING" || echo "," >> $JSONFILE
finding=$(strip_quote "$3")
echo -e " echo -e "
{ {
'id' : '$1', \"id\" : \"$1\",
'ip' : '$NODE/$NODEIP', \"ip\" : \"$NODE/$NODEIP\",
'port' : '$PORT', \"port\" : \"$PORT\",
'severity' : '$2', \"severity\" : \"$2\",
'finding' : '$finding' \"finding\" : \"$finding\"
}" >> $JSONFILE }" >> $JSONFILE
fi fi
# does the following do any sanitization? # does the following do any sanitization?
if "$do_csv"; then if "$do_csv"; then
echo -e \""$1\"",\"$NODE/$NODEIP\",\"$PORT"\",\""$2"\",\"$(strip_quote "$3")\"" >>$CSVFILE echo -e \""$1\"",\"$NODE/$NODEIP\",\"$PORT"\",\""$2"\",\""$finding"\"" >>$CSVFILE
fi fi
"$FIRST_FINDING" && FIRST_FINDING=false "$FIRST_FINDING" && FIRST_FINDING=false
} }