squadrcon
Lightweight RCON client and CLI for Squad game servers. Pure Python, zero runtime dependencies.
Features
- Connect and authenticate over Squad's RCON protocol
- List players / squads with parsed, typed output
- Kick, ban, warn, and switch a player's team
- Live event stream for chat, kicks, bans, warns
- Small CLI for quick server admin from the terminal
- Fully type-hinted, ships a
py.typedmarker
Install
pip install squadrcon
From source:
git clone https://github.com/g0vguy/squadrcon.git
cd squadrcon
pip install .
CLI usage
squadrcon --host 1.2.3.4 --port 27165 --pass yourRconPass --list
squadrcon --host 1.2.3.4 --port 27165 --pass yourRconPass --kick "PlayerName" --reason "Team killing"
squadrcon --host 1.2.3.4 --port 27165 --pass yourRconPass --kick 76561198000000000 --reason "AFK"
squadrcon --host 1.2.3.4 --port 27165 --pass yourRconPass --switch-team "PlayerName"
Env vars work too:
export SQUAD_HOST=1.2.3.4
export SQUAD_PORT=27165
export SQUAD_PASS=yourRconPass
squadrcon --list
Library usage
from squadrcon import Rcon, RconConfig, events
r = Rcon(RconConfig(host="127.0.0.1", password="123456", port="27165"))
r.emitter.on(events.CHAT_MESSAGE, lambda msg: print("chat:", msg))
r.emitter.on(events.PLAYER_KICKED, lambda k: print("kicked:", k.player_name))
players = r.list_players()
for p in players.players:
print(p.name, p.steam_id, p.team_id, p.squad_id)
r.kick("SomePlayerName", "AFK")
r.ban("76561198000000000", "1d", "Team killing")
r.switch_team("SomePlayerName")
r.close()
More runnable examples are in examples/:
basic_usage.py— connect and list playerslive_chat_logger.py— stream chat/kick/ban eventsauto_balance.py— switch players to balance team sizesdiscord_status.py— monitoring player count in server
API overview
| Method | RCON command | Description |
|---|---|---|
list_players() |
ListPlayers |
Returns a Players object with parsed Player entries |
list_squads() |
ListSquads |
Returns a Squads object with parsed Squad entries |
kick(target, reason) |
AdminKick |
Kicks by name or SteamID64 |
ban(target, duration, reason) |
AdminBan |
Bans by name or SteamID64 |
warn(target, message) |
AdminWarn |
Sends an in-game warning |
switch_team(target) |
AdminForceTeamChange |
Moves a player to the opposite team |
execute(command) |
any | Sends a raw RCON command, returns raw text |
Events available on r.emitter:
CONNECTED, RECONNECTING, CLOSE, ERROR, DATA, CHAT_MESSAGE,
PLAYER_WARNED, PLAYER_KICKED, PLAYER_BANNED
Layout
squadrcon/
protocol.py packet framing
emitter.py event emitter
events.py event name constants
types.py parsed data classes
parsers.py text -> object parsers
client.py the rcon client
cli.py command line tool (entry point: squadrcon)
tests/ pytest suite
examples/ runnable usage examples
Development
pip install -e ".[dev]"
pytest
ruff check .
See CONTRIBUTING.md.
Notes
Player/squad list parsing and broadcast-line parsing are regex based,
matched against Squad's current RCON text output format. If your
server version formats things differently, parsers.py is the place
to adjust — please open an issue with a raw sample line and it'll get
fixed.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file squadrcon-0.1.1.tar.gz.
File metadata
- Download URL: squadrcon-0.1.1.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79393d175d29978b7a6ed0738035658517e86ba238e4d15556f98b45e0821f7e
|
|
| MD5 |
8b9150e0e95826ed2e3f9408c52b6ad1
|
|
| BLAKE2b-256 |
03d4df3efa0d5523873ec848fee3aecb5ee0aff97af7b4c66462409f54d530e6
|
Provenance
The following attestation bundles were made for squadrcon-0.1.1.tar.gz:
Publisher:
publish.yml on g0vguy/squadrcon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
squadrcon-0.1.1.tar.gz -
Subject digest:
79393d175d29978b7a6ed0738035658517e86ba238e4d15556f98b45e0821f7e - Sigstore transparency entry: 2250622028
- Sigstore integration time:
-
Permalink:
g0vguy/squadrcon@49c023b06385050d54d405948616ef747420ccfc -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/g0vguy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49c023b06385050d54d405948616ef747420ccfc -
Trigger Event:
push
-
Statement type:
File details
Details for the file squadrcon-0.1.1-py3-none-any.whl.
File metadata
- Download URL: squadrcon-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a47861d3b5d3df6ee56cff1ed3d6f632eef1d9c92964d1a7ba724b6d30e7aac6
|
|
| MD5 |
1644efdde6e43bcff00ba64403d08e4b
|
|
| BLAKE2b-256 |
bdb558e71400ce95122731e2eeb9276fdec99132b7d2b41889e841e7900b1f9a
|
Provenance
The following attestation bundles were made for squadrcon-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on g0vguy/squadrcon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
squadrcon-0.1.1-py3-none-any.whl -
Subject digest:
a47861d3b5d3df6ee56cff1ed3d6f632eef1d9c92964d1a7ba724b6d30e7aac6 - Sigstore transparency entry: 2250622211
- Sigstore integration time:
-
Permalink:
g0vguy/squadrcon@49c023b06385050d54d405948616ef747420ccfc -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/g0vguy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49c023b06385050d54d405948616ef747420ccfc -
Trigger Event:
push
-
Statement type: