Giter VIP home page Giter VIP logo

rcon's Introduction

RCON

CI CodeQL GitHub tag (with filter) GitHub repository size GitHub release downloads GitHub commit activity

This is a command-line RCON (remote console) client for Minecraft and the Source Engine.

๐Ÿ“œ Background

I host game servers for my community and friends, thus I require a reliable way to remotely control them over command-line on the host server. There are many tools available to do this already, such as mcrcon which served as an inspiration for this project. However, once I started needing one for the Source Engine too, I felt I should make my own as I did not want to be different multiple utilities for each game.

I decided to create this project in Go as it is perfect for small single-executable utilities that need to work across a variety of platforms. Go has a vast standard library too, eliminating the hastle of downloading and importing third-party libraries.

๐Ÿ“ฅ Usage

Download the latest release for your platform. There are builds available for Linux and Windows, on 32-bit and 64-bit architectures of x86 and ARM. There are extra Linux builds to accommodate glibc and musl libraries. This should cover the majority of use cases.

The utility expects, at minimum, a protocol and command to be provided. The server's IP address, password, and more, can be specified using optional flags. The server response is displayed as the output, so long as the connection and authentication was successful.

Each argument will be treated as a separate command, so wrap commands in quotation that contain spaces. For example, "sv_cheats 1" would be considered a single command but sv_cheats 1 would be considered as two commands.

โš™๏ธ Flags

There are different protocols implemented. Exactly one must be chosen via a flag:

There are additional optional flags for fine-tuning functionality:

  • --address <string>: The remote server's IPv4 address. Defaults to 127.0.0.1.
  • --port <number>: The remote server's port number. Defaults to the selected protocol's default.
  • --password <string>: The remote console password. Defaults to nothing.
  • --interval <number>: The time to wait in seconds between sending commands, only useful when multiple commands are specified. Defaults to 1.

These flags can be prefixed with either a single (-) or double (--) hyphen.

The flags can be provided in any order, but the arguments (the commands to execute) must come last.

Use the --help (-h) flag for more information.

๐Ÿ–ผ๏ธ Examples

Viewing the status of a Garry's Mod server at 192.168.0.5 using the default port 27015:

$ rcon -sourceengine -address 192.168.0.5 -password verySecurePassword123 status
hostname: Example Server
version : 2022.06.08/24 8606 insecure
udp/ip  : 192.168.0.5:27015
map     : gm_construct at: 0 x, 0 y, 0 z
players : 0 (10 max)

# userid name                uniqueid            connected ping loss state  adr

Enabling cheats on a Team Fortress 2 server at 127.0.0.1 using the custom port 27020:

$ rcon -sourceengine -port 27020 -password superRealPassword567 sv_cheats 1
L 07/29/2022 - 20:59:32: server_cvar: "sv_cheats" "1"

Banning an IP address on a Team Fortress 2 server at 127.0.0.1 using the default port 27015:

$ rcon --password aw3s0meP4ssw0rd --sourceengine addip 60 192.168.0.100
L 07/29/2022 - 21:00:54: Addip: "<><><>" was banned by IP "for 60.00 minutes" by "Console" (IP "192.168.0.100")

Listing online players on a Minecraft server at 192.168.0.10 using the default port 25575:

$ rcon -address 192.168.0.10 -minecraft -password reallyG00dPassword list
There are 0 of a max of 20 players online:

โš–๏ธ License

Copyright (C) 2022-2023 viral32111.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses.

rcon's People

Contributors

dependabot[bot] avatar viral32111 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rcon's Issues

Environment Variable Configuration

Use environment variables as fallback for flags & arguments.

  • RCON_ADDRESS=192.168.0.5
  • RCON_PORT=27015
  • RCON_PASSWORD=abcxyz
  • RCON_COMMAND=status

Error Handling

There needs to be more protocol-specific error handling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.