Skip to main content

Minecraft MITM proxy with function of rewriting packets, written in pure Python 3

Project description

MCRP: Minecraft Rewrite Proxy

Minecraft MITM proxy with function of rewriting packets, written in pure Python 3.

About

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

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

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

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

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

Requirements

Installation

MCRP is published in PyPI, so latest release can be installed with one simple command:

pip install -U mcrp

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

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

$> 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/ for MCRP usage details

Protocol decryption

MCWP

For protocol decryption enabling you need user to use your instance of 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:

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
  • еще ченить можно добавить =P

Author

seeklay

License

GNU GPL 3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

MCRP-0.1.9-py3-none-any.whl (24.5 kB view hashes)

Uploaded Python 3

Supported by

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