Files
microdao-daarion/security/notify.sh
Apple 744c149300
Some checks failed
Build and Deploy Docs / build-and-deploy (push) Has been cancelled
Add automated session logging system
- Created logs/ structure (sessions, operations, incidents)
- Added session-start/log/end scripts
- Installed Git hooks for auto-logging commits/pushes
- Added shell integration for zsh
- Created CHANGELOG.md
- Documented today's session (2026-01-10)
2026-01-10 04:53:17 -08:00

48 lines
1.4 KiB
Bash

#!/bin/bash
# ============================================
# Security Notifier — DAARION
# Version: 1.0.0
# Purpose: Send security alerts and reports to Telegram/Email
# ============================================
# Configuration (Fill these or set via ENV)
TOKEN="${TELEGRAM_BOT_TOKEN:-8112062582:AAGI7tPFo4gvZ6bfbkFu9miq5GdAH2_LvcM}"
CHAT_ID="${TELEGRAM_CHAT_ID:-}" # YOUR CHAT ID HERE
send_telegram_msg() {
local message="$1"
if [ -n "$CHAT_ID" ]; then
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendMessage" \
-d "chat_id=$CHAT_ID" \
-d "text=$message" \
-d "parse_mode=Markdown" > /dev/null
fi
}
send_telegram_doc() {
local doc_path="$1"
local caption="$2"
if [ -n "$CHAT_ID" ] && [ -f "$doc_path" ]; then
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendDocument" \
-F "chat_id=$CHAT_ID" \
-F "document=@$doc_path" \
-F "caption=$caption" > /dev/null
fi
}
# Usage examples:
# ./notify.sh --msg "🚨 *Alert:* Potential miner detected on NODE1"
# ./notify.sh --doc "/path/to/report.md" "🛡️ Security Audit Report"
case "$1" in
--msg)
send_telegram_msg "$2"
;;
--doc)
send_telegram_doc "$2" "$3"
;;
*)
echo "Usage: $0 [--msg 'message'] [--doc '/path/to/file' 'caption']"
;;
esac