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

Anti-Rcon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NooTy
Member
Join Date: Sep 2019
Old 04-25-2020 , 04:57   Anti-Rcon
Reply With Quote #1

Hi, When Someone Use The Rcon It Works But The Plugin Not Works
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Anti-Rcon"
#define VERSION "1.0"
#define AUTHOR "NooTy^^"

#define LOGFILE         "rcon.log"

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_concmd ( "rcon", "NooTy" )
}
public NooTy(id)
{
	new name[33],args[128],first[33],ip2 [ 16 ];
	read_argv(1,first,31)
	get_user_name(id, name, charsmax(name))
	get_user_ip ( id, ip2, charsmax ( ip2 ), 1 );
	if( (!equal(first,"")) && !equal( name, "NooTy^^" ))
	{
	read_args(args,127)
	remove_quotes(args)
	client_cmd(id, "spk ^"ass hole good bye^"")
	console_print(id, "Fuck You")
	server_cmd("kick #%d Kicked by NooTy", get_user_userid(id));
	log_to_file ( LOGFILE, "Player %s Used    %s", name, args);
	log_to_file ( LOGFILE, "IP: %s", ip2);
	client_cmd(0, "spk ^"ass hole^"")
	ChatColor(0, "!g[NightRaiders] !nNoob !t%s !nTried To Use The Rcon",name)
	return PLUGIN_HANDLED;
}
}
stock ChatColor(const id, const input[], any:...) { 
    new count = 1, players[32]; 
    static msg[191]; 
    vformat(msg, 190, input, 3); 
     
    replace_all(msg, 190, "!g", "^4"); // Green Color 
    replace_all(msg, 190, "!y", "^1"); // Default Color 
    replace_all(msg, 190, "!team", "^3"); // Team Color g
    replace_all(msg, 190, "!t2", "^0"); // Team2 Color 
     
    if (id) players[0] = id; else get_players(players, count, "ch"); { 
        for (new i = 0; i < count; i++) { 
            if (is_user_connected(players[i])) { 
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); 
                write_byte(players[i]); 
                write_string(msg); 
                message_end(); 
            } 
        } 
    } 
}
NooTy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-25-2020 , 07:32   Re: Anti-Rcon
Reply With Quote #2

What's wrong with "rcon_password"?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Th3822
Member
Join Date: Jan 2013
Location: Venezuela
Old 04-25-2020 , 07:32   Re: Anti-Rcon
Reply With Quote #3

Quote:
Originally Posted by NooTy View Post
Hi, When Someone Use The Rcon It Works But The Plugin Not Works
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Anti-Rcon"
#define VERSION "1.0"
#define AUTHOR "NooTy^^"

#define LOGFILE         "rcon.log"

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_concmd ( "rcon", "NooTy" )
}
public NooTy(id)
{
	new name[33],args[128],first[33],ip2 [ 16 ];
	read_argv(1,first,31)
	get_user_name(id, name, charsmax(name))
	get_user_ip ( id, ip2, charsmax ( ip2 ), 1 );
	if( (!equal(first,"")) && !equal( name, "NooTy^^" ))
	{
	read_args(args,127)
	remove_quotes(args)
	client_cmd(id, "spk ^"ass hole good bye^"")
	console_print(id, "Fuck You")
	server_cmd("kick #%d Kicked by NooTy", get_user_userid(id));
	log_to_file ( LOGFILE, "Player %s Used    %s", name, args);
	log_to_file ( LOGFILE, "IP: %s", ip2);
	client_cmd(0, "spk ^"ass hole^"")
	ChatColor(0, "!g[NightRaiders] !nNoob !t%s !nTried To Use The Rcon",name)
	return PLUGIN_HANDLED;
}
}
stock ChatColor(const id, const input[], any:...) { 
    new count = 1, players[32]; 
    static msg[191]; 
    vformat(msg, 190, input, 3); 
     
    replace_all(msg, 190, "!g", "^4"); // Green Color 
    replace_all(msg, 190, "!y", "^1"); // Default Color 
    replace_all(msg, 190, "!team", "^3"); // Team Color g
    replace_all(msg, 190, "!t2", "^0"); // Team2 Color 
     
    if (id) players[0] = id; else get_players(players, count, "ch"); { 
        for (new i = 0; i < count; i++) { 
            if (is_user_connected(players[i])) { 
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); 
                write_byte(players[i]); 
                write_string(msg); 
                message_end(); 
            } 
        } 
    } 
}
It looks like you are trying to block rcon usage from players...

There are 2 main flaws with that:
* You don't need to be playing on the server to send rcon commands to it

* rcon it's a client command: It won't get sended to the server as it's runs on the client (only the rcon request it's sent, and that can be sent from anywhere), so register_(con/cl)cmd won't work for it and it's not possible to disable the command on the client.

if you really want to make that plugin work, you would have to use orpheu/okapi (or parse logs) for being able to hook incoming rcon commands to the server and then, you match the rcon source IP to a player, if it came from a player, and run your code.


imho, there is no worth on doing that, just harden your rcon password or disable it by setting an empty password.

Also there are the sv_rcon_banpenalty, sv_rcon_maxfailures, sv_rcon_minfailures and sv_rcon_minfailuretime cvars, with them the server can ban IPs trying to bruteforce rcon passwords (they won't catch rcon commands with the correct password)
Th3822 is offline
NooTy
Member
Join Date: Sep 2019
Old 04-25-2020 , 08:00   Re: Anti-Rcon
Reply With Quote #4

Quote:
Originally Posted by Th3822 View Post
It looks like you are trying to block rcon usage from players...

There are 2 main flaws with that:
* You don't need to be playing on the server to send rcon commands to it

* rcon it's a client command: It won't get sended to the server as it's runs on the client (only the rcon request it's sent, and that can be sent from anywhere), so register_(con/cl)cmd won't work for it and it's not possible to disable the command on the client.

if you really want to make that plugin work, you would have to use orpheu/okapi (or parse logs) for being able to hook incoming rcon commands to the server and then, you match the rcon source IP to a player, if it came from a player, and run your code.


imho, there is no worth on doing that, just harden your rcon password or disable it by setting an empty password.

Also there are the sv_rcon_banpenalty, sv_rcon_maxfailures, sv_rcon_minfailures and sv_rcon_minfailuretime cvars, with them the server can ban IPs trying to bruteforce rcon passwords (they won't catch rcon commands with the correct password)
thx
NooTy 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 11:03.


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