From b65521d46c5642e07d07d9f48c60c85ee24b6b5b Mon Sep 17 00:00:00 2001 From: Felix Schueren Date: Tue, 4 Nov 2025 23:36:08 +0100 Subject: [PATCH] add more helpers --- helpers/csv2cards.sh | 44 ++++++++++++++++++++++++++++++++++ helpers/online-users-to-csv.sh | 1 + 2 files changed, 45 insertions(+) create mode 100644 helpers/csv2cards.sh create mode 100644 helpers/online-users-to-csv.sh diff --git a/helpers/csv2cards.sh b/helpers/csv2cards.sh new file mode 100644 index 0000000..ac6ef4f --- /dev/null +++ b/helpers/csv2cards.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# csv2cards.sh → html +CSV=${1:-credentials.csv} +OUT=${2:-cards.html} + +# start the document +cat >"$OUT" <<'EOF' + + + + +Credentials cards + + + +EOF + +# read CSV, skip header, emit a
per line +awk -F',' 'NR>1{ + printf "
\n" + printf "
IP: %s
\n", $1 + printf "
Host: %s
\n", $2 + printf "
User: %s
\n", $3 + printf "
Pass: %s
\n", $4 + printf "
\n" +}' "$CSV" >>"$OUT" + +# close the document +cat >>"$OUT" <<'EOF' + + +EOF \ No newline at end of file diff --git a/helpers/online-users-to-csv.sh b/helpers/online-users-to-csv.sh new file mode 100644 index 0000000..d88702a --- /dev/null +++ b/helpers/online-users-to-csv.sh @@ -0,0 +1 @@ +(echo "IP,host,username,pwd"; cat online-users.txt | awk -F' +' 'BEGIN{OFS=","} {$1=$1; print}') > credentials.csv \ No newline at end of file