AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Alias client cmd blocker (https://forums.alliedmods.net/showthread.php?t=327761)

feren02 10-08-2020 03:44

Alias client cmd blocker
 
Hello everyone!

Hope you are coping with the pandemic. Really a newbie in terms of scripting... I just wonder if we can do this:

- Alias Game Command Blocker
(Bans a player via traditional IP Address [rcon addip]) when detected in CMD aliases like:
*UPON TYPING IN CONSOLE "alias" BEFORE CONNECTING TO A SERVER IP ADDRESS*
PHP Code:

Current alias commands:
hud_fastswitch :
cl_timeout :
cl_bob :
cl_bobup :
cl_bobcycle :
ex_interp :
fps_modem :
fps_max :
cl_updaterate :
cl_cmdrate :
cl_rate :
cl_timeout :
r_dynamic :
chase_active :
r_fullbright :
gl_wireframe 

I tried alias blockers and checkers plugins but they type all those commands in console that makes it ineffective as if they are not detected as script but as command. Again players are banned when they are detected using "ALIAS" for this commands , they will not be punished if they only TYPE these commands on console... e.g. /cl_rate OR /cl_rate 9999, only if they did /alias cl_rate "9999".


LOOKING FORWARD FOR ALL YOUR EXPERTISE! KEEP SAFE + HEALTHY. THANK YOU!

fysiks 10-08-2020 22:09

Re: Alias client cmd blocker
 
Are you suggesting that you want to know what someone is typing on their computer, even before connecting to your server?? That's not possible even if they are connected to your server.

The best that you can probably do is to use a cvar value checker and kick/ban them if they have a value that you don't want.

feren02 10-08-2020 22:53

Re: Alias client cmd blocker
 
Quote:

Originally Posted by fysiks (Post 2720702)
Are you suggesting that you want to know what someone is typing on their computer, even before connecting to your server?? That's not possible even if they are connected to your server.

The best that you can probably do is to use a cvar value checker and kick/ban them if they have a value that you don't want.

Hi there your reply means a lot to me! :)

What I meant was Banning Players via IP (not AMX BAN but traditional banning) when they ALIAS the commands like below:

PHP Code:

Current alias commands:
hud_fastswitch :
cl_timeout :
cl_bob :
cl_bobup :
cl_bobcycle :
ex_interp :
fps_modem :
fps_max :
cl_updaterate :
cl_cmdrate :
cl_rate :
cl_timeout :
r_dynamic :
chase_active :
r_fullbright :
gl_wireframe 

*** THESE COMMANDS ARE SERVER COMMANDS THAT CAN BE TYPED VIA CONSOLE THAT IS WHY IT CONFLICTS CVAR VALUE CHECKERS & BLOCKERS | NOT UNLIKE +doaim, +doshoot, which are SCRIPTS of ALIAS. WHEN I PUT FOR EXAMPLE gl_wireframe in a CVAR Checker, once in-game and player is checked, player automatically types in console the value since it is also a game command making them detected and kicked or banned even if they did not /alias gl_wireframe***

Question: How can I make a tweaked .sma wherein players are banned via iP when they aliased those game commands above?


Thank you!!!

DruGzOG 10-09-2020 01:00

Re: Alias client cmd blocker
 
What's wrong with banning them via steamid? Much more efficient

feren02 10-09-2020 01:10

Re: Alias client cmd blocker
 
Quote:

Originally Posted by DruGzOG (Post 2720710)
What's wrong with banning them via steamid? Much more efficient

Nothing more but I guess some other just changes IDs, I believe IP changes as well, but I prefer it more in our country.

Can you please help me :)

Mordekay 10-09-2020 01:45

Re: Alias client cmd blocker
 
Only non-steamers can change their ID as they don't realy have one.
No one cares what you prefer, but non-steam is not supported here.
And as a hint: cl_ means client. You can send those commands to the server but they won't get recognised by them or change anything at the server itself. And without rcon they are not even send to the server but remain at the client.
So whatever your problem is is may caused by something different.
Sending these cvars as a server to the client in order to change them is slowhacking and also not supported.

feren02 10-09-2020 03:47

Re: Alias client cmd blocker
 
Quote:

Originally Posted by Mordekay (Post 2720713)
Only non-steamers can change their ID as they don't realy have one.
No one cares what you prefer, but non-steam is not supported here.
And as a hint: cl_ means client. You can send those commands to the server but they won't get recognised by them or change anything at the server itself. And without rcon they are not even send to the server but remain at the client.
So whatever your problem is is may caused by something different.
Sending these cvars as a server to the client in order to change them is slowhacking and also not supported.

Unintenionally I found the appropriate .sma for me! :)

However can you help me trigger the ban script or code BAN a player via IP. It seems that a player who violates is not punished at all using this:

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define VERSION    "1"
#define OFFSET    64

static Array:g_a_Aliases;
static 
g_a_Reason[33][64],g_a_RandCmd[33][64];
static 
g_i_AliasNum[33],g_i_Warnings[33];
static 
g_p_MessType,g_p_BanType;

public 
plugin_init() {
    
register_plugin("Aliases checker",VERSION,"creator_52");
    
get_aliases();
    
g_p_MessType=register_cvar("ac_mess_type","1");
    
g_p_BanType=register_cvar("ac_ban_type","kick <userid>  <reason> detected!");
}

public 
get_aliases() {
    new 
s_File[128];
    
get_configsdir(s_File,127);
    
format(s_File,127,"%s/aliases.ini",s_File);
    if(!
file_exists(s_File)) {
        
server_print("[Aliases checker] File 'aliases.ini' not found!");
        return 
PLUGIN_CONTINUE;
    }
    else {
        
g_a_Aliases=ArrayCreate(64);
        new 
i_File=fopen(s_File,"rt");
        new 
s_Buffer[64];
        while(!
feof(i_File)) {
            
fgets(i_File,s_Buffer,63);
            
trim(s_Buffer);
            if(!
s_Buffer[0] || s_Buffer[0]==';' || (s_Buffer[0]=='/' && s_Buffer[1]=='/')) {
                continue;
            }
            
ArrayPushString(g_a_Aliases,s_Buffer);
        }
        
fclose(i_File);
        new 
i_Size=ArraySize(g_a_Aliases);
        if(!
i_Size) {
            
server_print("[Aliases checker] No aliases loaded!");
            return 
PLUGIN_CONTINUE;
        }
        else {
            
server_print("[Aliases checker] Loaded %d aliases.",i_Size);
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
form_rand_string(i_Player) {
    for(new 
a;a<15;a++) {
        
g_a_RandCmd[i_Player][a]=random_num('a','z');
    }
}

public 
client_disconnect(i_Player) {
    if(
task_exists(i_Player)) {
        
remove_task(i_Player);
    }
    if(
task_exists(i_Player+OFFSET)) {
        
remove_task(i_Player+OFFSET);
    }
}

public 
client_putinserver(i_Player) {
    if(
is_user_bot(i_Player) || is_user_hltv(i_Player)) {
        return 
PLUGIN_CONTINUE;
    }
    else {
        
g_i_AliasNum[i_Player]=0;
        
g_i_Warnings[i_Player]=0;
        
set_task(5.0,"start_check_aliases",i_Player);
    }
    return 
PLUGIN_CONTINUE;
}

public 
start_check_aliases(i_Player) {
    
form_rand_string(i_Player);
    
check_aliases(i_Player+OFFSET);
    
set_task(3.0,"check_aliases",i_Player+OFFSET,_,_,"a",4);
    
set_task(15.0,"final_check",i_Player+OFFSET);
}

public 
check_aliases(i_Player) {
    
i_Player-=OFFSET;
    if(
g_i_AliasNum[i_Player]>=ArraySize(g_a_Aliases)-1) {
        
g_i_AliasNum[i_Player]=0;
    }
    new 
s_Buffer[64];
    
ArrayGetString(g_a_Aliases,g_i_AliasNum[i_Player],s_Buffer,63);
    new 
i_StrLen=strlen(s_Buffer);
    if(
s_Buffer[0]=='[' && s_Buffer[i_StrLen-1]==']') {
        
format(g_a_Reason[i_Player],i_StrLen-2,s_Buffer[1]);
        
g_i_AliasNum[i_Player]++;
        
ArrayGetString(g_a_Aliases,g_i_AliasNum[i_Player],s_Buffer,63);
    }
    
client_cmd(i_Player,g_a_RandCmd[i_Player]);
    
client_cmd(i_Player,s_Buffer);
    return 
PLUGIN_CONTINUE;
}

public 
final_check(i_Player) {
    
i_Player-=OFFSET;
    if(
g_i_Warnings[i_Player]>=3) {
        new 
s_Punishment[128],s_UserId[8],s_Ip[32],s_Name[64],s_SteamId[64];
        
num_to_str(get_user_userid(i_Player),s_UserId,7);
        
format(s_UserId,7,"#%s",s_UserId);
        
get_user_info(i_Player,"name",s_Name,63);
        
get_user_ip(i_Player,s_Ip,31,0);
        
get_user_authid(i_Player,s_SteamId,63);
        
get_pcvar_string(g_p_BanType,s_Punishment,127);
        
replace_all(s_Punishment,127,"<userid>",s_UserId);
        
replace_all(s_Punishment,127,"<name>",s_Name);
        
replace_all(s_Punishment,127,"<ip>",s_Ip);
        
replace_all(s_Punishment,127,"<steamid>",s_SteamId);
        
replace_all(s_Punishment,127,"<reason>",g_a_Reason[i_Player]);
        
server_cmd(s_Punishment);
        switch(
get_pcvar_num(g_p_MessType)) {
            case 
1:client_print(0,print_chat,"Violation by %s: %s detected!",s_Name,g_a_Reason[i_Player]);
            case 
2:show_hudmessage(0,"Violation by %s: %s detected!",s_Name,g_a_Reason[i_Player]);
        }
    }
    else {
        
g_i_Warnings[i_Player]=0;
        
set_task(20.0,"start_check_aliases",i_Player);
    }
}

public 
client_command(i_Player) {
    if(!
is_user_connected(i_Player) || is_user_bot(i_Player) || is_user_hltv(i_Player)) {
        return 
PLUGIN_CONTINUE;
    }
    else {
        new 
s_Arg[64],s_CurAlias[64];
        
ArrayGetString(g_a_Aliases,g_i_AliasNum[i_Player],s_CurAlias,63);
        
read_argv(0,s_Arg,63);
        if(
equal(s_CurAlias,s_Arg)) {
            if(
task_exists(i_Player+OFFSET)) {
                
remove_task(i_Player+OFFSET);
            }
            
g_i_AliasNum[i_Player]++;
            
g_i_Warnings[i_Player]=0;
            
start_check_aliases(i_Player);
        }
        else if(
equal(g_a_RandCmd[i_Player],s_Arg)) {
            
g_i_Warnings[i_Player]++;
        }
        else {
            return 
PLUGIN_CONTINUE;
        }
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;



LOOKING FORWARD FOR YOUR EXPERTISE! :)

fysiks 10-09-2020 21:59

Re: Alias client cmd blocker
 
Quote:

Originally Posted by feren02 (Post 2720704)
Hi there your reply means a lot to me! :)

What I meant was Banning Players via IP (not AMX BAN but traditional banning) when they ALIAS the commands like below:

PHP Code:

Current alias commands:
hud_fastswitch :
cl_timeout :
cl_bob :
cl_bobup :
cl_bobcycle :
ex_interp :
fps_modem :
fps_max :
cl_updaterate :
cl_cmdrate :
cl_rate :
cl_timeout :
r_dynamic :
chase_active :
r_fullbright :
gl_wireframe 

*** THESE COMMANDS ARE SERVER COMMANDS THAT CAN BE TYPED VIA CONSOLE THAT IS WHY IT CONFLICTS CVAR VALUE CHECKERS & BLOCKERS | NOT UNLIKE +doaim, +doshoot, which are SCRIPTS of ALIAS. WHEN I PUT FOR EXAMPLE gl_wireframe in a CVAR Checker, once in-game and player is checked, player automatically types in console the value since it is also a game command making them detected and kicked or banned even if they did not /alias gl_wireframe***

Question: How can I make a tweaked .sma wherein players are banned via iP when they aliased those game commands above?


Thank you!!!

Nothing in that list is a server command. IIRC, the alias checker that you found shouldn't work for these, it will always return as a false positive because those are client-side cvars and will not send anything to the server normally. It requires the command being sent to the server to be recognized as unassigned alias.

feren02 10-09-2020 23:55

Re: Alias client cmd blocker
 
Quote:

Originally Posted by fysiks (Post 2720790)
Nothing in that list is a server command. IIRC, the alias checker that you found shouldn't work for these, it will always return as a false positive because those are client-side cvars and will not send anything to the server normally. It requires the command being sent to the server to be recognized as unassigned alias.

Hello this works for me:

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define VERSION    "1"
#define OFFSET    64

static Array:g_a_Aliases;
static 
g_a_Reason[33][64],g_a_RandCmd[33][64];
static 
g_i_AliasNum[33],g_i_Warnings[33];
static 
g_p_MessType,g_p_BanType;

public 
plugin_init() {
    
register_plugin("Aliases checker",VERSION,"creator_52");
    
get_aliases();
    
g_p_MessType=register_cvar("ac_mess_type","1");
    
g_p_BanType=register_cvar("ac_ban_type","kick <userid>  <reason> detected!");
}

public 
get_aliases() {
    new 
s_File[128];
    
get_configsdir(s_File,127);
    
format(s_File,127,"%s/aliases.ini",s_File);
    if(!
file_exists(s_File)) {
        
server_print("[Aliases checker] File 'aliases.ini' not found!");
        return 
PLUGIN_CONTINUE;
    }
    else {
        
g_a_Aliases=ArrayCreate(64);
        new 
i_File=fopen(s_File,"rt");
        new 
s_Buffer[64];
        while(!
feof(i_File)) {
            
fgets(i_File,s_Buffer,63);
            
trim(s_Buffer);
            if(!
s_Buffer[0] || s_Buffer[0]==';' || (s_Buffer[0]=='/' && s_Buffer[1]=='/')) {
                continue;
            }
            
ArrayPushString(g_a_Aliases,s_Buffer);
        }
        
fclose(i_File);
        new 
i_Size=ArraySize(g_a_Aliases);
        if(!
i_Size) {
            
server_print("[Aliases checker] No aliases loaded!");
            return 
PLUGIN_CONTINUE;
        }
        else {
            
server_print("[Aliases checker] Loaded %d aliases.",i_Size);
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
form_rand_string(i_Player) {
    for(new 
a;a<15;a++) {
        
g_a_RandCmd[i_Player][a]=random_num('a','z');
    }
}

public 
client_disconnect(i_Player) {
    if(
task_exists(i_Player)) {
        
remove_task(i_Player);
    }
    if(
task_exists(i_Player+OFFSET)) {
        
remove_task(i_Player+OFFSET);
    }
}

public 
client_putinserver(i_Player) {
    if(
is_user_bot(i_Player) || is_user_hltv(i_Player)) {
        return 
PLUGIN_CONTINUE;
    }
    else {
        
g_i_AliasNum[i_Player]=0;
        
g_i_Warnings[i_Player]=0;
        
set_task(5.0,"start_check_aliases",i_Player);
    }
    return 
PLUGIN_CONTINUE;
}

public 
start_check_aliases(i_Player) {
    
form_rand_string(i_Player);
    
check_aliases(i_Player+OFFSET);
    
set_task(3.0,"check_aliases",i_Player+OFFSET,_,_,"a",4);
    
set_task(15.0,"final_check",i_Player+OFFSET);
}

public 
check_aliases(i_Player) {
    
i_Player-=OFFSET;
    if(
g_i_AliasNum[i_Player]>=ArraySize(g_a_Aliases)-1) {
        
g_i_AliasNum[i_Player]=0;
    }
    new 
s_Buffer[64];
    
ArrayGetString(g_a_Aliases,g_i_AliasNum[i_Player],s_Buffer,63);
    new 
i_StrLen=strlen(s_Buffer);
    if(
s_Buffer[0]=='[' && s_Buffer[i_StrLen-1]==']') {
        
format(g_a_Reason[i_Player],i_StrLen-2,s_Buffer[1]);
        
g_i_AliasNum[i_Player]++;
        
ArrayGetString(g_a_Aliases,g_i_AliasNum[i_Player],s_Buffer,63);
    }
    
client_cmd(i_Player,g_a_RandCmd[i_Player]);
    
client_cmd(i_Player,s_Buffer);
    return 
PLUGIN_CONTINUE;
}

public 
final_check(i_Player) {
    
i_Player-=OFFSET;
    if(
g_i_Warnings[i_Player]>=3) {
        new 
s_Punishment[128],s_UserId[8],s_Ip[32],s_Name[64],s_SteamId[64];
        
num_to_str(get_user_userid(i_Player),s_UserId,7);
        
format(s_UserId,7,"#%s",s_UserId);
        
get_user_info(i_Player,"name",s_Name,63);
        
get_user_ip(i_Player,s_Ip,31,0);
        
get_user_authid(i_Player,s_SteamId,63);
        
get_pcvar_string(g_p_BanType,s_Punishment,127);
        
replace_all(s_Punishment,127,"<userid>",s_UserId);
        
replace_all(s_Punishment,127,"<name>",s_Name);
        
replace_all(s_Punishment,127,"<ip>",s_Ip);
        
replace_all(s_Punishment,127,"<steamid>",s_SteamId);
        
replace_all(s_Punishment,127,"<reason>",g_a_Reason[i_Player]);
        
server_cmd(s_Punishment);
        switch(
get_pcvar_num(g_p_MessType)) {
            case 
1:client_print(0,print_chat,"Violation by %s: %s detected!",s_Name,g_a_Reason[i_Player]);
            case 
2:show_hudmessage(0,"Violation by %s: %s detected!",s_Name,g_a_Reason[i_Player]);
        }
    }
    else {
        
g_i_Warnings[i_Player]=0;
        
set_task(20.0,"start_check_aliases",i_Player);
    }
}

public 
client_command(i_Player) {
    if(!
is_user_connected(i_Player) || is_user_bot(i_Player) || is_user_hltv(i_Player)) {
        return 
PLUGIN_CONTINUE;
    }
    else {
        new 
s_Arg[64],s_CurAlias[64];
        
ArrayGetString(g_a_Aliases,g_i_AliasNum[i_Player],s_CurAlias,63);
        
read_argv(0,s_Arg,63);
        if(
equal(s_CurAlias,s_Arg)) {
            if(
task_exists(i_Player+OFFSET)) {
                
remove_task(i_Player+OFFSET);
            }
            
g_i_AliasNum[i_Player]++;
            
g_i_Warnings[i_Player]=0;
            
start_check_aliases(i_Player);
        }
        else if(
equal(g_a_RandCmd[i_Player],s_Arg)) {
            
g_i_Warnings[i_Player]++;
        }
        else {
            return 
PLUGIN_CONTINUE;
        }
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;


But how can I make the players detected with aliases be banned? Please help me with the script :)

fysiks 10-10-2020 01:36

Re: Alias client cmd blocker
 
It's already built into the plugin to allow you to do anything you want as a punishment (the plugin calls it "ban type"). Simply set the ban type cvar to "amx_ban <userid> 0".


All times are GMT -4. The time now is 13:50.

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