Is there a way to send a login packet to minecraft server from python?
Here is what i have right now:
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
addr = ("localhost", 25565)
client.connect(addr)
client.sendall(chr(0x02))
client.sendall(chr(0xFD))
client.sendall(chr(0xCD)) # After sending this line server still don't kick me
client.sendall(chr(0x06)+str(117)+str(70)+str(-46)) # And now server kicks me :-(
client.sendall(chr(0x03)+str("Hello World"))
print client.recv(4096)
client.close()
Hope there is a way to do this :-).
EDIT:
BTW, I'd like to send login packets with non-premium username (or one that doesn't exists), if it is possible :-) )
解决方案
An alternative would be to use someone-else's python library that does it for you - like quarry or others mentioned here. Also see this related question.