Custom Filters

AntiAdvertiser blocks the basic advertisers by default ("Join my server at 127.0.0.1!"). But because more and more servers have anti-advertising plugins, some advertisers try bypassing the default filters.

AntiAdvertiser lets you define custom filters which can be as sensitive as you'd like.

Blacklisting Words and Phrases

You can easily add words and phrases to the blacklist. For example, by setting blacklist to the following, the plugin would prevent players from saying "Join my server" or "zapto" (a lot of servers are using something.zapto.org as their IP):

blacklist:
- join my server
- zapto

Regex Blacklist

The word filtering may not be enough for you. You can also create regular expressions to be treated as advertising. Creating custom regular expressions is not recommended if you aren't familiar with them - a simple misplaced dot may prevent your players from saying anything at all.

Adding Regular Expressions

To add a regular expression to the blacklist, the regex needs to be prefixed with "regex:". For example, if we tell you to add "([A-Za-z0-9]{1,5})" to the list, your configuration file would look something like:

blacklist:
- regex:([A-Za-z0-9]{1,5})

Please note that the message is converted to lowercase before being checked for blacklist - that means your regexes either need to be case-insensitive or lowercase.

The examples on this page for domains only block .com, .org and .net domains. A future version of AntiAdvertiser will allow you to add a variable to catch all TLDs.

Replacing dots with spaces

An advertiser may replace dots in their IP address with spaces, so "Join 127.0.0.1 for free diamonds!" would become "Join 127 0 0 1 for free diamonds!". AntiAdvertiser will by default not block this (we don't want our filters to be too sensitive), however we will not stop you from blocking it.

To also detect IP addresses that have spaces instead of dots, you would add the following regular expression to the blacklist:

([0-9]{1,3} [0-9]{1,3} [0-9]{1,3} [0-9]{1,3})

To detect some of the common domain names, also add the following two regexes to the blacklist in addition to the above one:

(mc|play|server){2,30} ([a-z0-9]) (com|org|net)
([a-z0-9]) (zapto|no-ip|noip) (com|org|net)

The first regular expression blocks the common subdomains ("mc.example.com", "play.example.com" and "server.example.com") and the second one blocks the free subdomains (such as "example.zapto.org").

Replacing dots with commas (IP)

Similarly, advertisers may replace the dots with commas, in which case "Join 127.0.0.1 for free OP!" would become "Join 127,0,0,1 for free OP!". This type of advertising is also not blocked by default.

To detect IP addresses that have commas instead of dots, add the following regex to the blacklist:

([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3})

Similarly, add the following regular expressions to block domains:

(mc|play|server),([a-z0-9]){2,30},(com|org|net)
([a-z0-9]),(zapto|no-ip|noip),(com|org|net)

Adding extra dots

Some advertisers add extra dots to bypass filters, so "Join 127.0.0.1" becomes "Join 127...0...0...1" - that would be seen as an invalid IP address and wouldn't be blocked.

To detect such advertisers, add the following regular expression for IP addresses:

([0-9]{1,3}\.\.*[0-9]{1,3}\.\.*[0-9]{1,3}\.*[0-9]{1,3})

Similarly, add the following regex for domain names:

([a-z0-9])\.\.*(com|org|net)

Comments

Posts Quoted:
Reply
Clear All Quotes