Python - 将登录数据包发送到Minecraft服务器

时间:2013-08-19 14:34:55

标签: python login minecraft python-2.x

有没有办法从python发送登录数据包到minecraft服务器? 这就是我现在所拥有的:

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


希望有办法做到这一点: - )。

修改

顺便说一句,我想发送带有非高级用户名(或者不存在的用户名)的登录数据包,如果可能的话:-))

1 个答案:

答案 0 :(得分:0)

另一种方法是使用别人的python库为你做这件事 - 比如quarry或其他人提到here。另请参阅此相关question