egorsmkv / fail2ban-scripts

This is a simple python code to get the list of banned IP addresses from Fail2ban

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail2ban Scripts

Usage banned_list.py

This script tries to get the banned list of IP addresses by Fail2ban for the service freeswitch.

You can modify the service name if you want to.

python ./banned_list.py freeswitch

In the response you will get JSON output with the following (data can be different, of course):

{"currently_banned": 11, "total_banned": 15, "banned_ips": ["185.108.106.105", "193.46.255.195", "193.46.255.214", "196.196.203.86", "52.232.132.24", "103.145.13.81", "23.148.145.210", "103.145.13.247", "141.98.10.188", "45.34.5.54", "40.86.206.158"]}

Usage unban.py

This script tries to unban an IP address.

You can modify the IP address if you want to.

python ./unban.py 185.108.106.105

In the response you will get JSON output with the following (data can be different, of course):

{"success": true}

or this (if the IP address is incorrect):

{"error": true, "reason": "it seems IP does not exist"}

About

This is a simple python code to get the list of banned IP addresses from Fail2ban

License:Other


Languages

Language:Python 100.0%