mcrconpy


Namemcrconpy JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryRCON protocol client for the Minecraft server.
upload_time2025-08-19 03:49:19
maintainerNone
docs_urlNone
authorkurotom
requires_python<4.0,>=3.9
licenseMIT
keywords rcon remote console
VCS
bugtrack_url
requirements platformdirs
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mcrconpy

Client to use the RCON protocol to execute commands on a Minecraft Java server.

> [!IMPORTANT]
> The RCON protocol transmits data in plain text, without encryption, so it is necessary to use an SSH tunnel or VPN if communication is carried out over the Internet.
>
> Python 3.9+.

You can log the activity or commands executed by the user in JSONL file format, located at:

* Linux: `/home/{user}/.local/state/mcrconpy/log` or `/home/{user}/.local/share/mcrconpy/log`.
* macOS: `/Users/{user}/Library/Logs/mcrconpy`.
* Windows: `C:\Users\{user}\AppData\Local\mcrconpy\logs`.


To enable the RCON protocol on your server, you must modify the following lines in the **server.properties** file and open the designated port:

```text
enable-rcon=true
rcon.password=<your password>
rcon.port=<1-65535>
broadcast-rcon-to-ops=false
```


# Installation

```bash
$ pip install mcrconpy
```


# CLI

```text
$ mcrconpy --help
usage: mcrconpy [-h] -a ADDRESS [-p PORT] -P PASSWORD [-A]

RCON protocol client for minecraft servers.

optional arguments:
  -h, --help            show this help message and exit
  -a ADDRESS, --address ADDRESS
                        Minecraft Server TCP address.
  -p PORT, --port PORT  Minecraft Server RCON Port. Default is 25575.
  -P PASSWORD, --password PASSWORD
                        User password.
  -A, --audit           Saves all commands executed by the user in a JSONL file. Default is disabled.

Connect remotely to the server and perform administrative tasks.
```


# Usage

* When using `with`, don't worry about closing the connection; it will close automatically and properly.

```python
from mcrconpy import RconPy


with RconPy(
    address="127.0.0.1",
    port=25575,
    password="test",
    audit=False,
) as rcon:
    print(rcon)

    rcon.connect()

    rcon.login()

    print("> is connected?", rcon.check_connection())
    print("> is login?", rcon.is_login())

    print(rcon.command(command="time query daytime"))
    print(rcon.command(command="//time set night"))
```

* Manually open and close the connection to the server. *Remember to close the connection*.

```python
from mcrconpy import RconPy


rcon = RconPy(
              address="127.0.0.1",
              port=25575,
              password="test",
              audit=False,
          )

print(rcon)

rcon.connect()

rcon.login()

print("> is connected?", rcon.check_connection())
print("> is login?", rcon.is_login())

print(rcon.command(command="time query daytime"))
print(rcon.command(command="//time set night"))

rcon.disconnect()
```


# Methods

| Methods | Description |
|-|-|
| `set_password` | Sets the user's password. |
| `get_password` | Gets the user's password. |
| `is_login` | Checks if the current user is logged in to the server. |
| `connect` | Connects to the RCON server. |
| `login` | Login the current user in to the server. |
| `command` | Executes the given command. |
| `check_connection` | Checks if the connection to the server is active. |
| `disconnect` | Disconnects from the server. |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mcrconpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "rcon, remote console",
    "author": "kurotom",
    "author_email": "55354389+kurotom@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/87/b4/914bf0727b79f4d8209e0458bf7eec1b43714af6fb6dff7314c9df063831/mcrconpy-0.1.1.tar.gz",
    "platform": null,
    "description": "# mcrconpy\n\nClient to use the RCON protocol to execute commands on a Minecraft Java server.\n\n> [!IMPORTANT]\n> The RCON protocol transmits data in plain text, without encryption, so it is necessary to use an SSH tunnel or VPN if communication is carried out over the Internet.\n>\n> Python 3.9+.\n\nYou can log the activity or commands executed by the user in JSONL file format, located at:\n\n* Linux: `/home/{user}/.local/state/mcrconpy/log` or `/home/{user}/.local/share/mcrconpy/log`.\n* macOS: `/Users/{user}/Library/Logs/mcrconpy`.\n* Windows: `C:\\Users\\{user}\\AppData\\Local\\mcrconpy\\logs`.\n\n\nTo enable the RCON protocol on your server, you must modify the following lines in the **server.properties** file and open the designated port:\n\n```text\nenable-rcon=true\nrcon.password=<your password>\nrcon.port=<1-65535>\nbroadcast-rcon-to-ops=false\n```\n\n\n# Installation\n\n```bash\n$ pip install mcrconpy\n```\n\n\n# CLI\n\n```text\n$ mcrconpy --help\nusage: mcrconpy [-h] -a ADDRESS [-p PORT] -P PASSWORD [-A]\n\nRCON protocol client for minecraft servers.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -a ADDRESS, --address ADDRESS\n                        Minecraft Server TCP address.\n  -p PORT, --port PORT  Minecraft Server RCON Port. Default is 25575.\n  -P PASSWORD, --password PASSWORD\n                        User password.\n  -A, --audit           Saves all commands executed by the user in a JSONL file. Default is disabled.\n\nConnect remotely to the server and perform administrative tasks.\n```\n\n\n# Usage\n\n* When using `with`, don't worry about closing the connection; it will close automatically and properly.\n\n```python\nfrom mcrconpy import RconPy\n\n\nwith RconPy(\n    address=\"127.0.0.1\",\n    port=25575,\n    password=\"test\",\n    audit=False,\n) as rcon:\n    print(rcon)\n\n    rcon.connect()\n\n    rcon.login()\n\n    print(\"> is connected?\", rcon.check_connection())\n    print(\"> is login?\", rcon.is_login())\n\n    print(rcon.command(command=\"time query daytime\"))\n    print(rcon.command(command=\"//time set night\"))\n```\n\n* Manually open and close the connection to the server. *Remember to close the connection*.\n\n```python\nfrom mcrconpy import RconPy\n\n\nrcon = RconPy(\n              address=\"127.0.0.1\",\n              port=25575,\n              password=\"test\",\n              audit=False,\n          )\n\nprint(rcon)\n\nrcon.connect()\n\nrcon.login()\n\nprint(\"> is connected?\", rcon.check_connection())\nprint(\"> is login?\", rcon.is_login())\n\nprint(rcon.command(command=\"time query daytime\"))\nprint(rcon.command(command=\"//time set night\"))\n\nrcon.disconnect()\n```\n\n\n# Methods\n\n| Methods | Description |\n|-|-|\n| `set_password` | Sets the user's password. |\n| `get_password` | Gets the user's password. |\n| `is_login` | Checks if the current user is logged in to the server. |\n| `connect` | Connects to the RCON server. |\n| `login` | Login the current user in to the server. |\n| `command` | Executes the given command. |\n| `check_connection` | Checks if the connection to the server is active. |\n| `disconnect` | Disconnects from the server. |\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RCON protocol client for the Minecraft server.",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/kurotom/mcrconpy/issues"
    },
    "split_keywords": [
        "rcon",
        " remote console"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6e98bc4379c1343f502a418faa91c04c1936bbb60a2af6d64e76a2d025298e1",
                "md5": "e7473bd82687c694644b012c529250c3",
                "sha256": "8bdb0da00a2532bc47ece00b51723b2382620993b755d6e6a09adfbe486e34cc"
            },
            "downloads": -1,
            "filename": "mcrconpy-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e7473bd82687c694644b012c529250c3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 13105,
            "upload_time": "2025-08-19T03:49:19",
            "upload_time_iso_8601": "2025-08-19T03:49:19.018637Z",
            "url": "https://files.pythonhosted.org/packages/d6/e9/8bc4379c1343f502a418faa91c04c1936bbb60a2af6d64e76a2d025298e1/mcrconpy-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87b4914bf0727b79f4d8209e0458bf7eec1b43714af6fb6dff7314c9df063831",
                "md5": "d7dec2ed52a2c665c91c9430f365c153",
                "sha256": "43aefd1fbd9deff69fc572a5fe5174e4a1e9e68a2263f0d523c6c2845f0ebf90"
            },
            "downloads": -1,
            "filename": "mcrconpy-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d7dec2ed52a2c665c91c9430f365c153",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 9908,
            "upload_time": "2025-08-19T03:49:19",
            "upload_time_iso_8601": "2025-08-19T03:49:19.862161Z",
            "url": "https://files.pythonhosted.org/packages/87/b4/914bf0727b79f4d8209e0458bf7eec1b43714af6fb6dff7314c9df063831/mcrconpy-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 03:49:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kurotom",
    "github_project": "mcrconpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "platformdirs",
            "specs": [
                [
                    "==",
                    "4.3.8"
                ]
            ]
        }
    ],
    "lcname": "mcrconpy"
}
        
Elapsed time: 1.13720s