From 3da5389128bdaca57766ff22b001842a97048f30 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 13 Feb 2021 20:21:34 +0000 Subject: [PATCH] Add script for turning nessus html to spreadsheet --- bin/.bin/nessus-html-to-spreadsheet | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 bin/.bin/nessus-html-to-spreadsheet 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 '/