FastNetMon Advanced JSON notify script in Python

This script implements an example notify script in Python, which implements a JSON interface for FastNetMon Advanced.

Please note: The JSON-based script uses different arguments from the text-based notify script.

This script is implemented in Python and does not need any additional libraries.

You can find a detailed description of all data formats used by FastNetMon to pass information about attacks here.

It prints all information received from FastNetMon to a log file /tmp/fastnetmon_notify_script.log. Download an example notify script from GitHub:

wget https://raw.githubusercontent.com/FastNetMon/fastnetmon_notify_python/main/notify_json.py

Insert it into file:

sudo cp notify_json.py /usr/local/bin/notify_json.py

And set executable bit for it:

sudo chmod +x /usr/local/bin/notify_json.py

You need to use the following mode from FastNetMon to use this script properly:

sudo fcli set main notify_script_enabled enable
sudo fcli set main notify_script_format json
sudo fcli set main notify_script_path /usr/local/bin/notify_json.py
sudo fcli commit

More documentation about JSON formats can be found here.

Attack status information

Starting from version 2.0.359, FastNetMon has the capability to call notify script for all blocked IPs (IPv4+IPv6) and pass attack details to it. Please note that attack performance is not updated in this case; we plan to add this capability in future releases.

This capability can be enabled this way;

sudo fcli set main notify_script_attack_status_updates true
sudo fcli commit

You can configure how often FastNetMon runs this logic in seconds in the following way:

sudo fcli set main ban_status_delay 20
sudo fcli commit