back to scripts

person-friendly-report.sh

bash 38 lines secrets redacted

Rewrites raw technical output into a plain-English report a human actually wants to read.

Note Live script from my home-lab server. Tokens, IDs, phone numbers and other secrets have been replaced with placeholders like <WHATSAPP_GROUP_ID> — everything else is the real, running code.
#!/usr/bin/env bash
set -euo pipefail

kind=${1:-general}
raw_file=${2:-}
if [ -z "$raw_file" ] || [ ! -f "$raw_file" ]; then
  echo "Usage: person-friendly-report.sh <kind> <raw-report-file>" >&2
  exit 2
fi

case "$kind" in
  cyber-watch)
    if grep -q 'No external brute-force candidates detected' "$raw_file"; then
      echo "Cyber check: no external SSH brute-force activity detected in the latest window."
      echo "Impact: no immediate action needed."
    else
      echo "Cyber check: possible external SSH brute-force activity found."
      echo "Impact: review is needed before any blocking or shutdown action."
    fi
    echo "Raw report: $raw_file"
    ;;
  cve)
    high_critical=$(grep -E 'CRITICAL|HIGH' "$raw_file" | wc -l || true)
    echo "CVE check: Docker image vulnerability scan completed."
    echo "Impact: $high_critical HIGH/CRITICAL result lines found. Cyber Analyst should review and raise patch tickets where needed."
    echo "Raw report: $raw_file"
    ;;
  av)
    infected=$(grep -E 'Infected files:|FOUND' "$raw_file" | tail -5 | tr '\n' '; ')
    echo "AV scan: completed."
    echo "Impact: ${infected:-no infection summary found in output}."
    echo "Raw report: $raw_file"
    ;;
  *)
    echo "Report completed."
    echo "Raw report: $raw_file"
    ;;
esac

back to scripts