AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   AntiCommerce (https://forums.alliedmods.net/showthread.php?t=79596)

Scherzo 10-26-2008 07:45

AntiCommerce
 
43 Attachment(s)
AntiCommerce 1.2a

Description:
Anti spam filter. It doesn`t allow put addresses websites or/and IPs servers in chat or/and nick (controlled by cvars). This plugin, based on regular expression, is weapon against spammers.
Included admins immunity support.


Cvars:
  • ac_log 0|1 (default 1)
Mean it will create log file (1) with found adverts or not (0).
If ac_log 1 you should create 'advert' folder in logs/ directory.
  • ac_what2search 0|1|2|3 (default 3)
Define which adverts it should search. Value from list:
  • 0 - nothing (sth like plugin disabled)
  • 1 - only IP`s
  • 2 - only WWW addresses
  • 3 - both
  • ac_punish 0|1|2 (default 0)
Chose punishment for spammers
  • 0 - warning
  • 1 - kick
  • 2 - ban
  • ac_bantime <time> (default 1)
If 'ac_punish 2' it define how long player will be banned (in minutes)
  • ac_punishbyname 0|1 (default 1)
If = 0 plugin doesn`t kick and ban for advert in nick
  • ac_changename 0|1 (default 1)
If = 1 and ac_punishbyname 1 changes found nick on 'Player' (defined as const)
  • ac_punishbysay 0|1 (default 1)
If = 0 plugin doesn`t kick and ban for advert in chat messages
  • ac_banip 0|1 (default 0)
Work when ac_punish 2.
ac_banip 1 will ban user by ip,
ac_banip 0 will ban user by authid.

  • ac_firstadvert 0|1 (default 1)
If =1 and found first player`s advert plugin set for him ac_punish 0 - only warning to know that this is doesn`t allowed on server. For next adverts use actual cvar value.
  • No longer ac_flex_pattern 0|1
  • ac_ips_chars "<chars>" (default [NALPHANUM])
Define list of chars, which can be between bytes of IP to punish. In standard IP it is simple dot (.), but you can punish for other , fe. "12. 12, 12.12". Default value mean: "all not alphanumeric chars". It is single value - don`t add other chars (bad used could make pattern invalid, so it is blocked) to this, create own list of chars. Instead double quote char (") use [q] alias.
Examples:
ac_ips_chars " .,"
ac_ips_chars " .-="
ac_ips_chars " .'[q]"

  • ac_max_chars <num> (default 3)
Max count of chars from list 'ac_ips_chars' in string. Value 3 mean, that 12...12.12.12 will be punished but 12....12.12.12 will not. Use 0 when want catch all more than 1.
Cmds
  • register_exception <text>
Add <text> to list of exceptions. For this addresses it won`t punish (allowed addresess).
You can add websites and servers addresses. Plugin automatic add IP of your server.
If you need more than 15 exception slots, change
this constant and recompile:

#define MAX_EXC 15

Important: Don`t include 'http://' and 'www' in domains and port in IPs!
  • showexc
Show in console list of exceptions (only for admins).

Modules:
<regex>
<sockets>

Files:
.amxx to plugins/ directory
.txt to data/lang/
directory

ML:
[en]
[pl]
[de] - by Mordekay

[es] - byjowy77
[ru] - by xPaw
[bp] - by tmen_13
[hu] - by KuyteKuyte
[lt] - by hlev (replaced this by shadowski)
[ro] - by htudor
[bg] - by ivkos
[nl] - by crazyeffect
[fr] - by arkshine
[ua] - Strikerr
[sk] - Seehank

History:

1.2a
Added: admin can modificate IP pattern
Fixed: punish delayed for block player`s message
1.2
Fixed: new IP pattern
which was put in comment to preg_match() PHP function by Jonathan Camenisch.
(I rewrite to flexible version.)
It is much better than mine included to v1.1

1.1e
Added: cvar ac_flex_pattern define using standard or flexible pattern of IP

1.1d
Fixed: better than in 1.1c - fixed multi-catch on connect
Added: cvar 'ac_firstadvert' to warning before kick/ban
Fixed: exception registering

1.1c
Added: if ac_punish 0 in first round nick is not checking (thx Mordekay).


1.1b
Added: log suspected matches (not punished, but formated like website address)
More clean code; also added some comments

1.1a
Some optimalizations
Fixed: logging with user IP if ac_banip 1
Added: if player kicked or banned plugin show in console reason quote (shadowski`s suggestion)

1.1
Added: using sockets module to check URLs
Added: cvar ac_what2search
Added: amxbans support
Changed: port of server is not necessary to get punishment(suggested by lpf_kb)
Default MAX_EXC increased to 15

1.0
base


Other:
If ac_log 1 you should create advert folder in logs/ directory. I put mkdir function, but tested only on local computer, where chmod is not important.
Scherzo a.k.a. R3X

Thx Allucard for suggestion.
Thx sapir5522 for idea of cvar 'ac_banip', help in debug and more :)

Mordekay 10-26-2008 09:14

Re: AntiCommerce
 
First! :)
Cool idea. I know that there are allready some plugins like that, but they eigther do only block ip's or url's. This is the first plugin i see that blocks them all. I'm going to test it soon :)

Code:

[de]
WARN1 = Setze keine Werbung in den Chat order deinen Nick!
WARN2 = Maximale Anzahl an Verwarnungen erreicht!
WARN3 = Bitte aender deinen Namen! ^nBenutze keine Domain/Server Namen
INFO_GLOB = Achtung! Unterlasse Werbung in deinem Nickname oder Chat!
INFO1 = Zeit: %d Minute(n)
INFO2 = Bestrafung fuer Werbung
INFO3 = Es gibt keine Ausnahmen.
WORD_ADVERT = Werbung
WORD_EXCEPT = ausser
WORD_REASON = Grund

+Karma

Edit: suggestion: could you add support for amxbans?

Scherzo 10-26-2008 10:34

Re: AntiCommerce
 
Is it what you meant 'support for amxbans'?

Replace
Code:

                server_cmd("banid %d #%d kick",bantime,uid);
with
Code:

            if(is_plugin_loaded("amx_bans.amxx"))
                server_cmd("amx_ban #%d %d %L",uid,bantime, id,"WORD_ADVERT");
            else
                server_cmd("banid %d #%d kick",bantime,uid);

Edit.
Now I know it`s not working, so don`t copy this.

jowy77 10-26-2008 10:40

Re: AntiCommerce
 
Quote:

[es]
WARN1 = No poner publicidad en el chat o nick
WARN2 = Máximo número de excepciones alcanzadas!
WARN3 = Por favor, cambia tu nombre!^nNo uses dominio/servidor
INFO_GLOB = Recuerda! No debes poner publicidad en chat o nick
INFO1 = Tiempo: %d minuto(s)
INFO2 = castigado por anuncio
INFO3 = No hay ninguna excepción
WORD_ADVERT = Publicidad
WORD_EXCEPT = Excepciones
WORD_REASON = Motivo

Mordekay 10-26-2008 11:12

Re: AntiCommerce
 
Thx for the code.
Reading the langfile and your description confuses me a bit.
There is a counter for number of posted advertising, but your description do not say anything about it?
How does it work if it is there? How to set number of maximum adverts?

Edit: please don't use "Space" when posting code, use [Tab] instead, it causes a warning when compiling (warning 217: loose indentation)

Alucard^ 10-26-2008 12:11

Re: AntiCommerce
 
u can add a cvar like "ac_punishbyname 0|1" but with say and say_team... for example if u only want to warning/kick/ban a player only for the nick, u cant in this moment...

good plugin

Scherzo 10-26-2008 12:11

Re: AntiCommerce
 
Counter is for filling array with exceptions. Exception in my plugin mean you won`t be punish for advertise it. For example you have website for the server, so you want ban or kick players, who write to someone, where is more info about server? No. Only add to your config file (maybe server.cfg) line
Code:

register_exception "www.myserverwebsite.com"
And nobody will be punish for put it into chat or nick. I prepared array for 10 exceptions. If you try add 11th, you get message from langfile.

In .sma file already exist code, which I post. It was only to be sure this part of plugin.


Edit:
@Alucard
Yeah, good point. It could be more comfortable. Thx

Added cvar 'ac_punishbysay'.

Exolent[jNr] 10-26-2008 15:57

Re: AntiCommerce
 
You should add an exception for admins in case they want to advertise their clan's website or other servers.

Alucard^ 10-26-2008 20:30

Re: AntiCommerce
 
no problem scherzo, other suggest.. maybe a cvar like register_exception but for ips :P

Scherzo 10-27-2008 09:55

Re: AntiCommerce
 
Exolent[jNr], I included admin immunity support for say and say_team, but forgot only about nicks.

register_exception works for IPs too :)

Edit:
Added: admin immunity work with nicks.
Added: cvar ac_changename
Changed: default values of cvars
Fixed: few small problems


All times are GMT -4. The time now is 19:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.