So, I want to present to your attention a script that I created for you. It may not do everything all that you hoped it would, but in my opinion, this script does a good job of most of the things you would like to see.
This script will set a ban (ZLINE) on all incoming connections for those users whose host matches the host mask on the blacklist. Provided that the bot in which you install this code will have the privileges of IRCop Snomask (+cC
The screenshot shows how I tried to simulate a user connecting from different host addresses, and that the script returns to me in echo-response when it found the user's host that matched the mask on the blacklist shown in the screenshot to the right. Each line in the screenshot shows the user's nickname, his host, line number and mask that were found in the black list:
Now to a description of how it works. In the alias "cbl_data
" you can configure all the necessary data to your liking. I think everything is clear here. But, just in case, I will give a help so that there are no questions: %cbl_logo
| ;This value specifies the script logo for the message, so that it is clear from which script this line is. %cbl_path
| ;This is the path to your blacklist. It can be changed to a place convenient for you. %cbl_btype
| ;Here you specify the type of server ban that you want the script to execute if the host matches the mask. Possible options: <ZLINE/KLINE/GLINE> %cbl_btime
| ;Here, specify the time for which you want to ban the offender. Format: <1y/2w/3d/4h/5m/6s> %cbl_reason
= Possible "VPN/Tor/Proxy"
| ;Here you can indicate the reason for the ban, as well as indicate an email so that in case of an error you can be contacted to unblock.
At the very bottom, in the alias "cbl_return
", you can enable the type of messages through which you want to receive notifications when the script reacts to the intruder when connecting to the server. Just remove the ";
" from the lines that should work. As a parameter "AdminNick
" you must indicate the nickname of the administrator, to whom to send this message or your nickname. You can comment out these lines with a ";
" because if this channel or nickname does not exist on the network you will get an error "No such nick/channel
". You can also add your own commands as you see fit.
About filling in the black list. The check is performed according to the list, sequentially adding each part of the user's host, which is separated by periods. Therefore, it is recommended to set the "*
" sign in the mask before the point or after. The most complex host masks, such as "*.hsi13.*
" or "*.cn
", recommended to write at the very top so that they come first. Otherwise it may not always work. Try to keep your blacklist more compact by using the subnet masks you want to banned, and watch for duplicates so that there are no identical addresses in the list.Installing:
Uncover the spoiler. This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R
", select "File/New
" and install as a new script and then save it entitled name "CheckHostBL.mrc
Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.
If you find any errors in the code and in its work, or maybe you have new ideas or if you think that this script needs to be improved, then be sure to write to me here about it, and we are together think about what we can do.