Raised This Month: $51 Target: $400
 12% 

Need Special Spam Ban Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ShadowReza
Junior Member
Join Date: Nov 2018
Old 11-02-2018 , 19:08   Need Special Spam Ban Plugin
Reply With Quote #1

hi guys. i need a special plugin for spam protection. i tested all of aliiedmods plugins like advanced spam protection and spam blocker and also timepass anti cheat spam protection.

these plugins re really nice... but i need one, better.

for example some spamers chat: "join server : cs.shadowgames.ir:27015". or for example "ShadowGames.ir or "join telegram : @ShadowGames

so i put these words in spam list:
<
ShadowGames
.ir
ir
telegram
@ShadowGames
Hello
cs.
cs.shadowgames.ir
27015
join
>

but when they try again those spams and see that cant do them. they change spams like these for avoid kicking:

instead of "ShadowGames" , they use "Shadow Games" or "Shadow_Games"
instead of .ir , they use ". ir"
instead of ir , they use "i r" or more spaces "i r" fo
instead of "telegram" , they use "t.e.l.e.g.r.a.m"
instead of "@ShadowGames" , they use "@ S_h_a_d_o_w_G_a_m_e_s"
instead of "Hello" , they use "H.e l_l.o"
instead of "cs." , they use "c s ."
instead of "cs.shadowgames.ir" , they use "c s . s h a d o w g a m e s . i r"
instead of "27015" , they use "2_7_0_1_5" or "2.7.0.1.5" or "2_7_0.1.5"
instead of "join" , they use "j o.i_n"
and more...

i think now u can understand what im trying to say.

pls give me a plugin that can detect "Spaces" , "Underline" , "Dote" And some special Character. so that plugin does not consider them in detecting spam words. and after that no body cant change his words to spaming in a server.

thanks...
ShadowReza is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 11-02-2018 , 19:19   Re: Need Special Spam Ban Plugin
Reply With Quote #2

https://dev-cs.ru/resources/325/field?field=source

Quote:
Checks nickname for spam by IP address or site address, including checks for spam in chat. Does not often change the nickname to players. When receiving X warnings punishes kick. Detection records in a separate log.
PHP Code:
/**
 * CREDITS: mazdan for better way to read config
 *        Subb98 for way to do White List and for regex pattern
**/

#include <amxmodx>
#include <fakemeta>
#include <regex>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif   

#pragma semicolon 1

new const PLUGIN[] = "Kick Spamers";
new const 
VERSION[] = "1.0.3c";
new const 
AUTHOR[] = "gyxoBka";

/***************НАСТРОЙКИ***************/

#define MAXPLAYERS 32      // максимальное количество игроков на сервере
#define IMMUNITY ADMIN_BAN        // Флаг иммунитета ( по умолчанию 'd' ). Закомментируйте, чтобы убрать иммунитет
#define CHECK_CHAT        // Проверка сообщений в чате. закомментируйте, чтобы не проверять
#define CHECK_NICK                    // Проверка ника игрока при входе на сервер
#define UNREADBLE_NAME                 // Агрессивная проверка ника игрока. Кикает игроков с нечитаемыми никами. Закомментируйте, чтобы отключить
#define MAX_NUMS 7            // Какое число цифр допустимо в сообщении и нике ( в нике только при UNREADBLE_NAME )
#define SLASH                    // Закомментируйте, чтобы не скрывать сообщения начинающиеся со слэша '/'
#define NOTICE                    // Закомментируйте строку, чтобы отключить оповещения в чате
#define SOUND                    // Закомментируйте строку, чтобы отключить звуковое оповещение
#define LOG_TO "KickSpamers.log"          // Логирование обнарежения спама. закомментируйте, чтобы не логировать
#define BAD_WORDS "bad_words.ini"        // Слова, которые следует считать спамом. закомментируйте, чтобы не использовать
#define WHITE_WORDS "white_list.ini"      // Слова, которые НЕ считаются спамом. закомментируйте, чтобы не использовать

/*****************КОНЕЦ*****************/

#define CheckFlag(%1,%2)        (%1 &  (1 << (%2 & 31)))
#define SetFlag(%1,%2)         (%1 |=  (1 << (%2 & 31)))
#define ClearFlag(%1,%2)       (%1 &= ~(1 << (%2 & 31)))

#define MAX_LEN 20

enum _:CVARS
{
   
SITE_NAME,
   
SITE_CHAT,
   
WAIT,
   
WARNINGS
};

stock Array:g_aBadWordg_aBadWord_size;
stock Array:g_aWhiteWordg_aWhiteWord_size;
stock Regex:g_RegexIPRegex:g_RegexSite;

stock g_iNameWarns[MAXPLAYERS+1];
stock g_iMaxWaitTime;
stock Float:g_flWaitTime[MAXPLAYERS 1];
stock bool:g_bRegexSite_Name;

stock g_szMessage[192];
stock g_iChatWarns[MAXPLAYERS+1];
stock bool:g_bRegexSite_Chat;

stock g_iCvars[CVARS];
stock g_iMaxWarnings;

stock IsImmunity;

stock g_iPosg_szTemp[MAX_LEN+1];

public 
plugin_init() 
{
   
register_plugin(PLUGINVERSIONAUTHOR);
   
register_cvar("kickspamers"VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);
   
   
#if defined CHECK_NICK
   
register_forward(FM_ClientUserInfoChanged,"fw_ClientUserInfoChanged"false);
   
#endif
   
   #if defined CHECK_CHAT
   
register_clcmd("say","HookSay");
   
register_clcmd("say_team","HookSay");
   
#endif
}

public 
plugin_cfg()
{
   
LoadCvars();
   
LoadRegex();
   
#if defined BAD_WORDS
   
LoadBadWords();
   
#endif
   #if defined WHITE_WORDS
   
LoadWhiteWord();
   
#endif
}

public 
client_putinserver(id)
{
   
#if defined IMMUNITY
   
if(get_user_flags(id) & IMMUNITY || is_user_hltv(id)) 
   {
     
SetFlag(IsImmunityid);
     return 
PLUGIN_HANDLED;
   }
   
#else
   
if(is_user_hltv(id)) return PLUGIN_HANDLED;
   
#endif
   
   #if defined CHECK_NICK
   
NickControl(id);
   
#endif
   
   
return PLUGIN_CONTINUE;
}

#if !defined client_disconnected
   #define client_disconnected client_disconnect
#endif

public client_disconnected(id)
{
   
#if defined CHECK_NICK
   
g_flWaitTime[id] = 0.0;
   
g_iNameWarns[id] = 0;
   
#endif
   
   #if defined CHECK_CHAT
   
g_iChatWarns[id] = 0;
   
#endif
}     

#if defined CHECK_NICK
public fw_ClientUserInfoChanged(idszBuffer)
{
   if(!
is_user_alive(id)) return FMRES_IGNORED;
   
#if defined IMMUNITY
   
if(CheckFlag(IsImmunityid)) return FMRES_IGNORED;
   
#endif
   
   
static szOldName[32], szNewName[32];
   
get_user_name(idszOldName31);
   
engfunc(EngFunc_InfoKeyValueszBuffer"name"szNewName31);
   
   if(
equali(szOldNameszNewName)) return FMRES_IGNORED;
   
   static 
Float:flTimeflTime get_gametime();

   if(
g_flWaitTime[id] > flTime)
   {
     
g_flWaitTime[id] = flTime g_iMaxWaitTime;
       
     
engfunc(EngFunc_SetClientKeyValueidszBuffer"name"szOldName);
       
     if(++
g_iNameWarns[id] >= g_iMaxWarnings)
     {
       
KickPlayer(id"[SPAM] Частая смена ника");
     }
     
#if defined NOTICE
     
client_print_color(id0"^1[^4 Предупреждение^1 ]^3 Нельзя часто менять ник ^1[^4%d^1/^4%d^1]^3!",g_iNameWarns[id], g_iMaxWarnings);
     
#endif
     #if defined SOUND
     
client_cmd(id"spk buttons/button2");
     
#endif
     
return FMRES_SUPERCEDE;
   }   
   
g_flWaitTime[id] = flTime g_iMaxWaitTime;
   
g_iNameWarns[id] = 0;
   
NickControl(idszNewName);
   
   return 
FMRES_IGNORED;
}
#endif

#if defined CHECK_CHAT
public HookSay(id)
{
   static 
ret;  ret 0;
   
   
read_args(g_szMessagecharsmax(g_szMessage));
   
remove_quotes(g_szMessage);
   
   if(
strlen(g_szMessage) == 0) return PLUGIN_HANDLED;
   
#if defined SLASH
   
if(g_szMessage[0] == '/') return PLUGIN_HANDLED_MAIN;
   
#endif
   
   #if defined IMMUNITY
   
if(CheckFlag(IsImmunityid)) return PLUGIN_CONTINUE;
   
#endif
   
   #if defined LOG_TO
   
new szTemp[192];
   
copy(szTempcharsmax(szTemp), g_szMessage);
   
#endif
   
   #if defined WHITE_WORDS
   
g_iPos g_aWhiteWord_size;
   while(
g_iPos--)
   {
     
ArrayGetString(g_aWhiteWordg_iPosg_szTempMAX_LEN);
     if(
containi(g_szMessageg_szTemp) != -1)
       while(
replace(g_szMessagecharsmax(g_szMessage), g_szTemp"")) {}
   }
   
#endif
   
static iCharsiNums;
   
iChars 0iNums 0;
   
AnalyzeString(g_szMessageiCharsiNums);
   
   if((
g_bRegexSite_Chat && regex_match_c(g_szMessageg_RegexSiteret) > 0) || regex_match_c(g_szMessageg_RegexIPret) > 0  || iNums MAX_NUMS)
   {
     
#if defined LOG_TO
     
PrintLog(idszTemp);
     
#endif
     
if(++g_iChatWarns[id] >= g_iMaxWarnings)
     {
       
KickPlayer(id"[SPAM] Спам в чате");
     }
     
#if defined NOTICE
     
client_print_color(id0"^1[^4 Предупреждение^1 ]^3 Прекрати спамить^1[^4%d^1/^4%d^1]^3!",g_iChatWarns[id], g_iMaxWarnings);
     
#endif
     #if defined SOUND
     
client_cmd(id"spk buttons/button2");
     
#endif
     
return PLUGIN_HANDLED;
   }

   
#if defined BAD_WORDS
   
if(BadWordCheck(idg_iChatWarns[id], g_szMessage)) return PLUGIN_HANDLED;
   
#endif
   
return PLUGIN_CONTINUE;
}
#endif


stock NickControl(const idszName[32] = "")
{
   
#if defined IMMUNITY
   
if(CheckFlag(IsImmunityid)) return;
   
#endif

   
new ret;
   if(
strlen(szName) == 0get_user_name(idszNamecharsmax(szName));

   
CheckIP(idszName);
   
   if(
g_bRegexSite_Name && regex_match_c(szNameg_RegexSiteret) > 0)
   {
     
KickPlayer(id"[SPAM] Домен сайта в нике");
   }
}

stock CheckIP(const idszName[32] = "")
{
   new 
iRetiCharsiNums;
   
AnalyzeString(szNameiCharsiNums);

   if(
regex_match_c(szNameg_RegexIPiRet) > 0
   {
     
KickPlayer(id"[SPAM] IP сервера в нике");
     return;
   }
   
   
#if defined UNREADBLE_NAME
   
if(iNums iChars || iNums MAX_NUMS)
   {
     
KickPlayer(id"[SPAM] Нечитаемый ник. Слишком много цифр");
   }
   
#endif
}

stock AnalyzeString(const szTemp[], &iChars, &iNums)
{
   new 
iLen strlen(szTemp);
   new 
iTemp;
   
   for(new 
iiLeni++)
   {
     
iTemp szTemp;
     
     if (
'0' <= iTemp <= '9'iNums++;
     else 
iChars++;
   }
}

stock KickPlayer(const idszReason[] = "")
{
   
server_cmd("kick #%d %s"get_user_userid(id), szReason);
   
#if defined LOG_TO
   
PrintLog(idszReason);
   
#endif
}

LoadRegex()
{
   
// Паттерн на IP
   //new szPatternIP[] = "(?:\s*\d+\s*\.){3}";
   
new szPatternIP[] = "(?:\d{1,3}.){3}";
   
// Паттерн на Site
   //new szPatternSite[] = "(?:\w{2,}\s*\.\s*(su|ru|by|kz|ua|eu|bg|de|fr|lt|lv|me|pl|ro|us|ws|com|net|org|biz|name|info)\b)";
   
new szPatternSite[] = "(?:[-\w]{2,}\W(su|ru|by|kz|ua|eu|bg|de|fr|lt|lv|me|pl|ro|us|ws|com|net|org|biz|name|info)\b)";
   
   new 
reterror[128];
   
   
g_RegexIP regex_compile(szPatternIPreterrorcharsmax(error), "i");
   if(
g_RegexIP == REGEX_PATTERN_FAILset_fail_state("|  Incorrect pattern IP.  |");   

   
g_RegexSite regex_compile(szPatternSitereterrorcharsmax(error), "i");
   if(
g_RegexSite == REGEX_PATTERN_FAILset_fail_state("|  Incorrect pattern SITE.  |");   
}

#if defined BAD_WORDS
LoadBadWords()
{
   new 
szFilePath[64];
   
get_localinfo("amxx_configsdir"szFilePathcharsmax(szFilePath));
   
formatex(szFilePathcharsmax(szFilePath), "%s/%s",szFilePathBAD_WORDS);

   new 
FileHandle fopen(szFilePath"rt");

   if(!
FileHandle
   {   
     new 
szErrorMsg[256];
     
formatex(szErrorMsgcharsmax(szErrorMsg), "[ERROR] File '%s' Not Exists here."szFilePath);
     
ErrorMessage(szErrorMsg);
   }

   new 
szTemp[20];
   
g_aBadWord ArrayCreate(MAX_LEN+1);
   
   while(!
feof(FileHandle))
   {
     
fgets(FileHandleszTempcharsmax(szTemp));
     
trim(szTemp);
     
     if(!
szTemp[0] || szTemp[0] == ';') continue;
     
     
ArrayPushString(g_aBadWordszTemp);
     
g_aBadWord_size++;
   }
   
fclose(FileHandle);
}
#endif

#if defined WHITE_WORDS
LoadWhiteWord()
{
   new 
szFilePath[64];
   
get_localinfo("amxx_configsdir"szFilePathcharsmax(szFilePath));
   
formatex(szFilePathcharsmax(szFilePath), "%s/%s",szFilePathWHITE_WORDS);
   
   new 
FileHandle fopen(szFilePath"rt");
   
   if(!
FileHandle
   {   
     new 
szErrorMsg[256];
     
formatex(szErrorMsgcharsmax(szErrorMsg), "[ERROR] File '%s' Not Exists here."szFilePath);
     
ErrorMessage(szErrorMsg);
   }
   
   new 
szTemp[20];
   
g_aWhiteWord ArrayCreate(MAX_LEN+1);
   
   while(!
feof(FileHandle))
   {
     
fgets(FileHandleszTempcharsmax(szTemp));
     
trim(szTemp);
     
     if(!
szTemp[0] || szTemp[0] == ';') continue;
     
     
ArrayPushString(g_aWhiteWordszTemp);
     
g_aWhiteWord_size++;
   }
   
fclose(FileHandle);
}
#endif

LoadCvars()
{
   
#if defined CHECK_CHAT
   
g_iCvars[SITE_CHAT]    = register_cvar("regex_match_site_chat",    "1");
   if(
get_pcvar_num(g_iCvars[SITE_CHAT])) g_bRegexSite_Chat true;
   
#endif
   #if defined CHECK_NICK
   
g_iCvars[SITE_NAME]    = register_cvar("regex_match_site_name",    "1");
   
g_iCvars[WARNINGS]     = register_cvar("max_warnings",     "3");
   
g_iCvars[WAIT]       = register_cvar("min_wait",       "10");
   
   
g_iMaxWarnings      get_pcvar_num(g_iCvars[WARNINGS]);
   
g_iMaxWaitTime      get_pcvar_num(g_iCvars[WAIT]);
   
   if(
get_pcvar_num(g_iCvars[SITE_NAME])) g_bRegexSite_Name true;
   
#endif
}

stock bool:BadWordCheck(id, &iWarnsszTemp[])
{
   
g_iPos g_aBadWord_size;
   
   while(
g_iPos--)
   {
     
ArrayGetString(g_aBadWordg_iPosg_szTempMAX_LEN);
     if(
containi(szTempg_szTemp) > -1)
     {
       
#if defined LOG_TO
       
PrintLog(idszTemp);
       
#endif
       
if(++iWarns >= g_iMaxWarnings)
       {
         
KickPlayer(id"[SPAM] Спам в чате");
       }
       
#if defined NOTICE
       
client_print_color(id0"^1[^4 Предупреждение^1 ]^3 Прекрати спамить ^1[^4%d^1/^4%d^1]^3!",g_iChatWarns[id], g_iMaxWarnings);
       
#endif
       #if defined SOUND
       
client_cmd(id"spk buttons/button2");
       
#endif
       
       
return true;
     }
   }
   
   return 
false;
}

stock ErrorMessage(const szMessage[])
{
   
#if defined LOG_TO
   
log_to_file(LOG_TO"%s"szMessage);
   
#endif
   
set_fail_state(szMessage);
}

#if defined LOG_TO
stock PrintLog(const id, const szMessage[])
{
   static 
szMsg[256];
   
vformat(szMsgcharsmax(szMsg), szMessage2);
   new 
szName[32], szAuth[24];
   
get_user_name(idszNamecharsmax(szName));
   
get_user_authid(idszAuthcharsmax(szAuth));
   
   
log_to_file(LOG_TO"%s <%s>: ^"%s^""szNameszAuthszMsg);
}
#endif 

Last edited by Alber9091; 11-02-2018 at 19:20.
Alber9091 is offline
ShadowReza
Junior Member
Join Date: Nov 2018
Old 11-02-2018 , 21:25   Re: Need Special Spam Ban Plugin
Reply With Quote #3

Quote:
Originally Posted by Alber9091 View Post
https://dev-cs.ru/resources/325/field?field=source



PHP Code:
/**
 * CREDITS: mazdan for better way to read config
 *        Subb98 for way to do White List and for regex pattern
**/

#include <amxmodx>
#include <fakemeta>
#include <regex>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif   

#pragma semicolon 1

new const PLUGIN[] = "Kick Spamers";
new const 
VERSION[] = "1.0.3c";
new const 
AUTHOR[] = "gyxoBka";

/***************НАСТРОЙКИ***************/

#define MAXPLAYERS 32      // максимальное количество игроков на сервере
#define IMMUNITY ADMIN_BAN        // Флаг иммунитета ( по умолчанию 'd' ). Закомментируйте, чтобы убрать иммунитет
#define CHECK_CHAT        // Проверка сообщений в чате. закомментируйте, чтобы не проверять
#define CHECK_NICK                    // Проверка ника игрока при входе на сервер
#define UNREADBLE_NAME                 // Агрессивная проверка ника игрока. Кикает игроков с нечитаемыми никами. Закомментируйте, чтобы отключить
#define MAX_NUMS 7            // Какое число цифр допустимо в сообщении и нике ( в нике только при UNREADBLE_NAME )
#define SLASH                    // Закомментируйте, чтобы не скрывать сообщения начинающиеся со слэша '/'
#define NOTICE                    // Закомментируйте строку, чтобы отключить оповещения в чате
#define SOUND                    // Закомментируйте строку, чтобы отключить звуковое оповещение
#define LOG_TO "KickSpamers.log"          // Логирование обнарежения спама. закомментируйте, чтобы не логировать
#define BAD_WORDS "bad_words.ini"        // Слова, которые следует считать спамом. закомментируйте, чтобы не использовать
#define WHITE_WORDS "white_list.ini"      // Слова, которые НЕ считаются спамом. закомментируйте, чтобы не использовать

/*****************КОНЕЦ*****************/

#define CheckFlag(%1,%2)        (%1 &  (1 << (%2 & 31)))
#define SetFlag(%1,%2)         (%1 |=  (1 << (%2 & 31)))
#define ClearFlag(%1,%2)       (%1 &= ~(1 << (%2 & 31)))

#define MAX_LEN 20

enum _:CVARS
{
   
SITE_NAME,
   
SITE_CHAT,
   
WAIT,
   
WARNINGS
};

stock Array:g_aBadWordg_aBadWord_size;
stock Array:g_aWhiteWordg_aWhiteWord_size;
stock Regex:g_RegexIPRegex:g_RegexSite;

stock g_iNameWarns[MAXPLAYERS+1];
stock g_iMaxWaitTime;
stock Float:g_flWaitTime[MAXPLAYERS 1];
stock bool:g_bRegexSite_Name;

stock g_szMessage[192];
stock g_iChatWarns[MAXPLAYERS+1];
stock bool:g_bRegexSite_Chat;

stock g_iCvars[CVARS];
stock g_iMaxWarnings;

stock IsImmunity;

stock g_iPosg_szTemp[MAX_LEN+1];

public 
plugin_init() 
{
   
register_plugin(PLUGINVERSIONAUTHOR);
   
register_cvar("kickspamers"VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);
   
   
#if defined CHECK_NICK
   
register_forward(FM_ClientUserInfoChanged,"fw_ClientUserInfoChanged"false);
   
#endif
   
   #if defined CHECK_CHAT
   
register_clcmd("say","HookSay");
   
register_clcmd("say_team","HookSay");
   
#endif
}

public 
plugin_cfg()
{
   
LoadCvars();
   
LoadRegex();
   
#if defined BAD_WORDS
   
LoadBadWords();
   
#endif
   #if defined WHITE_WORDS
   
LoadWhiteWord();
   
#endif
}

public 
client_putinserver(id)
{
   
#if defined IMMUNITY
   
if(get_user_flags(id) & IMMUNITY || is_user_hltv(id)) 
   {
     
SetFlag(IsImmunityid);
     return 
PLUGIN_HANDLED;
   }
   
#else
   
if(is_user_hltv(id)) return PLUGIN_HANDLED;
   
#endif
   
   #if defined CHECK_NICK
   
NickControl(id);
   
#endif
   
   
return PLUGIN_CONTINUE;
}

#if !defined client_disconnected
   #define client_disconnected client_disconnect
#endif

public client_disconnected(id)
{
   
#if defined CHECK_NICK
   
g_flWaitTime[id] = 0.0;
   
g_iNameWarns[id] = 0;
   
#endif
   
   #if defined CHECK_CHAT
   
g_iChatWarns[id] = 0;
   
#endif
}     

#if defined CHECK_NICK
public fw_ClientUserInfoChanged(idszBuffer)
{
   if(!
is_user_alive(id)) return FMRES_IGNORED;
   
#if defined IMMUNITY
   
if(CheckFlag(IsImmunityid)) return FMRES_IGNORED;
   
#endif
   
   
static szOldName[32], szNewName[32];
   
get_user_name(idszOldName31);
   
engfunc(EngFunc_InfoKeyValueszBuffer"name"szNewName31);
   
   if(
equali(szOldNameszNewName)) return FMRES_IGNORED;
   
   static 
Float:flTimeflTime get_gametime();

   if(
g_flWaitTime[id] > flTime)
   {
     
g_flWaitTime[id] = flTime g_iMaxWaitTime;
       
     
engfunc(EngFunc_SetClientKeyValueidszBuffer"name"szOldName);
       
     if(++
g_iNameWarns[id] >= g_iMaxWarnings)
     {
       
KickPlayer(id"[SPAM] Частая смена ника");
     }
     
#if defined NOTICE
     
client_print_color(id0"^1[^4 Предупреждение^1 ]^3 Нельзя часто менять ник ^1[^4%d^1/^4%d^1]^3!",g_iNameWarns[id], g_iMaxWarnings);
     
#endif
     #if defined SOUND
     
client_cmd(id"spk buttons/button2");
     
#endif
     
return FMRES_SUPERCEDE;
   }   
   
g_flWaitTime[id] = flTime g_iMaxWaitTime;
   
g_iNameWarns[id] = 0;
   
NickControl(idszNewName);
   
   return 
FMRES_IGNORED;
}
#endif

#if defined CHECK_CHAT
public HookSay(id)
{
   static 
ret;  ret 0;
   
   
read_args(g_szMessagecharsmax(g_szMessage));
   
remove_quotes(g_szMessage);
   
   if(
strlen(g_szMessage) == 0) return PLUGIN_HANDLED;
   
#if defined SLASH
   
if(g_szMessage[0] == '/') return PLUGIN_HANDLED_MAIN;
   
#endif
   
   #if defined IMMUNITY
   
if(CheckFlag(IsImmunityid)) return PLUGIN_CONTINUE;
   
#endif
   
   #if defined LOG_TO
   
new szTemp[192];
   
copy(szTempcharsmax(szTemp), g_szMessage);
   
#endif
   
   #if defined WHITE_WORDS
   
g_iPos g_aWhiteWord_size;
   while(
g_iPos--)
   {
     
ArrayGetString(g_aWhiteWordg_iPosg_szTempMAX_LEN);
     if(
containi(g_szMessageg_szTemp) != -1)
       while(
replace(g_szMessagecharsmax(g_szMessage), g_szTemp"")) {}
   }
   
#endif
   
static iCharsiNums;
   
iChars 0iNums 0;
   
AnalyzeString(g_szMessageiCharsiNums);
   
   if((
g_bRegexSite_Chat && regex_match_c(g_szMessageg_RegexSiteret) > 0) || regex_match_c(g_szMessageg_RegexIPret) > 0  || iNums MAX_NUMS)
   {
     
#if defined LOG_TO
     
PrintLog(idszTemp);
     
#endif
     
if(++g_iChatWarns[id] >= g_iMaxWarnings)
     {
       
KickPlayer(id"[SPAM] Спам в чате");
     }
     
#if defined NOTICE
     
client_print_color(id0"^1[^4 Предупреждение^1 ]^3 Прекрати спамить^1[^4%d^1/^4%d^1]^3!",g_iChatWarns[id], g_iMaxWarnings);
     
#endif
     #if defined SOUND
     
client_cmd(id"spk buttons/button2");
     
#endif
     
return PLUGIN_HANDLED;
   }

   
#if defined BAD_WORDS
   
if(BadWordCheck(idg_iChatWarns[id], g_szMessage)) return PLUGIN_HANDLED;
   
#endif
   
return PLUGIN_CONTINUE;
}
#endif


stock NickControl(const idszName[32] = "")
{
   
#if defined IMMUNITY
   
if(CheckFlag(IsImmunityid)) return;
   
#endif

   
new ret;
   if(
strlen(szName) == 0get_user_name(idszNamecharsmax(szName));

   
CheckIP(idszName);
   
   if(
g_bRegexSite_Name && regex_match_c(szNameg_RegexSiteret) > 0)
   {
     
KickPlayer(id"[SPAM] Домен сайта в нике");
   }
}

stock CheckIP(const idszName[32] = "")
{
   new 
iRetiCharsiNums;
   
AnalyzeString(szNameiCharsiNums);

   if(
regex_match_c(szNameg_RegexIPiRet) > 0
   {
     
KickPlayer(id"[SPAM] IP сервера в нике");
     return;
   }
   
   
#if defined UNREADBLE_NAME
   
if(iNums iChars || iNums MAX_NUMS)
   {
     
KickPlayer(id"[SPAM] Нечитаемый ник. Слишком много цифр");
   }
   
#endif
}

stock AnalyzeString(const szTemp[], &iChars, &iNums)
{
   new 
iLen strlen(szTemp);
   new 
iTemp;
   
   for(new 
iiLeni++)
   {
     
iTemp szTemp;
     
     if (
'0' <= iTemp <= '9'iNums++;
     else 
iChars++;
   }
}

stock KickPlayer(const idszReason[] = "")
{
   
server_cmd("kick #%d %s"get_user_userid(id), szReason);
   
#if defined LOG_TO
   
PrintLog(idszReason);
   
#endif
}

LoadRegex()
{
   
// Паттерн на IP
   //new szPatternIP[] = "(?:\s*\d+\s*\.){3}";
   
new szPatternIP[] = "(?:\d{1,3}.){3}";
   
// Паттерн на Site
   //new szPatternSite[] = "(?:\w{2,}\s*\.\s*(su|ru|by|kz|ua|eu|bg|de|fr|lt|lv|me|pl|ro|us|ws|com|net|org|biz|name|info)\b)";
   
new szPatternSite[] = "(?:[-\w]{2,}\W(su|ru|by|kz|ua|eu|bg|de|fr|lt|lv|me|pl|ro|us|ws|com|net|org|biz|name|info)\b)";
   
   new 
reterror[128];
   
   
g_RegexIP regex_compile(szPatternIPreterrorcharsmax(error), "i");
   if(
g_RegexIP == REGEX_PATTERN_FAILset_fail_state("|  Incorrect pattern IP.  |");   

   
g_RegexSite regex_compile(szPatternSitereterrorcharsmax(error), "i");
   if(
g_RegexSite == REGEX_PATTERN_FAILset_fail_state("|  Incorrect pattern SITE.  |");   
}

#if defined BAD_WORDS
LoadBadWords()
{
   new 
szFilePath[64];
   
get_localinfo("amxx_configsdir"szFilePathcharsmax(szFilePath));
   
formatex(szFilePathcharsmax(szFilePath), "%s/%s",szFilePathBAD_WORDS);

   new 
FileHandle fopen(szFilePath"rt");

   if(!
FileHandle
   {   
     new 
szErrorMsg[256];
     
formatex(szErrorMsgcharsmax(szErrorMsg), "[ERROR] File '%s' Not Exists here."szFilePath);
     
ErrorMessage(szErrorMsg);
   }

   new 
szTemp[20];
   
g_aBadWord ArrayCreate(MAX_LEN+1);
   
   while(!
feof(FileHandle))
   {
     
fgets(FileHandleszTempcharsmax(szTemp));
     
trim(szTemp);
     
     if(!
szTemp[0] || szTemp[0] == ';') continue;
     
     
ArrayPushString(g_aBadWordszTemp);
     
g_aBadWord_size++;
   }
   
fclose(FileHandle);
}
#endif

#if defined WHITE_WORDS
LoadWhiteWord()
{
   new 
szFilePath[64];
   
get_localinfo("amxx_configsdir"szFilePathcharsmax(szFilePath));
   
formatex(szFilePathcharsmax(szFilePath), "%s/%s",szFilePathWHITE_WORDS);
   
   new 
FileHandle fopen(szFilePath"rt");
   
   if(!
FileHandle
   {   
     new 
szErrorMsg[256];
     
formatex(szErrorMsgcharsmax(szErrorMsg), "[ERROR] File '%s' Not Exists here."szFilePath);
     
ErrorMessage(szErrorMsg);
   }
   
   new 
szTemp[20];
   
g_aWhiteWord ArrayCreate(MAX_LEN+1);
   
   while(!
feof(FileHandle))
   {
     
fgets(FileHandleszTempcharsmax(szTemp));
     
trim(szTemp);
     
     if(!
szTemp[0] || szTemp[0] == ';') continue;
     
     
ArrayPushString(g_aWhiteWordszTemp);
     
g_aWhiteWord_size++;
   }
   
fclose(FileHandle);
}
#endif

LoadCvars()
{
   
#if defined CHECK_CHAT
   
g_iCvars[SITE_CHAT]    = register_cvar("regex_match_site_chat",    "1");
   if(
get_pcvar_num(g_iCvars[SITE_CHAT])) g_bRegexSite_Chat true;
   
#endif
   #if defined CHECK_NICK
   
g_iCvars[SITE_NAME]    = register_cvar("regex_match_site_name",    "1");
   
g_iCvars[WARNINGS]     = register_cvar("max_warnings",     "3");
   
g_iCvars[WAIT]       = register_cvar("min_wait",       "10");
   
   
g_iMaxWarnings      get_pcvar_num(g_iCvars[WARNINGS]);
   
g_iMaxWaitTime      get_pcvar_num(g_iCvars[WAIT]);
   
   if(
get_pcvar_num(g_iCvars[SITE_NAME])) g_bRegexSite_Name true;
   
#endif
}

stock bool:BadWordCheck(id, &iWarnsszTemp[])
{
   
g_iPos g_aBadWord_size;
   
   while(
g_iPos--)
   {
     
ArrayGetString(g_aBadWordg_iPosg_szTempMAX_LEN);
     if(
containi(szTempg_szTemp) > -1)
     {
       
#if defined LOG_TO
       
PrintLog(idszTemp);
       
#endif
       
if(++iWarns >= g_iMaxWarnings)
       {
         
KickPlayer(id"[SPAM] Спам в чате");
       }
       
#if defined NOTICE
       
client_print_color(id0"^1[^4 Предупреждение^1 ]^3 Прекрати спамить ^1[^4%d^1/^4%d^1]^3!",g_iChatWarns[id], g_iMaxWarnings);
       
#endif
       #if defined SOUND
       
client_cmd(id"spk buttons/button2");
       
#endif
       
       
return true;
     }
   }
   
   return 
false;
}

stock ErrorMessage(const szMessage[])
{
   
#if defined LOG_TO
   
log_to_file(LOG_TO"%s"szMessage);
   
#endif
   
set_fail_state(szMessage);
}

#if defined LOG_TO
stock PrintLog(const id, const szMessage[])
{
   static 
szMsg[256];
   
vformat(szMsgcharsmax(szMsg), szMessage2);
   new 
szName[32], szAuth[24];
   
get_user_name(idszNamecharsmax(szName));
   
get_user_authid(idszAuthcharsmax(szAuth));
   
   
log_to_file(LOG_TO"%s <%s>: ^"%s^""szNameszAuthszMsg);
}
#endif 

thanx. but i need this feature:

Quote:
pls give me a plugin that can detect "Spaces" , "Underline" , "Dote" And some special Character. so that plugin does not consider them in detecting spam words. and after that no body cant change his words to spaming in a server.
i know some plugins for detectiong sites, domins and ips.
i have them but i need a plugin that can detect bad words and detect spaces, underlines or dotes between them and can smartly detect that bad words.
for example i write this word in plugin:
"Iran"
and plugin can also detect these words:
"I r a n"
"I.r.a.n"
"I_r_a_n"
"I._r.a_n"

my meaning is so easy to understand...

Last edited by ShadowReza; 11-02-2018 at 21:27.
ShadowReza is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-03-2018 , 00:04   Re: Need Special Spam Ban Plugin
Reply With Quote #4

It will be nearly impossible to prevent all spam or all possible ways to format a word and would be useless (and potentially detrimental to server performance) to try to achieve such a feat.

The best plugin I saw to prevent spam was to check to see if a phrase has been used too many times too often (banning specific words is different than banning spam). I believe that this plugin was created by Xolent.
__________________

Last edited by fysiks; 11-03-2018 at 00:04.
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-03-2018 , 04:46   Re: Need Special Spam Ban Plugin
Reply With Quote #5

Disallow non alphabet characters to be used.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-03-2018 , 06:09   Re: Need Special Spam Ban Plugin
Reply With Quote #6

Storing the message on a string, removing the spaces and checking if it contains any of the forbidden words?
__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-03-2018 , 10:28   Re: Need Special Spam Ban Plugin
Reply With Quote #7

Leaving only letters in the message, converting all other symbols to letters (e.g. @ - A, 3 = E, etc), removing all spaces and then doing the checks.
__________________

Last edited by OciXCrom; 11-03-2018 at 10:28.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-03-2018 , 10:31   Re: Need Special Spam Ban Plugin
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
Leaving only letters in the message, converting all other symbols to letters (e.g. @ - A, 3 = E, etc), removing all spaces and then doing the checks.
You can't really convert symbols to letters.
'H3llo conn3ct to my server: 33.333.333:27015'

Post-conversion:
'Hello connect to my server: ee.eee.eee:27015'.
__________________
edon1337 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-03-2018 , 13:27   Re: Need Special Spam Ban Plugin
Reply With Quote #9

The human brain will be able to outsmart anything you are able to implement so it's pointless. Just kick people that break your rules.
__________________
fysiks is offline
ShadowReza
Junior Member
Join Date: Nov 2018
Old 11-03-2018 , 14:58   Re: Need Special Spam Ban Plugin
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
It will be nearly impossible to prevent all spam or all possible ways to format a word and would be useless (and potentially detrimental to server performance) to try to achieve such a feat.

The best plugin I saw to prevent spam was to check to see if a phrase has been used too many times too often (banning specific words is different than banning spam). I believe that this plugin was created by Xolent.


i now wht u re trying to say me. bot now i have all of spam protection plugins...
and i need to block some special words...
not to block fast spaming Sentences.
ShadowReza is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:57.


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