From b94dd5e62dd92c829aeee1ba4217d9e174ad922f Mon Sep 17 00:00:00 2001 From: Ronan Daly Date: Tue, 9 Aug 2016 18:56:35 +0100 Subject: [PATCH] Added a script for Slack notifications called notify_with_slack.sh --- src/scripts/notify_with_slack.sh | 94 ++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 src/scripts/notify_with_slack.sh diff --git a/src/scripts/notify_with_slack.sh b/src/scripts/notify_with_slack.sh new file mode 100755 index 00000000..d75c368b --- /dev/null +++ b/src/scripts/notify_with_slack.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +# +# Hello, lovely FastNetMon customer! I'm really happy to see you here! +# Pavel Odintsov, author +# +# +# Instructions: +# +# Copy this script to /usr/local/bin/ +# Edit /etc/fastnetmon.conf and set: +# notify_script_path = /usr/local/bin/notify_with_slack.sh +# +# Add your email address to email_notify. +# +# Add your Slack incoming webhook to slack_url. +# slack_url="https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXXX/LXXXXXXXXX" +# +# Notes: +# hostname lookup requires the dig command. +# Debian: apt-get install dnsutils +# Redhat: yum install bind-utils + +# +# For ban and attack_details actions we will receive attack details to stdin +# if option notify_script_pass_details enabled in FastNetMon's configuration file +# +# If you do not need this details, please set option notify_script_pass_details to "no". +# +# Please do not remove the following command if you have notify_script_pass_details enabled, because +# FastNetMon will crash in this case (it expect read of data from script side). +# + +if [ "$4" = "ban" ] || [ "$4" = "attack_details" ]; then + fastnetmon_output=$(