g0blin Bringing together art & technology


MCPipe, Minecraft bridge

As an experiment, I decided to see if I could put together an intermediary for an indy-game that has been growing in popularity recently - Minecraft. This intermediary would act as a bridge between the Server and Client, extracting data from the packets and passing them on.

The script below - when provided with the correct settings - will listen for connections on one IP/Port(your bridges entrance), and forward data on to another IP/Port(your Minecraft server). Any packets that pass through will be decoded, and have their data passed on to the target Minecraft server/client.

The initial goal of this script was to write a Firehol-esque system of denying certain actions based on a players status/server settings, so as to prevent griefing. While this script could easily be adapted to serve this purpose as it can deny data on a by-structure basis, instead of by-packet, I just don't have the energy to develop it further at the moment.

While I've not reached my main goal with this script, it has served as a learning process for me in the Minecraft protocol, as well as how to work with sockets in Python - a language I am growing to love.

Anyway, without more a-do, here's the script.

MCPipe 0.1 (pipe.py)

And here's an example of usage - the second command executed will start a bridge between blog.g0blin.co.uk:6666 and the Minecraft server hosted on pawncraft.co.uk:25565

g0blin@server1:~/pipe# python pipe.py
Starting MCBridge
Usage: python pipe.py <relay ip/host> <relay port> <target ip/host> <target port>
Example: python pipe.py localhost 6666 pawncraft.co.uk 25565
Closing MCBridge
g0blin@server1:~/pipe# python pipe.py blog.g0blin.co.uk 6666 pawncraft.co.uk 25565
Starting MCBridge
Bridge open between blog.g0blin.co.uk:6666 and pawncraft.co.uk:25565
Closing MCBridge

The script itself should work cross-platform, and relies only on standard Python libraries. I've tested it on both 2.6 and 2.7, on Windows and Linux.

references: http://mc.kev009.com/wiki/Protocol http://code.activestate.com/recipes/114642-pinhole/

Comments (1) Trackbacks (0)
  1. neat, been looking for something like this.. i will keep watching this 🙂

Leave a comment

No trackbacks yet.