add more helpers
This commit is contained in:
44
helpers/csv2cards.sh
Normal file
44
helpers/csv2cards.sh
Normal file
@@ -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'
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Credentials cards</title>
|
||||
<style>
|
||||
@page { size: A4 portrait; margin: 1cm; }
|
||||
body { font-family: monospace; display: flex; flex-wrap: wrap; gap: 0.5cm; }
|
||||
.card {
|
||||
width: 9cm; /* fits 2‑3 cards across A4 */
|
||||
border: 1px solid #333;
|
||||
padding: 0.3cm;
|
||||
box-sizing: border-box;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.field { margin: 0.1cm 0; }
|
||||
.label { font-weight: bold; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
EOF
|
||||
|
||||
# read CSV, skip header, emit a <div class="card"> per line
|
||||
awk -F',' 'NR>1{
|
||||
printf "<div class=\"card\">\n"
|
||||
printf " <div class=\"field\"><span class=\"label\">IP:</span> %s</div>\n", $1
|
||||
printf " <div class=\"field\"><span class=\"label\">Host:</span> %s</div>\n", $2
|
||||
printf " <div class=\"field\"><span class=\"label\">User:</span> %s</div>\n", $3
|
||||
printf " <div class=\"field\"><span class=\"label\">Pass:</span> %s</div>\n", $4
|
||||
printf "</div>\n"
|
||||
}' "$CSV" >>"$OUT"
|
||||
|
||||
# close the document
|
||||
cat >>"$OUT" <<'EOF'
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
1
helpers/online-users-to-csv.sh
Normal file
1
helpers/online-users-to-csv.sh
Normal file
@@ -0,0 +1 @@
|
||||
(echo "IP,host,username,pwd"; cat online-users.txt | awk -F' +' 'BEGIN{OFS=","} {$1=$1; print}') > credentials.csv
|
||||
Reference in New Issue
Block a user