RCON v1.0.1
Control your server with any telnet client!
RCON v1.0.1 is released!
+ IntroductionHi there, I'm new to this community, and so far I've been enjoying the new version (0.4), so I decided to try and write a plugin. I started thinking about important things that would come in handy for a server administrator, when I was told that VC-MP no longer has RCON functionality. So I started working on this plugin. I'm not too experienced in C/++ and the development/improvement of the plugin is in progress, as there may be some issues which I will work to fix if they are found.
+ About PluginI started working on this plugin around 10 days ago, I have been too excited to get this plugin working asap. So far, it's been mostly stable! Even though I didn't test the plugin as much as it deserves, but I hope it runs well. Please report bugs whenever you discover them!
This plugin creates a TCP socket and binds on a configured port, then it accepts client connections, which will need to identify to the server with a password to be able to control the server. Everything will be documented below.
+ Source CodeThe source code can be found here (https://github.com/Kirollos/VCMP_RCON)
Note: Pull requests are welcomed!
+ DownloadsPlugin binaries (compiled on both Windows and Linux) can be found here (https://github.com/Kirollos/VCMP_RCON/releases)
+ ConfigurationOn the first installation, you need to run the server with the plugin, then you can shut down the server.
This plugin's configuration entries can be found in server.cfg as the following:
rcon_enabled false
rcon_port 1337
rcon_bindip 0.0.0.0
rcon_password plschange
- rcon_enabled [true/false]
- rcon_port [integer]
- rcon_bindip [IPv4] - Binds the RCON socket to a specific IP address. Set it to "0.0.0.0" to bind it on all IP addresses
- rcon_password [string] - The RCON password
+ How-to compile - Windows: Just load the visual studio solution file and compile. All should work with no problems.
- Linux: running "make" in the main directory shall do everything needed.
Note that you need to run "make release32" for x86 server and "make release64" for x64 server!
+ How-to useThis plugin can be accessed with almost any telnet client. PuTTY can work in Raw/Telnet mode as well.
Some clients that are written by me can be found here (https://github.com/Kirollos/VCMP_RCON/tree/master/clients).
+ Built-in commandsAll the commands can be found type sending "help".
+ Squirrel related stuffThis plugin gives you more ability to control it through your scripts, adding your own commands, etc.
This plugin sends a callback to squirrel if the input command is not defined in the main plugin commands, which is:
function RCON_OnCommand(clientid, ip, command, params)
- integer clientid - The ID of the client that requested the command (Note: clientid is not usually unique!)
- string ip - The client's IPv4 address
- string command - The requested command
- string params - The requested parameters
The plugin also provides the following functions:
RCON_Send(int clientid, string text);
RCON_Broadcast(string text);
RCON_GetClients();
/*
This function returns an array which looks like this:
[
// [string IP, bool IDENTIFIED]
["127.0.0.1", true], // first client
["192.168.1.2", false], // second client
... // etc..
]
*/
+ Thanks to- VC-MP team for their SDK header.
- Whoever has written the plugin SDK introduction page on the wiki.
- Castagna - Motivated me to start working on my plugin.
- SLC - Introduced me to SQImports and stuff..
- Sachiko - Helped w/ testing the plugin and catching some bugs.
- Many others helped me w/ the testing.
* This topic will be updated regularly and will be more organised!
Good one Kiro :D
Yup. Good one, bruh. Can't wait for the progress it makes.
Nice work :D
Nice work!
Console ftw! but still the effort here cannot be neglected! ;)
Mmm... A small suggestion. Remove the Squirrel library as it's not needed. All the squirrel function pointers are shared by the main Squirrel module through the HSQAPI (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/inc/SQModule.h#L193) structure pointer declared (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/src/main.h#L47) in `main.h` and then defined (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/src/main.cpp#L27) and initialized (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/src/main.cpp#L134) in `main.cpp` Therefore, instead of having to include Squirrel source in your project. Whenever you see any Squirrel API functions that start with something like `sq_(name)`, you should replace that with `sqapi->(name)` Thus, `sq_pushroottable(...)` will become `sqapi->pushroottable(...)`. Doing that will not need the Squirrel source to be included in the project. Just make sure you include `main.h` whenever you want to use the Squirrel API. And keep only `squirrel.h` and `sqconfig.h` from the squirrel source.
This could have recursions when the squirrel version that you're using doesn't match with the Squirrel version of the plugin.
Thanks all for your comments! I hope it is running smoothly for you.
Quote from: S.L.C on Sep 21, 2015, 05:51 PMMmm... A small suggestion. Remove the Squirrel library as it's not needed. All the squirrel function pointers are shared by the main Squirrel module through the HSQAPI (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/inc/SQModule.h#L193) structure pointer declared (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/src/main.h#L47) in `main.h` and then defined (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/src/main.cpp#L27) and initialized (https://github.com/Kirollos/VCMP_RCON/blob/master/RCON/src/main.cpp#L134) in `main.cpp` Therefore, instead of having to include Squirrel source in your project. Whenever you see any Squirrel API functions that start with something like `sq_(name)`, you should replace that with `sqapi->(name)` Thus, `sq_pushroottable(...)` will become `sqapi->pushroottable(...)`. Doing that will not need the Squirrel source to be included in the project. Just make sure you include `main.h` whenever you want to use the Squirrel API. And keep only `squirrel.h` and `sqconfig.h` from the squirrel source.
This could have recursions when the squirrel version that you're using doesn't match with the Squirrel version of the plugin.
I don't know why I haven't taken that into consideration. In fact, I used that method in a part of my code, but didn't think it would actually work without linking to squirrel library. Thanks! (https://github.com/Kirollos/VCMP_RCON/commit/e93c9eed0762fb112c4362a5f76c700878ec019b) :)
I've written a node.js client for this plugin :D. It creates a minimal webserver on a specific port (with optional SSL) and launches a terminal-like webpage where you can control your server with it. This client can be found here (https://github.com/Kirollos/VCMP_RCON/tree/master/clients/node.js).
Here's a list of bugs which I had told you in IRC, just in-case to remind you :P
- When I press enter in Putty without any text in it, the server crashes.
- You should disable the callbacks for everything, the reason is: One day, someone registered in my server, and I was able to see his pass because it showed the command in the RCON client along with the text in it, and I like my custom text for any callback too.
- The ID is not getting back to 0. for ex:- I joined the RCON with my PC, which ID was 0, I quitted from it, then joined from my laptop, it's ID was 1 instead of 0
- The text param in your function callback will call the command instead of the text in it. For ex see the last
Text param:-
Well, I was trying to execute this command:-
function RCON_OnCommand(id, ip,cmd, text){
if ( cmd == "exec" )
{
if( !text ) RCON_Send(id,">> Error - Syntax: exec <Squirrel code>");
else
{
try
{
local script = compilestring( text );
script();
RCON_Send(id,">> Succesfully excecuted.");
}
catch(e) RCON_Send(id,">> Error: " + e);
}
}
}
Now when I type 'exec' without quotes in my RCON client( putty, raw mode ) then it shows:- "Successfully executed" instead of showing the syntax error.
I need to use GetTok( text, " ", 1 ) instead of text to make it work.
RCON v1.0.1.0 is released!
You can find the new version here (https://github.com/Kirollos/VCMP_RCON/releases/tag/1.0.1.0).
Changelog:
- Fixed a crash when you only send \r\n to server
- Added the ability to toggle builtin server events
- Clients were not removed from client-vector on disconnection
- Pushing null instead of an empty string if no parameter was sent
- Plugin version shows @ console on server startup
Thank you all for your support!
Quote from: Kirollos on Dec 31, 2015, 08:14 PMRCON v1.0.1.0 is released!
You can find the new version here (https://github.com/Kirollos/VCMP_RCON/releases/tag/1.0.1.0).
Changelog:
- Fixed a crash when you only send \r\n to server
- Added the ability to toggle builtin server events
- Clients were not removed from client-vector on disconnection
- Pushing null instead of an empty string if no parameter was sent
- Plugin version shows @ console on server startup
Thank you all for your support!
I think it's better to use it through WebSocket!
Quote from: ysc3839 on Jan 01, 2016, 04:11 AMQuote from: Kirollos on Dec 31, 2015, 08:14 PMRCON v1.0.1.0 is released!
You can find the new version here (https://github.com/Kirollos/VCMP_RCON/releases/tag/1.0.1.0).
Changelog:
- Fixed a crash when you only send \r\n to server
- Added the ability to toggle builtin server events
- Clients were not removed from client-vector on disconnection
- Pushing null instead of an empty string if no parameter was sent
- Plugin version shows @ console on server startup
Thank you all for your support!
I think it's better to use it through WebSocket!
At first I was thinking about just using any known socketing library and save myself from headache, but I've found myself writing my own one a better idea in terms of practising since I'm practising C/++ by writing projects. I appreciate your suggestion though :).
*BUMP*
Update the SDK. I need this plugin beri much
:edit: Just checked the source, you didn't tell us about RCON_KickClient :D
https://github.com/Thijn/VCMP_RCON/commit/80175e772c50b700c7fb52b42023e0c6a35a4548
Currently compiling. Will edit this when done.
:edit: Builds up at http://thijn.ovh/vcmp/builds/
Make sure you install the 2015 c++ redistributable (https://www.microsoft.com/en-us/download/details.aspx?id=48145) if you're using it on windows.
Quote from: Thijn on May 03, 2016, 05:08 PMhttps://github.com/Thijn/VCMP_RCON/commit/80175e772c50b700c7fb52b42023e0c6a35a4548
Currently compiling. Will edit this when done.
:edit: Builds up at http://thijn.ovh/vcmp/builds/
Make sure you install the 2015 c++ redistributable (https://www.microsoft.com/en-us/download/details.aspx?id=48145) if you're using it on windows.
Thank you! Appreciated :)
Quote from: KAKAN on May 03, 2016, 01:18 PM*BUMP*
Update the SDK. I need this plugin beri much
:edit: Just checked the source, you didn't tell us about RCON_KickClient :D
I added RCON_KickClient to github repo but I've never released binaries of that version, been busy with school and exams :(.
Just ran the server, when I connected a telnet client and typed something, the server crashed :(
Quote from: KAKAN on May 17, 2016, 03:13 AMJust ran the server, when I connected a telnet client and typed something, the server crashed :(
I'm sorry, I'm not able to replicate that issue. Can you please help?