ServerSpam: stop players from advertising IP addresses
======================================================	version 1.0
														by "adminthis"

Overview:
#########
Scenario: You have spent hours upon hours building your server, perfecting and tweaking it like there's no tomorrow. Only for a nasty person to come along that starts advertising his inferior server in an attempt to steal players away.... Not anymore.

This serverside mutator checks each message for an IP address. If found, the message will be discarded. It is highly configurable to make it suit your needs, no matter what those needs might be. Features include:

* Choose between 'normal' mode which checks for IP addresses in the traditional notation (*.*.*.*) or go balls to the wall in the 'HARDCORE' mode which makes sure no one can get their IP address through no matter how hard they try.
* Swallow messages in whole, or only show the message to the offending player; thus giving a false sense of accomplishment to said player.
* Optionally inform players why their message was swallowed (using your own message).
* Optionally kick offending players.
* Optionally only enforce filtering for a limited amount of time (e.g.: only players that have been on the server for less than a minute get their messages checked).
* Optionally whitelist allowed IP addresses.


History:
########
version 1.0 [29-9-2008]
- Initial release.


Installation:
#############
Extract 'ServerSpam.u', 'ServerSpam.int' and 'ServerSpam.ini' to the ..\UnrealTournament\System folder of your server.
The mutator can be loaded as "ND_SS". Do NOT add it to your 'ServerPackages'.

You can either select the mutator from within the game, use webadmin or load from the commandline.
To load from the commandline, use: ServerSpam.ServerSpam


Configuration:
##############
The file ServerSpam.ini contains the settings.

SecondsOnServer [default value: 0]
----------------------------------
Enter the amount of seconds you want a player to be blocked from sending messages containing an IP address. An example where you might want to use this, is when you are frequently visited by spammers. Generally they tend to join, do their spamming and leave. In such cases it could help to set this value to 60 (one minute). That way, only players that have been on the server for less than 1 minute aren't allowed to send messages containing an IP address. Set to 0 to disable this feature (block is active indefinitely).

bHardcore [default value: False]
-------------------------------
The mutator can operate in two detection modes: 'normal' which is the default setting, or 'hardcore' by changing the value to True. In the normal mode, IP addresses are detected as sequences that look like the traditional notation of an IP address; i.e.: four octets separated by four dots (e.g.: 1.2.3.4). However, this is easily circumvented. One could, for instance, advertise the IP address using spaces instead of dots (e.g.: 1 2 3 4). In normal mode, this type of circumvention is not detected. However, normal mode should be sufficient to catch all standard IP addresses finding their way into your chatstream.

For the truly dedicated fuckers, there's the HARDCORE mode (bHardcore=True). In this mode each message is checked not just for the standard notation, but also for all (easily understandable) variations thereof. Examples of messages that are detected in this mode, but not in normal mode, include:
1 2 3 4
1-2-3-4
1 i 2 like 3 this 4 mutator
etc.
Due to the detection algorithm, the hardcore mode is slightly more prone to error (false positives) than the normal mode. Mainly, if your players like to use lots of numbers in their messages you might want to shy away from using this mode. It's recommended to only use this mode if there are players actively bypassing the filter. With that said, using hardcore mode should be without problem in most situations.

bHideForAll [default value: True]
---------------------------------
If True, an offending message will be swallowed for all players. If False, however, the message will be swallowed for all players -except- the sender. This can be done for a cosmetic purpose; showing the player's message accompanied by the BlockedMsg, or it can be used for an approach that reeks of "security through obscurity". By setting this to False and consequently setting bMsg=False and bKick=False, it will appear to the offending player that his spam message was successfully delivered to all other players, whilst it's actually not!

bKick [default value: False]
----------------------------
Set to True to disconnect a player that sends a spam message.

bMsg [default value: True]
--------------------------
Sends the message specified as "BlockMsg=" to the offending player.

BlockMsg [default value: The advertising of IP addresses is not allowed on this server.]
----------------------------------------------------------------------------------------
This is the message that's sent to an offending player if bMsg=True.

AllowedList[x]
--------------
Enter up to 32 IP addresses that should be whitelisted. Any message containing an IP address that is on the whitelist (that being AllowedList[x]) is allowed. The message is still checked for other (un)allowed IP addresses and swallowed if necessary. Do not leave gaps between entries (e.g.: when you have specified an IP address for AllowedList[0], the next entry should be placed in AllowedList[1]).


Notes:
######
Source code is available in the ../Source folder. I hope this is of help to others, just as their code was of help to me :)


Credits/Questions:
##################
nogginBasher in particular for all his (publicly available? ;)) work... and all others whose code examples have been of invaluable help!

If you've got a question, suggestion or bugreport, please post in the appropriate topic at http://www.unrealadmin.org/forums/ or send me, that is "adminthis", a PM on aforementioned website.