Member
Join Date: Jan 2013
Location: Venezuela
|
04-25-2020
, 07:32
Re: Anti-Rcon
|
#3
|
Quote:
Originally Posted by NooTy
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)
|
|