2611.1
This commit is contained in:
1 parent
c929b299bf
commit
0fdc1facfa
2 files changed
+148
-11
No files matched your search
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Self-check for the Discord webhook helpers: bash test_webhook.sh
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=network-config.sh
|
||||
source "$SCRIPT_DIR/network-config.sh"
|
||||
|
||||
line='{"timestamp":"2026-11-05T12:00:00Z","src_ip":"1.2.3.4","dst_port":8080}'
|
||||
msg=$(webhook_msg "$line") || { echo "FAIL: valid line rejected"; exit 1; }
|
||||
echo "$msg" | grep -q "1.2.3.4" || { echo "FAIL: src_ip missing from: $msg"; exit 1; }
|
||||
echo "$msg" | grep -q "8080" || { echo "FAIL: dst_port missing from: $msg"; exit 1; }
|
||||
|
||||
if webhook_msg 'not json' >/dev/null; then
|
||||
echo "FAIL: invalid line accepted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: $msg"
|
||||
Reference in new issue
Block a user