Provides forwards for handling RCon auth and commands from within SourceMod plugins.
This extension borrows some knowledge from the former gmsv_rcon extension for gmod, and expands on it with more functionality reversed.
Currently, only the Source 2007, Source 2009, L4D and L4D2 engines are supported. This includes:- CS:GO
- CS:S
- TF2
- DOD:S
- HL2DM
- Left 4 Dead
- Left 4 Dead 2
- Ep2 / 2007 Mods
Support for more engines can (probably) be added if there is interest.
PHP Code:
/**
* @brief Called when an RCon session auth is processed
*
* @param rconId RCon listener ID, unique per session.
* @param address Originating IP address.
* @param password Password sent by RCon client.
* @param allow True to grant auth, false otherwise.
* @return Plugin_Changed to use given allow value, Plugin_Continue to let engine process.
*/
forward Action SMRCon_OnAuth(int rconId, const char[] address, const char[] password, bool &allow);
/**
* @brief Called when an RCon command is processed.
*
* @note Rejection here does not count as a bad password attempt;
* however, the RCon log line will be annotated in the form
* of 'command (rejected) "%s"' rather than just 'command "%s"'
*
* @param rconId RCon listener ID, unique per session.
* @param address Originating IP address.
* @param command Command sent by RCon client.
* @param allow True to allow command to be processed, false otherwise.
* @return Plugin_Changed to use given allow value, Plugin_Continue to let engine process.
*/
forward Action SMRCon_OnCommand(int rconId, const char[] address, const char[] command, bool &allow);
/**
* @brief Called when an RCon session is disconnected.
*
* @param rconId RCon listener ID, unique per session.
*/
forward void SMRCon_OnDisconnect(int rconId);
/**
* @brief Called when an RCon log line is written
*
* @param rconId RCon listener ID, unique per session.
* @param address Originating IP address.
* @param logdata Log data (usually either "Bad Password" or "command"
* followed by the command.
* @return Plugin_Continue to log, Plugin_Handled to block.
*/
forward Action SMRCon_OnLog(int rconId, const char[] address, const char[] logdata);
/**
* @brief Determines whether current server command originated from an RCon session.
*
* @return True if command originated from RCon session, false if from console or not in server command callback.
*/
native bool SMRCon_IsCmdFromRCon();
Unlike this extension, linux builds are available, RCon listeners' unique id is passed through so SM, RCon disconnections are passed, server command callbacks can be identified as from RCon, extended rcon logging support is available, and most importantly, unauthed RCon commands are not passed to SM.
Source code:
https://github.com/psychonic/smrcon