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