MCRP


NameMCRP JSON
Version 0.1.10 PyPI version JSON
download
home_pagehttps://gitlab.com/seeklay/MCRP
SummaryMinecraft MITM proxy with function of rewriting packets, written in pure Python 3
upload_time2023-06-21 12:20:56
maintainer
docs_urlNone
authorseeklay
requires_python
licenseGNU General Public License v3.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MCRP: Minecraft Rewrite Proxy

Minecraft MITM proxy with function of rewriting packets, written in pure [Python 3](https://www.python.org/).

[![](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![](https://img.shields.io/gitlab/license/seeklay/MCRP.svg)](LICENSE/) [![](https://tokei.rs/b1/gitlab/seeklay/MCRP)](#) [![](https://badgen.net/pypi/v/MCRP) ![](https://img.shields.io/pypi/dw/MCRP?style=flat&logo=pypi)](https://pypi.org/project/cubelib/) [![](https://badgen.net/gitlab/release/seeklay/MCRP)](https://gitlab.com/seeklay/MCRP/-/releases)

## About

**MCRP** provides cool interface to interact with minecraft packets goes via proxy.

## What's new in 0.1.10
* External handlers for MCWP
* Runtime handlers reloading for MCRP
* Entities resolving/state following
* Data transfer statistics
* Packet rewrite handler

## Announce
No new features will be released on base of `v0.1`.
Only security/bugfixes if needed.
Now the project will develop in the direction of replacing network engine with `ku`.
Release `v0.2` will have same functionality but written around ku.
https://gitlab.com/seeklay/ku

## Supported versions

>This note about **Play** state only! **Handshaking**, **Status**, **Login** fully supported and version-independent.

Absolutely Supported: Minecraft 1.8-1.8.9
Chat supported: Minecraft 1.12.2
For more information on supported protocols, visit the [cubelib](https://gitlab.com/seeklay/cubelib) page on gitlab, because protocol support lies with it.

## MCWP

> MineCraft Watching Proxy

MCWP is a python script written and distibuted with MCRP
It launching MCRP mitm proxy in back and setting global packet handlers to and from the server and then filtering packets with user-defined config and printing it's content in color.
*How to write filter configuration see in examples*

```bash
$> mcwp -h
 __  __   ____  ____   ____       __        __ ____
|  \/  | / ___||  _ \ |  _ \  _   \ \      / /|  _ \
| |\/| || |    | |_) || |_) |(_)   \ \ /\ / / | |_) |
| |  | || |___ |  _ < |  __/  _     \ V  V /  |  __/
|_|  |_| \____||_| \_\|_|    (_)     \_/\_/   |_| v0.1.10

usage: mcwp.py [-h] [-c config.yaml] [-v] [-l addr] [-u addr] [-d decmod]
               [-ll] [--leave-debug-journals] [--ext handlers] [-derf]

Minecraft Watching Proxy

optional arguments:
  -h, --help            show this help message and exit
  -c config.yaml        Path to the YAML config file
  -v                    If passed, enables verbose logging
  -l addr               Proxy listen addr [localhost:25565] (enclose ipv6 like
                        [::])
  -u addr               Proxy upstream server addr [localhost:25575]
  -d decmod             Protocol decryption module
  -ll                   If passed, enables low level debug logging
  --leave-debug-journals
                        If passed, leaves debug journals
  --ext handlers        Module with register() containing external handlers
  -derf                 Disable entities resolving and following
```
## Requirements

* Python 3.7 and above (tested and developed under `Python 3.7.9`)
* [cubelib](https://gitlab.com/seeklay/cubelib) >= 1.0.3-pre.1
* [ruamel.yaml](https://pypi.org/project/ruamel.yaml/) == 0.17.21
* [pycryptodome](https://pypi.org/project/pycryptodome/)

## Installation

MCRP is published in [PyPI](https://pypi.org/project/cubelib/), so latest release can be installed with one simple command:
```bash
pip install -U mcrp
```

or bleeding edge from git sources (unstable) (may not work at all!):

```bash
git clone https://gitlab.com/seeklay/MCRP.git
cd mcrp/
pip3 install .
```

## Usage examples
*if you set a domain name as a listen or an upstream address, ipv4 will used, ipv6 works only with addresses in this notation: [::1]. if the port is not specified, the default will be 25565*
```bash
$> mcwp -c examples\conf_blacklist.yaml -v -ll -d md --leave-debug-journals -l localhost
 __  __   ____  ____   ____       __        __ ____
|  \/  | / ___||  _ \ |  _ \  _   \ \      / /|  _ \
| |\/| || |    | |_) || |_) |(_)   \ \ /\ / / | |_) |
| |  | || |___ |  _ < |  __/  _     \ V  V /  |  __/
|_|  |_| \____||_| \_\|_|    (_)     \_/\_/   |_| v0.1.8

[03/19/2023 04:08:39 AM] [INFO] MCRP:  Running MCRP v0.1.8 (cubelib version 1.0.5-pre1)
[03/19/2023 04:08:39 AM] [INFO] MCRP:  Proxying config is: localhost:25565 -> 127.0.0.1:25575
[03/19/2023 04:08:39 AM] [INFO] MCRP:  Using protocol decryptor: Yggdrasil-Server-DecMod/v0.1.1
[03/19/2023 04:08:39 AM] [INFO] MCRP:  Debug journals enabled!
[03/19/2023 04:08:39 AM] [DEBUG] MCRP/CRYPTO:  Generating 1024 RSA key...
[03/19/2023 04:08:40 AM] [INFO] MCRP:  Registred direct handlers list[1]:
[03/19/2023 04:08:40 AM] [INFO] MCRP:      <class 'cubelib.proto.version_independent.ServerBound.Handshaking.Handshake'>
[03/19/2023 04:08:40 AM] [INFO] MCRP:  Registred relative handlers list[0]:
[03/19/2023 04:08:40 AM] [DEBUG] MCRP:  Entering mainloop

[03/19/2023 04:08:40 AM] [INFO] MCRP:  Waiting for client connection...
[02/20/2023 09:33:02 PM] [INFO] MCRP:  New client, creating connection to the server
[02/20/2023 09:33:02 PM] [INFO] MCRP:  Connected to the server
[02/20/2023 09:33:02 PM] [INFO] MCRP:  Reseting state to Handshaking
[02/20/2023 09:33:02 PM] [INFO] root:  ServerBound   Handshaking.Handshake(ProtoVer=47, ServerName='lc', ServerPort=25565, NextState=NextState.Status)
[02/20/2023 09:33:02 PM] [INFO] root:  ServerBound   Status.Request()
[02/20/2023 09:33:02 PM] [INFO] root:  ClientBound   Status.Response(JsonRsp='{"description":"A Minecraft Server","players":{"max":20,"online":0},"version":{"name":"Spigot 1.8.8","protocol":47}}')
[02/20/2023 09:33:02 PM] [INFO] root:  ServerBound   Status.Ping(Uniq=133772128)
[02/20/2023 09:33:02 PM] [INFO] root:  ClientBound   Status.Pong(Uniq=133772128)
[02/20/2023 09:33:02 PM] [INFO] MCRP:  Client disconnected
[02/20/2023 09:33:02 PM] [INFO] MCRP:  Server disconnected

[02/20/2023 09:33:02 PM] [INFO] MCRP:  Waiting for client connection...
```
See [**examples/**](examples/) for MCRP and MCWP external handlers usage details

## Protocol decryption
### MCWP
For protocol decryption enabling you need user to use your instance of [yggdrasil-server](https://gitlab.com/seeklay/yggdrasil-server) 
Add `-d md` arg to mcwp command to use standard yggdrasil server decryption module
This module will spoof server publickey, read shared secret and spoof session on sessionserver.
Then you will see decrypted packets.

### MCRP
If you want to manipulate encrypted packets from your script you need to add `decryptor` keyword argument to MCRewriteProxy constructor like this:

```python
proxy = MCRewriteProxy(("localhost", 25565), ("localhost", 25575), logging.INFO,
	decryptor=decryptor_class)
```
where decryptor_class is heir of `MCRP.ProtocolDecryptor` like `MCWPDecryptor` in md.py, oh yes you can import `MCWPDecryptor` from md.py and use it here too

## TODO
- [ ] Rewrite networking with [ku](https://gitlab.com/seeklay/ku)
- [ ] еще ченить можно добавить =P

## Author
**[seeklay](https://gitlab.com/seeklay)**

## License
**[GNU GPL 3.0](LICENSE)**



            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/seeklay/MCRP",
    "name": "MCRP",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "seeklay",
    "author_email": "rudeboy@seeklay.icu",
    "download_url": "https://gitlab.com/seeklay/MCRP",
    "platform": "OS Independent",
    "description": "# MCRP: Minecraft Rewrite Proxy\n\nMinecraft MITM proxy with function of rewriting packets, written in pure [Python 3](https://www.python.org/).\n\n[![](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![](https://img.shields.io/gitlab/license/seeklay/MCRP.svg)](LICENSE/) [![](https://tokei.rs/b1/gitlab/seeklay/MCRP)](#) [![](https://badgen.net/pypi/v/MCRP) ![](https://img.shields.io/pypi/dw/MCRP?style=flat&logo=pypi)](https://pypi.org/project/cubelib/) [![](https://badgen.net/gitlab/release/seeklay/MCRP)](https://gitlab.com/seeklay/MCRP/-/releases)\n\n## About\n\n**MCRP** provides cool interface to interact with minecraft packets goes via proxy.\n\n## What's new in 0.1.10\n* External handlers for MCWP\n* Runtime handlers reloading for MCRP\n* Entities resolving/state following\n* Data transfer statistics\n* Packet rewrite handler\n\n## Announce\nNo new features will be released on base of `v0.1`.\nOnly security/bugfixes if needed.\nNow the project will develop in the direction of replacing network engine with `ku`.\nRelease `v0.2` will have same functionality but written around ku.\nhttps://gitlab.com/seeklay/ku\n\n## Supported versions\n\n>This note about **Play** state only! **Handshaking**, **Status**, **Login** fully supported and version-independent.\n\nAbsolutely Supported: Minecraft 1.8-1.8.9\nChat supported: Minecraft 1.12.2\nFor more information on supported protocols, visit the [cubelib](https://gitlab.com/seeklay/cubelib) page on gitlab, because protocol support lies with it.\n\n## MCWP\n\n> MineCraft Watching Proxy\n\nMCWP is a python script written and distibuted with MCRP\nIt launching MCRP mitm proxy in back and setting global packet handlers to and from the server and then filtering packets with user-defined config and printing it's content in color.\n*How to write filter configuration see in examples*\n\n```bash\n$> mcwp -h\n __  __   ____  ____   ____       __        __ ____\n|  \\/  | / ___||  _ \\ |  _ \\  _   \\ \\      / /|  _ \\\n| |\\/| || |    | |_) || |_) |(_)   \\ \\ /\\ / / | |_) |\n| |  | || |___ |  _ < |  __/  _     \\ V  V /  |  __/\n|_|  |_| \\____||_| \\_\\|_|    (_)     \\_/\\_/   |_| v0.1.10\n\nusage: mcwp.py [-h] [-c config.yaml] [-v] [-l addr] [-u addr] [-d decmod]\n               [-ll] [--leave-debug-journals] [--ext handlers] [-derf]\n\nMinecraft Watching Proxy\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c config.yaml        Path to the YAML config file\n  -v                    If passed, enables verbose logging\n  -l addr               Proxy listen addr [localhost:25565] (enclose ipv6 like\n                        [::])\n  -u addr               Proxy upstream server addr [localhost:25575]\n  -d decmod             Protocol decryption module\n  -ll                   If passed, enables low level debug logging\n  --leave-debug-journals\n                        If passed, leaves debug journals\n  --ext handlers        Module with register() containing external handlers\n  -derf                 Disable entities resolving and following\n```\n## Requirements\n\n* Python 3.7 and above (tested and developed under `Python 3.7.9`)\n* [cubelib](https://gitlab.com/seeklay/cubelib) >= 1.0.3-pre.1\n* [ruamel.yaml](https://pypi.org/project/ruamel.yaml/) == 0.17.21\n* [pycryptodome](https://pypi.org/project/pycryptodome/)\n\n## Installation\n\nMCRP is published in [PyPI](https://pypi.org/project/cubelib/), so latest release can be installed with one simple command:\n```bash\npip install -U mcrp\n```\n\nor bleeding edge from git sources (unstable) (may not work at all!):\n\n```bash\ngit clone https://gitlab.com/seeklay/MCRP.git\ncd mcrp/\npip3 install .\n```\n\n## Usage examples\n*if you set a domain name as a listen or an upstream address, ipv4 will used, ipv6 works only with addresses in this notation: [::1]. if the port is not specified, the default will be 25565*\n```bash\n$> mcwp -c examples\\conf_blacklist.yaml -v -ll -d md --leave-debug-journals -l localhost\n __  __   ____  ____   ____       __        __ ____\n|  \\/  | / ___||  _ \\ |  _ \\  _   \\ \\      / /|  _ \\\n| |\\/| || |    | |_) || |_) |(_)   \\ \\ /\\ / / | |_) |\n| |  | || |___ |  _ < |  __/  _     \\ V  V /  |  __/\n|_|  |_| \\____||_| \\_\\|_|    (_)     \\_/\\_/   |_| v0.1.8\n\n[03/19/2023 04:08:39 AM] [INFO] MCRP:  Running MCRP v0.1.8 (cubelib version 1.0.5-pre1)\n[03/19/2023 04:08:39 AM] [INFO] MCRP:  Proxying config is: localhost:25565 -> 127.0.0.1:25575\n[03/19/2023 04:08:39 AM] [INFO] MCRP:  Using protocol decryptor: Yggdrasil-Server-DecMod/v0.1.1\n[03/19/2023 04:08:39 AM] [INFO] MCRP:  Debug journals enabled!\n[03/19/2023 04:08:39 AM] [DEBUG] MCRP/CRYPTO:  Generating 1024 RSA key...\n[03/19/2023 04:08:40 AM] [INFO] MCRP:  Registred direct handlers list[1]:\n[03/19/2023 04:08:40 AM] [INFO] MCRP:      <class 'cubelib.proto.version_independent.ServerBound.Handshaking.Handshake'>\n[03/19/2023 04:08:40 AM] [INFO] MCRP:  Registred relative handlers list[0]:\n[03/19/2023 04:08:40 AM] [DEBUG] MCRP:  Entering mainloop\n\n[03/19/2023 04:08:40 AM] [INFO] MCRP:  Waiting for client connection...\n[02/20/2023 09:33:02 PM] [INFO] MCRP:  New client, creating connection to the server\n[02/20/2023 09:33:02 PM] [INFO] MCRP:  Connected to the server\n[02/20/2023 09:33:02 PM] [INFO] MCRP:  Reseting state to Handshaking\n[02/20/2023 09:33:02 PM] [INFO] root:  ServerBound   Handshaking.Handshake(ProtoVer=47, ServerName='lc', ServerPort=25565, NextState=NextState.Status)\n[02/20/2023 09:33:02 PM] [INFO] root:  ServerBound   Status.Request()\n[02/20/2023 09:33:02 PM] [INFO] root:  ClientBound   Status.Response(JsonRsp='{\"description\":\"A Minecraft Server\",\"players\":{\"max\":20,\"online\":0},\"version\":{\"name\":\"Spigot 1.8.8\",\"protocol\":47}}')\n[02/20/2023 09:33:02 PM] [INFO] root:  ServerBound   Status.Ping(Uniq=133772128)\n[02/20/2023 09:33:02 PM] [INFO] root:  ClientBound   Status.Pong(Uniq=133772128)\n[02/20/2023 09:33:02 PM] [INFO] MCRP:  Client disconnected\n[02/20/2023 09:33:02 PM] [INFO] MCRP:  Server disconnected\n\n[02/20/2023 09:33:02 PM] [INFO] MCRP:  Waiting for client connection...\n```\nSee [**examples/**](examples/) for MCRP and MCWP external handlers usage details\n\n## Protocol decryption\n### MCWP\nFor protocol decryption enabling you need user to use your instance of [yggdrasil-server](https://gitlab.com/seeklay/yggdrasil-server) \nAdd `-d md` arg to mcwp command to use standard yggdrasil server decryption module\nThis module will spoof server publickey, read shared secret and spoof session on sessionserver.\nThen you will see decrypted packets.\n\n### MCRP\nIf you want to manipulate encrypted packets from your script you need to add `decryptor` keyword argument to MCRewriteProxy constructor like this:\n\n```python\nproxy = MCRewriteProxy((\"localhost\", 25565), (\"localhost\", 25575), logging.INFO,\n\tdecryptor=decryptor_class)\n```\nwhere decryptor_class is heir of `MCRP.ProtocolDecryptor` like `MCWPDecryptor` in md.py, oh yes you can import `MCWPDecryptor` from md.py and use it here too\n\n## TODO\n- [ ] Rewrite networking with [ku](https://gitlab.com/seeklay/ku)\n- [ ] \u0435\u0449\u0435 \u0447\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c =P\n\n## Author\n**[seeklay](https://gitlab.com/seeklay)**\n\n## License\n**[GNU GPL 3.0](LICENSE)**\n\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3.0",
    "summary": "Minecraft MITM proxy with function of rewriting packets, written in pure Python 3",
    "version": "0.1.10",
    "project_urls": {
        "Download": "https://gitlab.com/seeklay/MCRP",
        "Homepage": "https://gitlab.com/seeklay/MCRP"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23069ff585cc17336bd044e756157a4cf09ecc630eb0f2bb18a99dc5fdd5911e",
                "md5": "349144fffb999a2304d4f8f9a53289fb",
                "sha256": "d279eb425e2f465d7bf6c9d92941cdb17d8b58abe675fb79ddb2f35b0d586faf"
            },
            "downloads": -1,
            "filename": "MCRP-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "349144fffb999a2304d4f8f9a53289fb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 27370,
            "upload_time": "2023-06-21T12:20:56",
            "upload_time_iso_8601": "2023-06-21T12:20:56.868564Z",
            "url": "https://files.pythonhosted.org/packages/23/06/9ff585cc17336bd044e756157a4cf09ecc630eb0f2bb18a99dc5fdd5911e/MCRP-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-21 12:20:56",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "seeklay",
    "gitlab_project": "MCRP",
    "lcname": "mcrp"
}
        
Elapsed time: 0.09679s