19.03.2015, 01:24
(
Последний раз редактировалось Abagail; 27.05.2017 в 14:27.
)
Managing RCON packets
NOTE: This tutorial uses my RemoteRCON include. You'll need it, or NOTHING will work! It can be found at the bottom of this post. Since the include requires YSF(r11 or above) you'll need that too.
General Notes:
* It is advised to use the logging functions to track and log RCON information such as a user executing a command, a failed login attempt and more. You can do this by using ToggleLogging.
* Note that this include only covers remote logins/access, it does not cover the in-game rcon command system.
Dropping remote RCON packets:
A nice feature of the OnRemoteRCONPacket function included into YSF is the ability to simply by returning 0 drop an RCON packet. Dropping an RCON packet destroys the packet / command, so that it doesn't go through the server.
Say you don't want a certain command to be used by a remote administrator(such as the "gravity") command. You can simply return 0 if the "command" parameter contains the gravity keyword.
Easy, right? That can pretty much go for all commands, and even completely disallowing someone a certain RCON function such as connecting with rcon.exe.
Whitelisting IP addresses:
Whitelisting an IP address is a great feature - it allows you to block unwanted visitors. Anyone not whitelisted when the whitelisting mode is enabled(through ToggleRemoteWhitelist) will simply be "ignored" and have any (even successful) packets dropped.
To use it you simply need to enable the whitelist system, add an IP through WhitelistIPAddress and you're done!
In reverse, you can simply use UnwhitelistIPAddress to remove an IP from the whitelist que. You can use IsIPWhitelisted to check if a IP is whitelisted or not. Bear in mind, these IP's do NOT save so they will have to be reloaded each FS load if they are to be constant / re-loading.
Monitoring Failed / System dropped packets::
Failed packets generated by the system include non-whitelisted / unauthorized access attempts, failed access attempts(such as an invalid password), and the RCON system being turned off. When a system drops a packet it typically triggers the remote RCON fail callback.
Reasons for failures can be found below:
That's all! That tutorial should give you some ideas about how the include can be used to it's full potential. Since I am a bit busy, I will be ending this tutorial here.
As promised here is the link to the include:
http://forum.sa-mp.com/showthread.ph...59#post3407159
And YSF r12:
https://github.com/kurta999/YSF/releases/r12
NOTE: This tutorial uses my RemoteRCON include. You'll need it, or NOTHING will work! It can be found at the bottom of this post. Since the include requires YSF(r11 or above) you'll need that too.
General Notes:
* It is advised to use the logging functions to track and log RCON information such as a user executing a command, a failed login attempt and more. You can do this by using ToggleLogging.
* Note that this include only covers remote logins/access, it does not cover the in-game rcon command system.
Dropping remote RCON packets:
A nice feature of the OnRemoteRCONPacket function included into YSF is the ability to simply by returning 0 drop an RCON packet. Dropping an RCON packet destroys the packet / command, so that it doesn't go through the server.
Say you don't want a certain command to be used by a remote administrator(such as the "gravity") command. You can simply return 0 if the "command" parameter contains the gravity keyword.
pawn Код:
public OnRemoteRCONExecuted(ipaddr[], port, password[], command[])
{
if(strcmp(command, "gravity", true) == 0) // If the command parameter contains the gravity keyword, then open the following bracket statement:
{
return 0; // returning 0 drops the packet
}
return 1; // We need to return 1 so the packet gets sent properly.
}
Whitelisting IP addresses:
Whitelisting an IP address is a great feature - it allows you to block unwanted visitors. Anyone not whitelisted when the whitelisting mode is enabled(through ToggleRemoteWhitelist) will simply be "ignored" and have any (even successful) packets dropped.
To use it you simply need to enable the whitelist system, add an IP through WhitelistIPAddress and you're done!
pawn Код:
public OnFilterScriptInit()
{
ToggleRemoteWhitelist(true); // Turn the whitelist system on
WhitelistIPAddress("127.0.0.1");
return 1;
}
Monitoring Failed / System dropped packets::
Failed packets generated by the system include non-whitelisted / unauthorized access attempts, failed access attempts(such as an invalid password), and the RCON system being turned off. When a system drops a packet it typically triggers the remote RCON fail callback.
Reasons for failures can be found below:
Quote:
0 - Never called, ever(unless the callback is called outside of the include) 1 - Unwhitelisted IP address 2 - Unsuccessful login / request. 3 - RCON system is disabled. |
As promised here is the link to the include:
http://forum.sa-mp.com/showthread.ph...59#post3407159
And YSF r12:
https://github.com/kurta999/YSF/releases/r12