[TAC] Stop Country Spam

[TAC] Stop Country Spam [Paid] 3.1.5

No permission to buy ($19.00)

tenants

Well-known member
This is included in Both
i) Free (Branded) Tac Anti Spam Collection
ii) Paid (unbranded) Tac Anti Spam Collection

tenants submitted a new resource:
StopCountrySpamACP.webp reg.webpLog1StopCountrySpam.webpLog2StopCountrySpam.webp
StopCountrySpam (version 1.0.0) - Black/white list country IP addresses from registering

Stop Country Spam - black/white list country IP addresses from registering

If you're in the same position as me, and you've noticed that quite a lot of "spammers" are coming from particular countries (from checking the user info, clicking the IP address returns the geo-location via whatismyipaddress.com), and your forum isn't even relevant to those countries, then this plug-in can help

Do not use this if you do not want to block any countries from registering on your forum (a lot of forums...

To Do List
(Let me know)
i) An option in the ACP to point to a customisable template when users are blocked form registering - done v1.0.2
ii) Tick box in the ACP to make it easy to select contries - done v1.0.3
iii) Log "Stop Country Spam" events in the ACP - done v1.0.4
iv) Do not log further entries for already logged email addresses - done
v) Do not log further entries for already logged usernames - done
vi) Do not log further entries for already logged ip addresses - done

Bugs to Fix
(Let me know)


Read more about this resource...
 
After installing, to test this (this wont work on your local host, this has to be tested on your live website)

i) Go to your admin control panel >> options >> StopCountrySpam and select "Black List"
ii) Find 1 or more countries that you have lots of spam from and that you no long want users to register from (look at your previous banned users for ideas) and multi-select these countries from the "Select Countries" field and save the changes
iii) Now attempt to register on your forum, everything should be okay (as long as you haven't black listed your own country)
iv) Now Go to a site that provides proxies (hidemyass.com/proxy-list/ can be used) and use the proxy for your given black listed country (In Firefox: Tools >> Advance >> Network >> Settings >> Manual)
v) Attempt to register (these proxies can often be a bit slow) >> New registrations are currently not being accepted.

- Don't forget to turn your proxy settings back to Auto / No Proxy (or however it was before).
 
ah... if you find you can't register (because I blocked your country), let me know and I'll turn it off for a while (or even better, let me know what country you are from so I can remove it from the black list)
 
What do you use to find out the country? An online database or an integrated one?
An integrated one would have to be constantly updated, not an easy task.. So it points to an online free database, and this location is customisable...

It requires a JSON request to look up the IP address of the country, and that JSON response needs to return the ISO 3166 two digit country code for the given IP address

The JSON response can be defined in the admin control panel, and the index for this response can be defined.

For example, in the admin control panel, you can define
JSON Request: http://freegeoip.net/json/{$ip}
Index Name: country_code

So if you go to: http://freegeoip.net/json/194.186.187.194
You'll see that the ISO 3166 two digit country is returned as: "country_code2":"RU"

(This is not an example of a country you should ban.. this is just an example).

If this JSON request location is not particulary good / out of date, then it can be updated with another source
The JSON request site above uses the free geolite database: http://www.maxmind.com/app/geolite

I would imagine the towns are sometimes out of date, but the country codes are rarely ever out of date. For easyjquery, he quotes :
Our IP Database have accuracy over 99.6% on a country level and 80% on a city level with monthly updating. Enjoy Free Geo IP Database
http://www.easyjquery.com/detect-get-clients-ip-address-country-using-javascript-php/

However, since the JSON request location is definable, you don't need to be restricted to just using this one

A list of some request JSON Geolocation sites you should be able to use:

JSON Request: http://api.easyjquery.com/ips/?ip="{$ip}"&full=true (now tested and supported)
Index Name: countryCode2


JSON Request: http://ip2country.sourceforge.net/ip2c.php?format=JSON&ip={$ip} (now tested and supported)
Index Name: country_code


JSON Request: http://freegeoip.net/json/{$ip} (now tested and supported)
Index Name: country_code

JSON Request: http://smart-ip.net/geoip-json/{$ip} (now tested and supported)
Index Name: countryCode

JSON Request: http://api.ipinfodb.com/v3/ip-country/?key=XXX&ip={$ip}&format=json (untested)
... you will need to request a key from this site before using (and use this key in your JSON request string, instead of XXX)
Index Name: countryCode

JSON Request: http://api.wipmania.com/{$ip} (now tested and supported)
Index Name: (none)

And if you register, they provide you a key for free
JSON Request: http://api.wipmania.com/{$ip}?k=XXX&t=json (now tested and supported)
Index Name: country['code']

JSON Request: http://www.codehelper.io/api/ips/?json&ip={ip}
Index Name: CountryCode2
(untested)

<= it's worth noting, this plug-in now supports JSON responses with nested indexes, for instance:
Index Name: index1['index2']['index3']['index4']
Now with the addition of nested, no-index, unquoted index JSON responses, I believe this should support almost every JSON country IP request

Wipmania looks particulary good, since they offer infinate requests, regular updates and its free, see here: http://www.wipmania.com/en/api/#apitab_wie_a
They also have paid versions which is more reliable, the free version only returns the country code (that's all StopCountrySpam requires)


I'm currently using Wipmania as a registered user, using their provided key (since this is free, reliable and allows infinite requests), I would recommend using this one

Some of these request sites have a limitied number of request per day (for instance, smart-ip only allows 5000). So forums with many daily registers shouldn't be using the free JSON request sites.
 
Last edited:
Some of the above JSON examples don't wrap the keys in quotes (which is incorrect for a JSON response), I'm making a fix to handle these irregular responses next version.
Next version will also handle 404s/exceptions from the JSON site and by default just allow users to register (you don't want to stop people from registering just because the third party site is down)
 
After handling the irregular JSON responses (indexes without quotes), 4/4 of the above JSON requests sites work with StopCountrySpam
 
Just a suggestion - is it possible for the error page to actually say something different? It might be good for some to have an email they can send to if they feel they are being blocked for no reason (that is, the rare good registration from certain countries).
 
I was considering doing that, but this might allow a higher % of spammers to suspect there is a reason they can't register (and research why / try various proxies).
This is the core "new_registrations_currently_not_being_accepted" page, using anything other than that might suggest that this plug-in is being used

As soon as you add a template with custom css / custom js / non default class names, it becomes easy to detect what plug-ins the forum is using
Once they know this, they know how to bypass it (which is fairly easy to do, and they might try anyway)

However, if you think that the benefits out weigh the cost, I can do this as an option (I'll make it as simple as I can, using just a phrase, but I would suggest changing the phrase)

To Do => An option in the ACP to point to a customisable template when users are blocked from registering
 
My thoughts are that unwanted registrations consist of two types...

1. Spammers, backlinkers, etc. - this is probably 98% or more of my unwanted registrations...

2. Someone who really cares about your board (as opposed to the list of 1,000 they are going through) for whatever reason.

#2 probably represents a very tiny percentage of most boards. They are the only folks who would attempt to use proxies, etc. - #1's will move on.

I guess it would be good to hear from others to see if my thoughts on the above are the same with other boards. If so, then a custom error message with "sorry, you cannot register at this time - please email or use contact form (or link to contact form) if you suspect this is in error" (or something like that).
 
I guess it would be good to hear from others to see if my thoughts on the above are the same with other boards. If so, then a custom error message with "sorry, you cannot register at this time ....

Okay, well I've added it as an option in this version anyway.

Just released v1.0.2, there is now an an option to select a customisable template (StopCountrySpam_BannedMsg) for your country banned message. The message in this template is:
"Your country has been blocked from registering, if you believe this is a mistake and would like to contact the administrator contact us here: contact us" << I would recommend editing the StopCountrySpam_BannedMsg and customising this message


It now also supports more of the JSON sites above... if the JSON stuff has confused anyone, don't worry, most fourm admins can just leave the default strings, this is more useful for forums with many sign ups everyday, or if the request site is no longer working/old (you start getting users from the suspect countries again)

Supports more JSON response types, including Nested responses:
index1['index2']['index3']['index4'], for example Index Name: country['code']

Supports response with no index (single 2 digit coutry code returned from http://api.wipmania.com/{$ip} )
 
This Add-on is a must for large communities against human spammers, black listing using country name and code is a time saver.

in case I black listed multiple countries I realy need to remember the names of those countries to white list any of them later if needed, is it possible to make this Add-on list the names black listed countries or make the black listed countries names with red color to differentiate between the blaklisted and the whitelisted?
 
This Add-on is a must for large communities, black listing using country name and code is a time saver.

in case I black listed multiple countries I realy need to remember the names of those countries to white list any of them later if needed, is it possible to make this Add-on list the names black listed countries or make the black listed countries names with red color to differentiate between the blaklisted and the whitelisted?

After you have black listed the contries, they should remain highlighted like this:
blacklist.webp
But you're saying you might want to switch to white listing later (so a list to copy and paste and then re-do it might be useful)
Wouldn't it be more useful to have a button to "invert selection" when you want to white list / black list (this would save you having to click and reselect the countries again)
 
After you have black listed the contries, they should remain highlighted like this:
View attachment 35203

They didnt remain highlighted, only the last selection remain highlighted


Wouldn't it be more useful to have a button to "invert selection" when you want to white list / black list (this would save you having to click and reselect the countries again)

a button to "invert selection" for each blacklisted country? if that can do the job to select which country i want whitelist then it would be ok as long it will not effect the simplisity of the Add-on interface design

I realy love this Add-on and i been asking for it years ago when i was on vBulletin :)
 
Did you hold down ctrl or shift when mouse clicking and selecting the contries

I didnt, because i asume i will blacklist any country when only i start get spam from that country so the last selection only will always remain highlited

unless you mean at every time later if i want to ad another country to the blacklist i should ctrl to keep also the old blcklist highlighted? what if by mistake i forgot to hold ctrl, i will loose all the previous highlighted countries
 
The country/countries that are highlighted are the only ones that's being blocked.
Just under the selection box you will see a message: Select multiple countries (hold down Ctrl/Shift)

So to select multiple countries, press the keyboard Ctrl button (keep it held down), then mouse click the countries you would like to prevent from registering
- That's just the behaviour of that type of HTML element

I think what you would like to see is the select box act like a tick box (thinking about it, I agree, it would be more easier for people to use some sort of tickbox/rasio buttons),
but I would need to put this list inside a frame (the country list is too large to display as one option),

I can make a change to the admin control panel to make this easier
 
I think what you would like to see is the select box act like a tick box (thinking about it, I agree, it would be more easier for people to use some sort of tickbox/rasio buttons),
but I would need to put this list inside a frame (the country list is too large to display as one option),

I can make a change to the admin control panel to make this easier

tick box would be great

is it possible to add an option for this add-on to send email to the forum admin for each spammer attempt to register and got blocked?and from which country that spammer is comming from? this way we would know that this add-on is doing its job efficiently and would know which country is a bigger source of spammers :)
 
Top Bottom