ARK: Survival Evolved

ARK: Survival Evolved

Not enough ratings
RCON Command-Line Utility
By LHammonds
This utility can be compiled for Linux or Windows (maybe even Mac) but can be used to send RCON commands to game servers running on Linux, Windows or Mac.

I modified the original source code by [AZY]Zyrain primarily to remove the password from the command-line arguments due to it being a security risk exposing the password in plain view by anyone able to view the process list. I also made a few other modifications to my liking.
   
Award
Favorite
Favorited
Unfavorite
NAME
rcon - Execute rcon commands
SYNOPSIS
rcon <-f "filename.ini"> [-a IPNumber] [-p Port] <command>
DESCRIPTION
Linux command line utility to send rcon commands.

Any command line parameter will take precedence over the corresponding option in the INI file.
OPTIONS
-f -a -p and command are all necessary. However, only -f and command are required as command-line arguments. If address and port are in the file, it is not required to pass them as arguments.

-? Shows the usage syntax and quits.

-v Enables verbose mode which means more detailed messages.

-f "filename.ini" Location to .ini file containing at least the password.

-a IPNumber IP Address of the rcon server. This option is not needed if added to the .ini file.

-p Port Port on the rcon server. This option is not needed if added to the .ini file.

command rcon command to send to the rcon server.
FILE FORMAT
[rcon] password=YOUR_RCON_PASSWORD ipaddress=127.0.0.1 port=27015
EXAMPLES
Run a DoExit command:
rcon -f "/etc/rcon.ini" -a 127.0.0.1 -p 27015 "DoExit"

Run a DoExit command and use the address and port defined in ini file:
rcon -f "/etc/rcon.ini" "DoExit"

Run a Broadcast message command using an island-instance ini file:
rcon -f "/etc/rcon-island.ini" "Broadcast About to save the world!"

Run a SaveWorld command using a ragnarok-instance ini file:
rcon -f "/etc/rcon-ragnarok.ini" "SaveWorld"
EXIT CODES
0 = Good
1 = Unknown option
2 = Missing file parameter
3 = Missing command parameter
4 = Missing address parameter/config
5 = Missing port parameter/config
6 = Invalid file or format
7 = Connect failed
8 = Error sending password
9 = Could not authenticate
10 = Command send error
SEE ALSO
Original Author Site[www.ryanschulze.net]
COMPILE FOR LINUX
If you do not have the gcc compiler installed, you can do so with these commands for Ubuntu/Debian:
sudo apt update sudo apt install build-essential

Download the source code using these commands:

Once you have the rcon.c code downloaded, you can compile it using this command:

gcc -o /tmp/rcon /tmp/rcon.c

Copy the utility where the system can find it.
cp /tmp/rcon /usr/local/bin/.

You also want to setup your configuration file.
cat << EOF > /etc/rcon.ini [rcon] password=YOUR_RCON_PASSWORD ipaddress=127.0.0.1 port=27015 EOF

Copy the man page where the system can find it.
cp /tmp/rcon.man /usr/local/share/man/man1/rcon.1

Then you can access the manual by typing the following from anywhere:
man rcon

Do not forget to set file access permissions appropriate to your system.
COMPILE FOR WINDOWS
Download "setup-x86_64.exe" from Cygwin[cygwin.com] and install Cygwin using the default packages. When done installing, move the "setup-x86_64.exe" to C:\cygwin64\ so you can use it later to make adjustments to your installation.

Now run this command to install gcc:
setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel

Run the C:\cygwin64\cygwin.bat to open a bash prompt.

Download the source code using these commands:

Once you have the rcon.c code downloaded, you can compile it using this command:

gcc -o rcon.exe rcon.c

Copy the rcon.exe to wherever you need it. It will be in C:\cygwin64\home\{username}\rcon.exe

You also want to setup your configuration file.

rcon.ini
[rcon] password=YOUR_RCON_PASSWORD ipaddress=127.0.0.1 port=27015
< >
2 Comments
LHammonds  [author] Apr 23, 2021 @ 5:28pm 
If you want to add your own custom icon (rcon.ico) and provide file details when someone clicks on "Properties" then download the rcon-data.rc and rcon-icon.rc files from the github site and issue the following commands to create the .res files and then include them when compiling the .exe

https://github.com/LHammonds/c

windres rcon-icon.rc -O coff -o rcon-icon.res
gcc -o rcon.exe rcon.c rcon-icon.res rcon-data.res
LHammonds  [author] Apr 23, 2021 @ 7:36am 
Figured out how to compile it on Windows 10 and included instructions for Linux and Windows.