Dumping current terrible implementation of a GUI for impending modularization
This commit is contained in:
1 parent
402aa6954f
commit
b1264d9d5a
8 files changed
+156
-710
No files matched your search
@@ -1,58 +1,54 @@
|
||||
import socket
|
||||
import struct
|
||||
import DataUtil
|
||||
|
||||
def send00(socket, KAid):
|
||||
#packet id
|
||||
socket.send("\x00")
|
||||
|
||||
#int - keep alive id
|
||||
socket.send(struct.pack('!i', KAid))
|
||||
DataUtil.sendInt(socket, KAid)
|
||||
|
||||
def sendHandshake(socket, username, host, port):
|
||||
#packet id
|
||||
socket.send("\x02")
|
||||
|
||||
#byte - protocol version
|
||||
socket.send(struct.pack('!b', 47))
|
||||
DataUtil.sendByte(socket, 47)
|
||||
|
||||
#string - username
|
||||
socket.send(struct.pack('!h', username.__len__()))
|
||||
socket.send(username.encode('utf-16be'))
|
||||
DataUtil.sendString(socket, username)
|
||||
|
||||
#string - server host
|
||||
socket.send(struct.pack('!h', host.__len__()))
|
||||
socket.send(host.encode('utf-16be'))
|
||||
DataUtil.sendString(socket, host)
|
||||
|
||||
#int - server port
|
||||
socket.send(struct.pack('!i', port))
|
||||
DataUtil.sendInt(socket, port)
|
||||
|
||||
def send03(socket, message):
|
||||
#packet id
|
||||
socket.send("\x03")
|
||||
|
||||
#-----string - message-----#
|
||||
socket.send(struct.pack('!h', message.__len__())) #length
|
||||
socket.send(message.encode("utf-16be")) #message
|
||||
DataUtil.sendString(socket, message)
|
||||
|
||||
def sendCD(socket, payload):
|
||||
#packet id
|
||||
socket.send("\xCD")
|
||||
|
||||
#payload - byte
|
||||
socket.send(struct.pack('!b', payload))
|
||||
DataUtil.sendByte(socket, payload)
|
||||
|
||||
def sendFC(socket, secret, token):
|
||||
#packet id
|
||||
socket.send("\xFC")
|
||||
|
||||
#shared secret
|
||||
socket.send(struct.pack('!h', secret.__len__())) #length
|
||||
DataUtil.sendShort(socket, secret.__len__()) #length
|
||||
socket.send(secret)
|
||||
|
||||
#token
|
||||
socket.send(struct.pack('!h', token.__len__())) #length
|
||||
DataUtil.sendShort(socket, token.__len__())
|
||||
socket.send(token)
|
||||
|
||||
def sendFF(socket, reason):
|
||||
socket.send(struct.pack('!h', reason.__len__())) #length
|
||||
socket.send(reason.encode("utf-16be")) #message
|
||||
#string - disconnect reason
|
||||
DataUtil.sendString(socket, reason)
|
||||
Reference in new issue
Block a user