Fred Peters
Fred Peters

Reputation: 131

Minecraft packet sniffing in python

My aim is to sniff through the Minecraft packets in python and decode the data to get this information:

So far, this is my code:

from scapy.all import *

def test(pkt):
    payload = pkt
    payload = bytes(payload)

if __name__ == '__main__':
    single = sniff(filter="tcp and port 25565", prn=test)

The pkt variable is a scapy packet object and therefore has attributes such as .original and .payload. The code so far displays Minecraft's packets, however, I am unsure of how to decode them or what attribute to use. I have found the protocol documentation for 1.12.2 servers.

Thank you for any help in advance.

Upvotes: 0

Views: 1460

Answers (1)

Raatje
Raatje

Reputation: 1722

Better late then never I guess.

Public private key encryption is a way to prevent others reading it.

Even by other means you could negotiate a secret:

Let's say you have a chest, put something in it (secret key) and put a padlock on it and send it to someone. The receiver can't open it but he can put an additional padlock on it. So he locks the chest with an additional lock and sends it back to you. Once you receive the chest it has 2 locks. You remove your lock and send it back again. The chest now only contains the lock of the receiver which he will be able to open when he recieves the chest again.

The chest was never in an unlocked state while in transit and anyone other then the sender or receiver will have been able to see what's inside.

Upvotes: 0

Related Questions