Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (62 sloc) 2.12 KB
import socket
import threading
import struct
import remotemeMessages
import remotemeStruct
import logging
from remotemeMessages import getUserMessage
class RemoteMeDataReader:
def __init__(self, data):
self.__logger = logging.getLogger('remoteMe.RemoteMeData')
if isinstance(data, str): = data.encode("utf-8")
else: = data
self.offset = 0
def readInt8(self):
[ret] = struct.unpack_from(">b",, self.offset)
self.offset += struct.calcsize(">b")
return ret
def readString(self):
dataRet = []
ret = self.readUInt8()
while ret != 0:
ret = self.readUInt8()
return struct.pack("B" * len(dataRet), *dataRet).decode('utf8')
def readData(self, size):
dataRet = []
while size != 0:
size = size - 1
return dataRet
def readRest(self):
return self.readData(len(
def readUInt8(self):
[ret] = struct.unpack_from(">B",, self.offset)
self.offset += struct.calcsize(">B")
return ret
def readInt16(self):
[ret] = struct.unpack_from(">h",, self.offset)
self.offset += struct.calcsize(">h")
return ret
def readUInt16(self):
[ret] = struct.unpack_from(">H",, self.offset)
self.offset += struct.calcsize(">H")
return ret
def readInt32(self):
[ret] = struct.unpack_from(">i",, self.offset)
self.offset += struct.calcsize(">i")
return ret
def readUInt32(self):
[ret] = struct.unpack_from(">I",, self.offset)
self.offset += struct.calcsize(">I")
return ret
def readUInt64(self):
[ret] = struct.unpack_from(">Q",, self.offset)
self.offset += struct.calcsize(">Q")
return ret
def readDouble(self):
[ret] = struct.unpack_from(">d",, self.offset)
self.offset += struct.calcsize(">d")
return ret
You can’t perform that action at this time.