diff --git a/bin/.bin/nessus-html-to-spreadsheet b/bin/.bin/nessus-html-to-spreadsheet new file mode 100755 index 00000000..2581e72f --- /dev/null +++ b/bin/.bin/nessus-html-to-spreadsheet @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# replaces " with \" +echoescaped(){ + echo -n '"' + echo "$@" | sed 's/"/\\"/g' + echo -n '"' +} +printRow(){ + local id="$1" + local title="$(echo "$container" | hq "#$id" text)" + local -a headings + local -a bodys + + while IFS= read -rd '' heading; do + headings+=("$heading") + done < <( echo "$container" | hq "#${id}-container" data |\ + hq -0 '.details-header' text ) + while IFS= read -rd '' body; do + bodys+=("$body") + done < <( echo "$container" | hq "#${id}-container" data |\ + hq -0 '.details-header + div' text ) + + # For some reason the html output doesn't put the observed bit in a div like + # the others + local observed="$(echo "$container" | hq "#${id}-container" data |\ + sed -n '/