Please be aware. This script was created for excersice reasons only. Using this script in a production/home system can lead to problems if the attacker is smart enough. This is NOT a sophisticated tool to protect your system.
The script captures IPs from log files where a root SSH connection has been attempted. It then blacklists those IPs by creating a firewall for them. All the blacklisted IPs are inserted into a master file. The master file is being updated with new unique IPs each time the script is run. There are tools that already do this type of tasks in a much more elaborate manner….but hey…I like scripting 🙂