Just a notify script for Fastnetmon, when fastnetmon takes any action, script sends messages to Telegram.
When the ban action occurs, fastnetmon sends two messages in a row to script's stdin, for example:
192.0.2.0 incoming 2059522 ban
192.0.2.0 incoming 2059522 attack_details
The second action is not processed in any way(in community edition) by fastnetmon, it just doesn't send the attack_details.
Script will find attack_details in the logs and send them as images, why image? cause details are enormous. It is not convenient to read large text in a telegram.
pip3 install htmlwebshot
apt install wkhtmltopdf
# dependency for htmlwebshot
Edit in script body a few variables:
- Telegram settings (CHAT_ID|BOT_TOKEN)
- Templates (MSG_TEMPLATE|HTML_TEMPLATE)