View Single Post
Author Message
bottiger
AlliedModders Donor
Join Date: Dec 2010
Old 08-31-2013 , 03:23   CIDR Block - Block IP ranges for countries, hackers
Reply With Quote #1

Instructions

Have you ever needed to block a hacker that keeps getting a new IP? Have you ever needed to block an entire country? This plugin will do the job.

You can make ban lists with websites like this.

https://www.countryipblocks.net/country_selection.php

The default ban list path is configs/ipblocks.txt

Code:
# example ban list
1.2.3.4/28
4.5.6.7/18
# network 2
5.6.7.8/31
Here is a quick CIDR tutorial.

1.2.3.4/32 = blocks 1.2.3.4 - 1.2.3.4
1.2.3.4/24 = blocks 1.2.3.0 - 1.2.3.255
1.2.3.4/16 = blocks 1.2.0.0 - 1.2.255.255
1.2.3.4/8 = blocks 1.0.0.0 - 1.255.255.255

You can also use the command cidr_add to add blocks in game that will last until a reboot.

Convars

CreateConVar("cidr_path", "configs/ipblocks.txt", "Path to block list.");

Commands

RegAdminCmd("cidr_reload", Command_Reload, ADMFLAG_BAN, "Clear banlist and reload bans from file.");
RegAdminCmd("cidr_clear", Command_Clear, ADMFLAG_BAN, "Clear banlist.");
RegAdminCmd("cidr_add", Command_Add, ADMFLAG_BAN, "Add CIDR to banlist. Does not last between reboots and does not get added to file.");
Attached Files
File Type: sp Get Plugin or Get Source (cidr.sp - 1586 views - 4.2 KB)
__________________
bottiger is offline