Skip to main content

squadrcon

CI PyPI Python versions License: MIT

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.typed marker

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/:

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

squadrcon-0.1.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

squadrcon-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

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

Hashes for squadrcon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 79393d175d29978b7a6ed0738035658517e86ba238e4d15556f98b45e0821f7e
MD5 8b9150e0e95826ed2e3f9408c52b6ad1
BLAKE2b-256 03d4df3efa0d5523873ec848fee3aecb5ee0aff97af7b4c66462409f54d530e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for squadrcon-0.1.1.tar.gz:

Publisher: publish.yml on g0vguy/squadrcon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for squadrcon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a47861d3b5d3df6ee56cff1ed3d6f632eef1d9c92964d1a7ba724b6d30e7aac6
MD5 1644efdde6e43bcff00ba64403d08e4b
BLAKE2b-256 bdb558e71400ce95122731e2eeb9276fdec99132b7d2b41889e841e7900b1f9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for squadrcon-0.1.1-py3-none-any.whl:

Publisher: publish.yml on g0vguy/squadrcon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page