Formatting
This commit is contained in:
1 parent
2abe34e88c
commit
d9199a3e2a
9 files changed
+100
-15
No files matched your search
@@ -13,6 +13,7 @@ def javaHexDigest(digest):
|
|||||||
d = "%x" % d
|
d = "%x" % d
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
def translate_escape(m):
|
def translate_escape(m):
|
||||||
c = m.group(1).lower()
|
c = m.group(1).lower()
|
||||||
|
|
||||||
@@ -41,9 +42,11 @@ def translate_escape(m):
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def translate_escapes(s):
|
def translate_escapes(s):
|
||||||
return re.sub(ur"\xa7([0-9a-zA-Z])", translate_escape, s) + "\x1b[0m"
|
return re.sub(ur"\xa7([0-9a-zA-Z])", translate_escape, s) + "\x1b[0m"
|
||||||
|
|
||||||
|
|
||||||
def loginToMinecraft(username, password):
|
def loginToMinecraft(username, password):
|
||||||
try:
|
try:
|
||||||
url = 'https://login.minecraft.net'
|
url = 'https://login.minecraft.net'
|
||||||
@@ -68,8 +71,8 @@ def loginToMinecraft(username, password):
|
|||||||
}
|
}
|
||||||
return toReturn
|
return toReturn
|
||||||
|
|
||||||
class MinecraftLoginThread(threading.Thread):
|
|
||||||
|
|
||||||
|
class MinecraftLoginThread(threading.Thread):
|
||||||
def __init__(self, username, password):
|
def __init__(self, username, password):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.username = username
|
self.username = username
|
||||||
|
|||||||
+24
-1
@@ -6,72 +6,93 @@ from pynbt import NBTFile
|
|||||||
def readBoolean(FileObject):
|
def readBoolean(FileObject):
|
||||||
return struct.unpack('?', FileObject.read(1))[0]
|
return struct.unpack('?', FileObject.read(1))[0]
|
||||||
|
|
||||||
|
|
||||||
def readByte(FileObject):
|
def readByte(FileObject):
|
||||||
return struct.unpack('>b', FileObject.read(1))[0]
|
return struct.unpack('>b', FileObject.read(1))[0]
|
||||||
|
|
||||||
|
|
||||||
def readUnsignedByte(FileObject):
|
def readUnsignedByte(FileObject):
|
||||||
return struct.unpack('>B', FileObject.read(1))[0]
|
return struct.unpack('>B', FileObject.read(1))[0]
|
||||||
|
|
||||||
|
|
||||||
def readShort(FileObject):
|
def readShort(FileObject):
|
||||||
return struct.unpack('>h', FileObject.read(2))[0]
|
return struct.unpack('>h', FileObject.read(2))[0]
|
||||||
|
|
||||||
|
|
||||||
def readUnsignedShort(FileObject):
|
def readUnsignedShort(FileObject):
|
||||||
return struct.unpack('>H', FileObject.read(2))[0]
|
return struct.unpack('>H', FileObject.read(2))[0]
|
||||||
|
|
||||||
|
|
||||||
def readInt(FileObject):
|
def readInt(FileObject):
|
||||||
return struct.unpack('>i', FileObject.read(4))[0]
|
return struct.unpack('>i', FileObject.read(4))[0]
|
||||||
|
|
||||||
|
|
||||||
def readFloat(FileObject):
|
def readFloat(FileObject):
|
||||||
return struct.unpack('>f', FileObject.read(4))[0]
|
return struct.unpack('>f', FileObject.read(4))[0]
|
||||||
|
|
||||||
|
|
||||||
def readLong(FileObject):
|
def readLong(FileObject):
|
||||||
return struct.unpack('>q', FileObject.read(8))[0]
|
return struct.unpack('>q', FileObject.read(8))[0]
|
||||||
|
|
||||||
|
|
||||||
def readDouble(FileObject):
|
def readDouble(FileObject):
|
||||||
return struct.unpack('>d', FileObject.read(8))[0]
|
return struct.unpack('>d', FileObject.read(8))[0]
|
||||||
|
|
||||||
|
|
||||||
def readByteArray(FileObject, length):
|
def readByteArray(FileObject, length):
|
||||||
return struct.unpack(str(length) + "s", FileObject.read(length))[0]
|
return struct.unpack(str(length) + "s", FileObject.read(length))[0]
|
||||||
|
|
||||||
|
|
||||||
def readString(FileObject):
|
def readString(FileObject):
|
||||||
length = readShort(FileObject) * 2
|
length = readShort(FileObject) * 2
|
||||||
return FileObject.read(length).decode("utf-16be")
|
return FileObject.read(length).decode("utf-16be")
|
||||||
|
|
||||||
|
|
||||||
def sendBoolean(socket, value):
|
def sendBoolean(socket, value):
|
||||||
assert type(value) is types.BooleanType, "value is not a boolean: %r" % value
|
assert type(value) is types.BooleanType, "value is not a boolean: %r" % value
|
||||||
socket.send(struct.pack('?', value))
|
socket.send(struct.pack('?', value))
|
||||||
|
|
||||||
|
|
||||||
def sendByte(socket, value):
|
def sendByte(socket, value):
|
||||||
socket.send(struct.pack('>b', value))
|
socket.send(struct.pack('>b', value))
|
||||||
|
|
||||||
|
|
||||||
def sendUnsignedByte(socket, value):
|
def sendUnsignedByte(socket, value):
|
||||||
socket.send(struct.pack('>B', value))
|
socket.send(struct.pack('>B', value))
|
||||||
|
|
||||||
|
|
||||||
def sendShort(socket, value):
|
def sendShort(socket, value):
|
||||||
socket.send(struct.pack('>h', value))
|
socket.send(struct.pack('>h', value))
|
||||||
|
|
||||||
|
|
||||||
def sendUnsignedShort(socket, value):
|
def sendUnsignedShort(socket, value):
|
||||||
socket.send(struct.pack('>H', value))
|
socket.send(struct.pack('>H', value))
|
||||||
|
|
||||||
|
|
||||||
def sendInt(socket, value):
|
def sendInt(socket, value):
|
||||||
assert type(value) is types.IntType, "value is not an integer: %r" % value
|
assert type(value) is types.IntType, "value is not an integer: %r" % value
|
||||||
socket.send(struct.pack('>i', value))
|
socket.send(struct.pack('>i', value))
|
||||||
|
|
||||||
|
|
||||||
def sendFloat(socket, value):
|
def sendFloat(socket, value):
|
||||||
socket.send(struct.pack('>f', value))
|
socket.send(struct.pack('>f', value))
|
||||||
|
|
||||||
|
|
||||||
def sendLong(socket, value):
|
def sendLong(socket, value):
|
||||||
socket.send(struct.pack('>q', value))
|
socket.send(struct.pack('>q', value))
|
||||||
|
|
||||||
|
|
||||||
def sendDouble(socket, value):
|
def sendDouble(socket, value):
|
||||||
socket.send(struct.pack('>d', value))
|
socket.send(struct.pack('>d', value))
|
||||||
|
|
||||||
|
|
||||||
def sendString(socket, value):
|
def sendString(socket, value):
|
||||||
if (type(value) is not types.StringType):
|
if (type(value) is not types.StringType):
|
||||||
value = str(value)
|
value = str(value)
|
||||||
socket.send(struct.pack('>h', value.__len__()))
|
socket.send(struct.pack('>h', value.__len__()))
|
||||||
socket.send(value.encode('utf-16be'))
|
socket.send(value.encode('utf-16be'))
|
||||||
|
|
||||||
|
|
||||||
def readEntityMetadata(FileObject):
|
def readEntityMetadata(FileObject):
|
||||||
metadata = {}
|
metadata = {}
|
||||||
byte = readUnsignedByte(FileObject)
|
byte = readUnsignedByte(FileObject)
|
||||||
@@ -92,7 +113,8 @@ def readEntityMetadata(FileObject):
|
|||||||
val["damage"] = readShort(FileObject)
|
val["damage"] = readShort(FileObject)
|
||||||
nbtDataLength = readShort(FileObject)
|
nbtDataLength = readShort(FileObject)
|
||||||
if (nbtDataLength != -1):
|
if (nbtDataLength != -1):
|
||||||
val["NBT"] = NBTFile(BytesIO(readByteArray(FileObject, nbtDataLength)), compression=NBTFile.Compression.GZIP)
|
val["NBT"] = NBTFile(BytesIO(readByteArray(FileObject, nbtDataLength)),
|
||||||
|
compression=NBTFile.Compression.GZIP)
|
||||||
if ty == 6:
|
if ty == 6:
|
||||||
val = []
|
val = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
@@ -101,6 +123,7 @@ def readEntityMetadata(FileObject):
|
|||||||
byte = readUnsignedByte(FileObject)
|
byte = readUnsignedByte(FileObject)
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
|
|
||||||
def readSlotData(FileObject):
|
def readSlotData(FileObject):
|
||||||
BlockID = readShort(FileObject)
|
BlockID = readShort(FileObject)
|
||||||
if (BlockID != -1):
|
if (BlockID != -1):
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from Crypto.Cipher import PKCS1_v1_5
|
|||||||
EntityID = 0
|
EntityID = 0
|
||||||
|
|
||||||
class ServerConnection(threading.Thread):
|
class ServerConnection(threading.Thread):
|
||||||
|
|
||||||
def __init__(self, pluginLoader, username, sessionID, server, port, options=None):
|
def __init__(self, pluginLoader, username, sessionID, server, port, options=None):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.pluginLoader = pluginLoader
|
self.pluginLoader = pluginLoader
|
||||||
@@ -119,8 +118,8 @@ class ServerConnection(threading.Thread):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class EncryptedFileObjectHandler():
|
|
||||||
|
|
||||||
|
class EncryptedFileObjectHandler():
|
||||||
def __init__(self, fileobject, cipher):
|
def __init__(self, fileobject, cipher):
|
||||||
self.fileobject = fileobject
|
self.fileobject = fileobject
|
||||||
self.cipher = cipher
|
self.cipher = cipher
|
||||||
@@ -135,8 +134,8 @@ class EncryptedFileObjectHandler():
|
|||||||
def tell(self):
|
def tell(self):
|
||||||
return self.length
|
return self.length
|
||||||
|
|
||||||
class EncryptedSocketObjectHandler():
|
|
||||||
|
|
||||||
|
class EncryptedSocketObjectHandler():
|
||||||
def __init__(self, socket, cipher):
|
def __init__(self, socket, cipher):
|
||||||
self.socket = socket
|
self.socket = socket
|
||||||
self.cipher = cipher
|
self.cipher = cipher
|
||||||
@@ -147,8 +146,8 @@ class EncryptedSocketObjectHandler():
|
|||||||
def close(self):
|
def close(self):
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
|
|
||||||
class PacketListener(threading.Thread):
|
|
||||||
|
|
||||||
|
class PacketListener(threading.Thread):
|
||||||
def __init__(self, connection, socket, FileObject):
|
def __init__(self, connection, socket, FileObject):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
@@ -197,7 +196,8 @@ class PacketListener(threading.Thread):
|
|||||||
elif (response == "\x03"):
|
elif (response == "\x03"):
|
||||||
packet = PacketListenerManager.handle03(self.FileObject)
|
packet = PacketListenerManager.handle03(self.FileObject)
|
||||||
# Add "\x1b" because it is essential for ANSI escapes emitted by translate_escapes
|
# Add "\x1b" because it is essential for ANSI escapes emitted by translate_escapes
|
||||||
filtered_string = filter(lambda x: x in string.printable + "\x1b", Utils.translate_escapes(packet['Message']))
|
filtered_string = filter(lambda x: x in string.printable + "\x1b",
|
||||||
|
Utils.translate_escapes(packet['Message']))
|
||||||
print filtered_string
|
print filtered_string
|
||||||
|
|
||||||
elif (response == "\x04"):
|
elif (response == "\x04"):
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ def handle00(FileObject, socket):
|
|||||||
KAid = DataUtil.readInt(FileObject)
|
KAid = DataUtil.readInt(FileObject)
|
||||||
PacketSenderManager.send00(socket, KAid)
|
PacketSenderManager.send00(socket, KAid)
|
||||||
|
|
||||||
|
|
||||||
def handle01(FileObject):
|
def handle01(FileObject):
|
||||||
Eid = DataUtil.readInt(FileObject)
|
Eid = DataUtil.readInt(FileObject)
|
||||||
world = DataUtil.readString(FileObject)
|
world = DataUtil.readString(FileObject)
|
||||||
@@ -23,14 +24,17 @@ def handle01(FileObject):
|
|||||||
'MaxPlayers': maxplayers
|
'MaxPlayers': maxplayers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle02(FileObject):
|
def handle02(FileObject):
|
||||||
message = DataUtil.readString(FileObject)
|
message = DataUtil.readString(FileObject)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def handle03(FileObject):
|
def handle03(FileObject):
|
||||||
message = DataUtil.readString(FileObject)
|
message = DataUtil.readString(FileObject)
|
||||||
return {'Message': message}
|
return {'Message': message}
|
||||||
|
|
||||||
|
|
||||||
def handle04(FileObject):
|
def handle04(FileObject):
|
||||||
time = DataUtil.readLong(FileObject)
|
time = DataUtil.readLong(FileObject)
|
||||||
dayTime = DataUtil.readLong(FileObject)
|
dayTime = DataUtil.readLong(FileObject)
|
||||||
@@ -38,6 +42,7 @@ def handle04(FileObject):
|
|||||||
'DayTime': dayTime
|
'DayTime': dayTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle05(FileObject):
|
def handle05(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Slot = DataUtil.readShort(FileObject)
|
Slot = DataUtil.readShort(FileObject)
|
||||||
@@ -47,6 +52,7 @@ def handle05(FileObject):
|
|||||||
'Item': Item
|
'Item': Item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle06(FileObject):
|
def handle06(FileObject):
|
||||||
x = DataUtil.readInt(FileObject)
|
x = DataUtil.readInt(FileObject)
|
||||||
y = DataUtil.readInt(FileObject)
|
y = DataUtil.readInt(FileObject)
|
||||||
@@ -56,6 +62,7 @@ def handle06(FileObject):
|
|||||||
'z': z
|
'z': z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle07(FileObject):
|
def handle07(FileObject):
|
||||||
userID = DataUtil.readInt(FileObject)
|
userID = DataUtil.readInt(FileObject)
|
||||||
targetID = DataUtil.readInt(FileObject)
|
targetID = DataUtil.readInt(FileObject)
|
||||||
@@ -65,6 +72,7 @@ def handle07(FileObject):
|
|||||||
'mButton': mButton
|
'mButton': mButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle08(FileObject):
|
def handle08(FileObject):
|
||||||
health = DataUtil.readShort(FileObject)
|
health = DataUtil.readShort(FileObject)
|
||||||
food = DataUtil.readShort(FileObject)
|
food = DataUtil.readShort(FileObject)
|
||||||
@@ -74,6 +82,7 @@ def handle08(FileObject):
|
|||||||
'saturation': saturation
|
'saturation': saturation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle09(FileObject):
|
def handle09(FileObject):
|
||||||
dimension = DataUtil.readInt(FileObject)
|
dimension = DataUtil.readInt(FileObject)
|
||||||
difficulty = DataUtil.readByte(FileObject)
|
difficulty = DataUtil.readByte(FileObject)
|
||||||
@@ -87,6 +96,7 @@ def handle09(FileObject):
|
|||||||
'World': world
|
'World': world
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle0D(FileObject):
|
def handle0D(FileObject):
|
||||||
x = DataUtil.readDouble(FileObject)
|
x = DataUtil.readDouble(FileObject)
|
||||||
stance = DataUtil.readDouble(FileObject)
|
stance = DataUtil.readDouble(FileObject)
|
||||||
@@ -104,10 +114,12 @@ def handle0D(FileObject):
|
|||||||
'onGround': onGround
|
'onGround': onGround
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle10(FileObject):
|
def handle10(FileObject):
|
||||||
slotID = DataUtil.readShort(FileObject)
|
slotID = DataUtil.readShort(FileObject)
|
||||||
return {'SlotID': slotID}
|
return {'SlotID': slotID}
|
||||||
|
|
||||||
|
|
||||||
def handle11(FileObject):
|
def handle11(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
FileObject.read(1) #Unused
|
FileObject.read(1) #Unused
|
||||||
@@ -120,6 +132,7 @@ def handle11(FileObject):
|
|||||||
'z': z
|
'z': z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle12(FileObject):
|
def handle12(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Animation = DataUtil.readByte(FileObject)
|
Animation = DataUtil.readByte(FileObject)
|
||||||
@@ -127,6 +140,7 @@ def handle12(FileObject):
|
|||||||
'AnimationID': Animation
|
'AnimationID': Animation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle14(FileObject):
|
def handle14(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
PlayerName = DataUtil.readString(FileObject)
|
PlayerName = DataUtil.readString(FileObject)
|
||||||
@@ -149,6 +163,7 @@ def handle14(FileObject):
|
|||||||
}
|
}
|
||||||
return toReturn
|
return toReturn
|
||||||
|
|
||||||
|
|
||||||
def handle15(FileObject):
|
def handle15(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
ItemID = DataUtil.readShort(FileObject)
|
ItemID = DataUtil.readShort(FileObject)
|
||||||
@@ -178,6 +193,7 @@ def handle15(FileObject):
|
|||||||
toReturn['Damage'] = Damage
|
toReturn['Damage'] = Damage
|
||||||
return toReturn
|
return toReturn
|
||||||
|
|
||||||
|
|
||||||
def handle16(FileObject):
|
def handle16(FileObject):
|
||||||
CollectedID = DataUtil.readInt(FileObject)
|
CollectedID = DataUtil.readInt(FileObject)
|
||||||
CollectorID = DataUtil.readInt(FileObject)
|
CollectorID = DataUtil.readInt(FileObject)
|
||||||
@@ -185,6 +201,7 @@ def handle16(FileObject):
|
|||||||
'CollectorID': CollectorID
|
'CollectorID': CollectorID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle17(FileObject):
|
def handle17(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Type = DataUtil.readByte(FileObject)
|
Type = DataUtil.readByte(FileObject)
|
||||||
@@ -219,6 +236,7 @@ def handle17(FileObject):
|
|||||||
'pitch': pitch
|
'pitch': pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle18(FileObject):
|
def handle18(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Type = DataUtil.readByte(FileObject)
|
Type = DataUtil.readByte(FileObject)
|
||||||
@@ -247,6 +265,7 @@ def handle18(FileObject):
|
|||||||
'VelocityZ': VelocityZ
|
'VelocityZ': VelocityZ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle19(FileObject):
|
def handle19(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Title = DataUtil.readString(FileObject)
|
Title = DataUtil.readString(FileObject)
|
||||||
@@ -262,6 +281,7 @@ def handle19(FileObject):
|
|||||||
'Direction': Direction
|
'Direction': Direction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle1A(FileObject):
|
def handle1A(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
x = DataUtil.readInt(FileObject)
|
x = DataUtil.readInt(FileObject)
|
||||||
@@ -275,6 +295,7 @@ def handle1A(FileObject):
|
|||||||
'Count': Count
|
'Count': Count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle1C(FileObject):
|
def handle1C(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
VelocityX = DataUtil.readShort(FileObject)
|
VelocityX = DataUtil.readShort(FileObject)
|
||||||
@@ -286,6 +307,7 @@ def handle1C(FileObject):
|
|||||||
'VelocityZ': VelocityZ
|
'VelocityZ': VelocityZ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle1D(FileObject):
|
def handle1D(FileObject):
|
||||||
EntityArrayLength = DataUtil.readByte(FileObject)
|
EntityArrayLength = DataUtil.readByte(FileObject)
|
||||||
Entities = []
|
Entities = []
|
||||||
@@ -293,10 +315,12 @@ def handle1D(FileObject):
|
|||||||
Entities.append(DataUtil.readInt(FileObject))
|
Entities.append(DataUtil.readInt(FileObject))
|
||||||
return Entities
|
return Entities
|
||||||
|
|
||||||
|
|
||||||
def handle1E(FileObject):
|
def handle1E(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
return EntityID
|
return EntityID
|
||||||
|
|
||||||
|
|
||||||
def handle1F(FileObject):
|
def handle1F(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
x = DataUtil.readByte(FileObject)
|
x = DataUtil.readByte(FileObject)
|
||||||
@@ -308,6 +332,7 @@ def handle1F(FileObject):
|
|||||||
'z': z
|
'z': z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle20(FileObject):
|
def handle20(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Yaw = DataUtil.readByte(FileObject)
|
Yaw = DataUtil.readByte(FileObject)
|
||||||
@@ -317,6 +342,7 @@ def handle20(FileObject):
|
|||||||
'Pitch': Pitch
|
'Pitch': Pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle21(FileObject):
|
def handle21(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
x = DataUtil.readByte(FileObject)
|
x = DataUtil.readByte(FileObject)
|
||||||
@@ -332,6 +358,7 @@ def handle21(FileObject):
|
|||||||
'Pitch': Pitch
|
'Pitch': Pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle22(FileObject):
|
def handle22(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
x = DataUtil.readInt(FileObject)
|
x = DataUtil.readInt(FileObject)
|
||||||
@@ -347,6 +374,7 @@ def handle22(FileObject):
|
|||||||
'Pitch': Pitch
|
'Pitch': Pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle23(FileObject):
|
def handle23(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
HeadYaw = DataUtil.readByte(FileObject)
|
HeadYaw = DataUtil.readByte(FileObject)
|
||||||
@@ -354,6 +382,7 @@ def handle23(FileObject):
|
|||||||
'HeadYaw': HeadYaw
|
'HeadYaw': HeadYaw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle26(FileObject):
|
def handle26(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
Status = DataUtil.readByte(FileObject)
|
Status = DataUtil.readByte(FileObject)
|
||||||
@@ -361,6 +390,7 @@ def handle26(FileObject):
|
|||||||
'Status': Status
|
'Status': Status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle27(FileObject):
|
def handle27(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
VehicleID = DataUtil.readInt(FileObject)
|
VehicleID = DataUtil.readInt(FileObject)
|
||||||
@@ -368,6 +398,7 @@ def handle27(FileObject):
|
|||||||
'VehicleID': VehicleID
|
'VehicleID': VehicleID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle28(FileObject):
|
def handle28(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
metadata = DataUtil.readEntityMetadata(FileObject)
|
metadata = DataUtil.readEntityMetadata(FileObject)
|
||||||
@@ -375,6 +406,7 @@ def handle28(FileObject):
|
|||||||
'MetaData': metadata
|
'MetaData': metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle29(FileObject):
|
def handle29(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
EffectID = DataUtil.readByte(FileObject)
|
EffectID = DataUtil.readByte(FileObject)
|
||||||
@@ -386,6 +418,7 @@ def handle29(FileObject):
|
|||||||
'Duration': Duration
|
'Duration': Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle2A(FileObject):
|
def handle2A(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
EffectID = DataUtil.readByte(FileObject)
|
EffectID = DataUtil.readByte(FileObject)
|
||||||
@@ -393,6 +426,7 @@ def handle2A(FileObject):
|
|||||||
'EffectID': EffectID
|
'EffectID': EffectID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle2B(FileObject):
|
def handle2B(FileObject):
|
||||||
ExperienceBar = DataUtil.readFloat(FileObject)
|
ExperienceBar = DataUtil.readFloat(FileObject)
|
||||||
Level = DataUtil.readShort(FileObject)
|
Level = DataUtil.readShort(FileObject)
|
||||||
@@ -402,6 +436,7 @@ def handle2B(FileObject):
|
|||||||
'TotalExp': TotalExp
|
'TotalExp': TotalExp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle33(FileObject):
|
def handle33(FileObject):
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
Z = DataUtil.readInt(FileObject)
|
Z = DataUtil.readInt(FileObject)
|
||||||
@@ -414,6 +449,7 @@ def handle33(FileObject):
|
|||||||
'z': Z
|
'z': Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle34(FileObject):
|
def handle34(FileObject):
|
||||||
ChunkX = DataUtil.readInt(FileObject)
|
ChunkX = DataUtil.readInt(FileObject)
|
||||||
ChunkZ = DataUtil.readInt(FileObject)
|
ChunkZ = DataUtil.readInt(FileObject)
|
||||||
@@ -425,6 +461,7 @@ def handle34(FileObject):
|
|||||||
'AffectedBlocks': AffectedBlocks
|
'AffectedBlocks': AffectedBlocks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle35(FileObject):
|
def handle35(FileObject):
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
Y = DataUtil.readByte(FileObject)
|
Y = DataUtil.readByte(FileObject)
|
||||||
@@ -438,6 +475,7 @@ def handle35(FileObject):
|
|||||||
'MetaData': BlockMetaData
|
'MetaData': BlockMetaData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle36(FileObject):
|
def handle36(FileObject):
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
Y = DataUtil.readShort(FileObject)
|
Y = DataUtil.readShort(FileObject)
|
||||||
@@ -453,6 +491,7 @@ def handle36(FileObject):
|
|||||||
'BlockID': BlockID
|
'BlockID': BlockID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle37(FileObject):
|
def handle37(FileObject):
|
||||||
#int - EntityID
|
#int - EntityID
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
@@ -475,6 +514,7 @@ def handle37(FileObject):
|
|||||||
'DestroyedStage': DestroyedStage
|
'DestroyedStage': DestroyedStage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle38(FileObject):
|
def handle38(FileObject):
|
||||||
#short - number of chunks
|
#short - number of chunks
|
||||||
ChunkCount = DataUtil.readShort(FileObject)
|
ChunkCount = DataUtil.readShort(FileObject)
|
||||||
@@ -491,6 +531,7 @@ def handle38(FileObject):
|
|||||||
return {'ChunkCount': ChunkCount
|
return {'ChunkCount': ChunkCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle3C(FileObject):
|
def handle3C(FileObject):
|
||||||
X = DataUtil.readDouble(FileObject)
|
X = DataUtil.readDouble(FileObject)
|
||||||
Y = DataUtil.readDouble(FileObject)
|
Y = DataUtil.readDouble(FileObject)
|
||||||
@@ -515,6 +556,7 @@ def handle3C(FileObject):
|
|||||||
'AffectedBlocks': AffectedBlocks
|
'AffectedBlocks': AffectedBlocks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle3D(FileObject):
|
def handle3D(FileObject):
|
||||||
EffectID = DataUtil.readInt(FileObject)
|
EffectID = DataUtil.readInt(FileObject)
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
@@ -530,6 +572,7 @@ def handle3D(FileObject):
|
|||||||
'NoVolumeDecrease': NoVolDecrease
|
'NoVolumeDecrease': NoVolDecrease
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle3E(FileObject):
|
def handle3E(FileObject):
|
||||||
Sound = DataUtil.readString(FileObject)
|
Sound = DataUtil.readString(FileObject)
|
||||||
x = DataUtil.readInt(FileObject)
|
x = DataUtil.readInt(FileObject)
|
||||||
@@ -545,6 +588,7 @@ def handle3E(FileObject):
|
|||||||
'Pitch': Pitch
|
'Pitch': Pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle46(FileObject):
|
def handle46(FileObject):
|
||||||
Reason = DataUtil.readByte(FileObject)
|
Reason = DataUtil.readByte(FileObject)
|
||||||
GameMode = DataUtil.readByte(FileObject)
|
GameMode = DataUtil.readByte(FileObject)
|
||||||
@@ -552,6 +596,7 @@ def handle46(FileObject):
|
|||||||
'GameMode': GameMode
|
'GameMode': GameMode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle47(FileObject):
|
def handle47(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
FileObject.read(1) #Boolean don't do nothing
|
FileObject.read(1) #Boolean don't do nothing
|
||||||
@@ -564,6 +609,7 @@ def handle47(FileObject):
|
|||||||
'z': z
|
'z': z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle64(FileObject):
|
def handle64(FileObject):
|
||||||
WindowID = DataUtil.readByte(FileObject)
|
WindowID = DataUtil.readByte(FileObject)
|
||||||
InventoryType = DataUtil.readByte(FileObject)
|
InventoryType = DataUtil.readByte(FileObject)
|
||||||
@@ -575,10 +621,12 @@ def handle64(FileObject):
|
|||||||
'NumberOfSlots': NumberOfSlots
|
'NumberOfSlots': NumberOfSlots
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle65(FileObject):
|
def handle65(FileObject):
|
||||||
WindowID = DataUtil.readByte(FileObject)
|
WindowID = DataUtil.readByte(FileObject)
|
||||||
return WindowID
|
return WindowID
|
||||||
|
|
||||||
|
|
||||||
def handle67(FileObject):
|
def handle67(FileObject):
|
||||||
WindowID = DataUtil.readByte(FileObject)
|
WindowID = DataUtil.readByte(FileObject)
|
||||||
Slot = DataUtil.readShort(FileObject)
|
Slot = DataUtil.readShort(FileObject)
|
||||||
@@ -588,6 +636,7 @@ def handle67(FileObject):
|
|||||||
'SlotData': SlotData
|
'SlotData': SlotData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle68(FileObject):
|
def handle68(FileObject):
|
||||||
WindowID = DataUtil.readByte(FileObject)
|
WindowID = DataUtil.readByte(FileObject)
|
||||||
Count = DataUtil.readShort(FileObject)
|
Count = DataUtil.readShort(FileObject)
|
||||||
@@ -600,6 +649,7 @@ def handle68(FileObject):
|
|||||||
'Slots': Slots
|
'Slots': Slots
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle69(FileObject):
|
def handle69(FileObject):
|
||||||
WindowID = DataUtil.readByte(FileObject)
|
WindowID = DataUtil.readByte(FileObject)
|
||||||
Property = DataUtil.readShort(FileObject)
|
Property = DataUtil.readShort(FileObject)
|
||||||
@@ -609,6 +659,7 @@ def handle69(FileObject):
|
|||||||
'Value': Value
|
'Value': Value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle6A(FileObject):
|
def handle6A(FileObject):
|
||||||
WindowID = DataUtil.readByte(FileObject)
|
WindowID = DataUtil.readByte(FileObject)
|
||||||
ActionType = DataUtil.readShort(FileObject)
|
ActionType = DataUtil.readShort(FileObject)
|
||||||
@@ -618,6 +669,7 @@ def handle6A(FileObject):
|
|||||||
'Accepted': Accepted
|
'Accepted': Accepted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle6B(FileObject):
|
def handle6B(FileObject):
|
||||||
Slot = DataUtil.readShort(FileObject)
|
Slot = DataUtil.readShort(FileObject)
|
||||||
ClickedItem = DataUtil.readSlotData(FileObject)
|
ClickedItem = DataUtil.readSlotData(FileObject)
|
||||||
@@ -625,6 +677,7 @@ def handle6B(FileObject):
|
|||||||
'ClickedItem': ClickedItem
|
'ClickedItem': ClickedItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle82(FileObject):
|
def handle82(FileObject):
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
Y = DataUtil.readShort(FileObject)
|
Y = DataUtil.readShort(FileObject)
|
||||||
@@ -642,6 +695,7 @@ def handle82(FileObject):
|
|||||||
'Line4': Line4
|
'Line4': Line4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle83(FileObject):
|
def handle83(FileObject):
|
||||||
ItemType = DataUtil.readShort(FileObject)
|
ItemType = DataUtil.readShort(FileObject)
|
||||||
ItemID = DataUtil.readShort(FileObject)
|
ItemID = DataUtil.readShort(FileObject)
|
||||||
@@ -652,6 +706,7 @@ def handle83(FileObject):
|
|||||||
'Text': Text
|
'Text': Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle84(FileObject):
|
def handle84(FileObject):
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
Y = DataUtil.readShort(FileObject)
|
Y = DataUtil.readShort(FileObject)
|
||||||
@@ -673,6 +728,7 @@ def handle84(FileObject):
|
|||||||
'Action': Action
|
'Action': Action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handleC8(FileObject):
|
def handleC8(FileObject):
|
||||||
StatID = DataUtil.readInt(FileObject)
|
StatID = DataUtil.readInt(FileObject)
|
||||||
Amount = DataUtil.readByte(FileObject)
|
Amount = DataUtil.readByte(FileObject)
|
||||||
@@ -680,6 +736,7 @@ def handleC8(FileObject):
|
|||||||
'Amount': Amount
|
'Amount': Amount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handleC9(FileObject):
|
def handleC9(FileObject):
|
||||||
PlayerName = DataUtil.readString(FileObject)
|
PlayerName = DataUtil.readString(FileObject)
|
||||||
Online = DataUtil.readBoolean(FileObject)
|
Online = DataUtil.readBoolean(FileObject)
|
||||||
@@ -689,6 +746,7 @@ def handleC9(FileObject):
|
|||||||
'Ping': Ping
|
'Ping': Ping
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handleCA(FileObject):
|
def handleCA(FileObject):
|
||||||
#byte - flags
|
#byte - flags
|
||||||
Flags = DataUtil.readByte(FileObject)
|
Flags = DataUtil.readByte(FileObject)
|
||||||
@@ -703,10 +761,12 @@ def handleCA(FileObject):
|
|||||||
'Walk Speed': WalkSpeed
|
'Walk Speed': WalkSpeed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handleCB(FileObject):
|
def handleCB(FileObject):
|
||||||
text = DataUtil.readString(FileObject)
|
text = DataUtil.readString(FileObject)
|
||||||
return {'Text': text}
|
return {'Text': text}
|
||||||
|
|
||||||
|
|
||||||
def handleFA(FileObject):
|
def handleFA(FileObject):
|
||||||
Channel = DataUtil.readString(FileObject)
|
Channel = DataUtil.readString(FileObject)
|
||||||
length = DataUtil.readShort(FileObject)
|
length = DataUtil.readShort(FileObject)
|
||||||
@@ -715,8 +775,8 @@ def handleFA(FileObject):
|
|||||||
'message': message
|
'message': message
|
||||||
}
|
}
|
||||||
|
|
||||||
def handleFC(FileObject):
|
|
||||||
|
|
||||||
|
def handleFC(FileObject):
|
||||||
#short - shared secret length
|
#short - shared secret length
|
||||||
secretLength = DataUtil.readShort(FileObject)
|
secretLength = DataUtil.readShort(FileObject)
|
||||||
|
|
||||||
@@ -735,7 +795,6 @@ def handleFC(FileObject):
|
|||||||
|
|
||||||
|
|
||||||
def handleFD(FileObject):
|
def handleFD(FileObject):
|
||||||
|
|
||||||
#string - server id
|
#string - server id
|
||||||
serverid = DataUtil.readString(FileObject)
|
serverid = DataUtil.readString(FileObject)
|
||||||
|
|
||||||
@@ -756,6 +815,7 @@ def handleFD(FileObject):
|
|||||||
'Token': token
|
'Token': token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def handleFF(FileObject):
|
def handleFF(FileObject):
|
||||||
Reason = DataUtil.readString(FileObject)
|
Reason = DataUtil.readString(FileObject)
|
||||||
return {'Reason': Reason}
|
return {'Reason': Reason}
|
||||||
@@ -7,6 +7,7 @@ def send00(socket, KAid):
|
|||||||
#int - keep alive id
|
#int - keep alive id
|
||||||
DataUtil.sendInt(socket, KAid)
|
DataUtil.sendInt(socket, KAid)
|
||||||
|
|
||||||
|
|
||||||
def sendHandshake(socket, username, host, port):
|
def sendHandshake(socket, username, host, port):
|
||||||
#packet id
|
#packet id
|
||||||
socket.send("\x02")
|
socket.send("\x02")
|
||||||
@@ -23,6 +24,7 @@ def sendHandshake(socket, username, host, port):
|
|||||||
#int - server port
|
#int - server port
|
||||||
DataUtil.sendInt(socket, port)
|
DataUtil.sendInt(socket, port)
|
||||||
|
|
||||||
|
|
||||||
def send03(socket, message):
|
def send03(socket, message):
|
||||||
#packet id
|
#packet id
|
||||||
socket.send("\x03")
|
socket.send("\x03")
|
||||||
@@ -30,6 +32,7 @@ def send03(socket, message):
|
|||||||
#-----string - message-----#
|
#-----string - message-----#
|
||||||
DataUtil.sendString(socket, message)
|
DataUtil.sendString(socket, message)
|
||||||
|
|
||||||
|
|
||||||
def sendCD(socket, payload):
|
def sendCD(socket, payload):
|
||||||
#packet id
|
#packet id
|
||||||
socket.send("\xCD")
|
socket.send("\xCD")
|
||||||
@@ -37,6 +40,7 @@ def sendCD(socket, payload):
|
|||||||
#payload - byte
|
#payload - byte
|
||||||
DataUtil.sendByte(socket, payload)
|
DataUtil.sendByte(socket, payload)
|
||||||
|
|
||||||
|
|
||||||
def sendFC(socket, secret, token):
|
def sendFC(socket, secret, token):
|
||||||
#packet id
|
#packet id
|
||||||
socket.send("\xFC")
|
socket.send("\xFC")
|
||||||
@@ -49,6 +53,7 @@ def sendFC(socket, secret, token):
|
|||||||
DataUtil.sendShort(socket, token.__len__())
|
DataUtil.sendShort(socket, token.__len__())
|
||||||
socket.send(token)
|
socket.send(token)
|
||||||
|
|
||||||
|
|
||||||
def sendFF(socket, reason):
|
def sendFF(socket, reason):
|
||||||
#string - disconnect reason
|
#string - disconnect reason
|
||||||
DataUtil.sendString(socket, reason)
|
DataUtil.sendString(socket, reason)
|
||||||
@@ -2,7 +2,6 @@ import os
|
|||||||
import imp
|
import imp
|
||||||
|
|
||||||
class PluginLoader():
|
class PluginLoader():
|
||||||
|
|
||||||
path = ""
|
path = ""
|
||||||
plugins = []
|
plugins = []
|
||||||
listeners = []
|
listeners = []
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
class IRC:
|
class IRC:
|
||||||
|
|
||||||
options = None
|
options = None
|
||||||
writeFile = None
|
writeFile = None
|
||||||
|
|
||||||
def onEnable(self, parser):
|
def onEnable(self, parser):
|
||||||
|
|
||||||
parser.add_option("-q", "--irc-out-file", dest="ircDump", default="ircdump.txt",
|
parser.add_option("-q", "--irc-out-file", dest="ircDump", default="ircdump.txt",
|
||||||
help="file to dump messages to")
|
help="file to dump messages to")
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ import string
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
class PacketDumper:
|
class PacketDumper:
|
||||||
|
|
||||||
options = None
|
options = None
|
||||||
writeFile = None
|
writeFile = None
|
||||||
|
|
||||||
def onEnable(self, parser):
|
def onEnable(self, parser):
|
||||||
|
|
||||||
parser.add_option("-d", "--dump-packets",
|
parser.add_option("-d", "--dump-packets",
|
||||||
action="store_true", dest="dumpPackets", default=False,
|
action="store_true", dest="dumpPackets", default=False,
|
||||||
help="run with this argument to dump packets")
|
help="run with this argument to dump packets")
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from networking import PacketSenderManager, NetworkManager
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
|
||||||
parser.add_option("-u", "--username", dest="username", default="",
|
parser.add_option("-u", "--username", dest="username", default="",
|
||||||
|
|||||||
Reference in new issue
Block a user