Пример #1
0
 def __init__(self, mode):
     '''
     constructor
     '''
     RawLayer.__init__(self, mode)
     #usefull for rfb protocol
     self._callbackBody = None
     #protocol version negociated
     self._version = ProtocolVersion.RFB003008
     #nb security launch by server
     self._securityLevel = SecurityType.INVALID
     #shared framebuffer client init message
     self._sharedFlag = UInt8(False)
     #server init message
     #which contain framebuffer dim and pixel format
     self._serverInit = ServerInit()
     #client pixel format
     self._pixelFormat = PixelFormat()
     #server name
     self._serverName = String()
     #nb rectangle
     self._nbRect = 0
     #current rectangle header
     self._currentRect = Rectangle()
     #client or server adaptor
     self._observer = []
Пример #2
0
 def __init__(self, name="", options=UInt32Le()):
     CompositeType.__init__(self)
     #name of channel
     self.name = String(name[0:8] + "\x00" * (8 - len(name)),
                        readLen=UInt8(8))
     #unknown
     self.options = options
Пример #3
0
def writePadding(length):
    '''
    create string with null char * length
    @param length: length of padding
    @return: String with \x00 * length
    '''
    return String("\x00"*length)
Пример #4
0
def readOctetString(s):
    '''
    read ber string structure
    @param s: stream
    @return: String
    '''
    if not readUniversalTag(s, Tag.BER_TAG_OCTET_STRING, False):
        raise InvalidExpectedDataException("unexpected ber tag")
    size = readLength(s)
    return String(s.read(size.value))
Пример #5
0
 def __init__(self):
     CompositeType.__init__(self)
     self.rdpVersion = Version.RDP_VERSION_5_PLUS
     self.desktopWidth = UInt16Le(1280)
     self.desktopHeight = UInt16Le(1024)
     self.colorDepth = ColorDepth.RNS_UD_COLOR_8BPP
     self.sasSequence = Sequence.RNS_UD_SAS_DEL
     self.kbdLayout = KeyboardLayout.FRENCH
     self.clientBuild = UInt32Le(3790)
     self.clientName = UniString("rdpy" + "\x00" * 11, readLen=UInt8(30))
     self.keyboardType = KeyboardType.IBM_101_102_KEYS
     self.keyboardSubType = UInt32Le(0)
     self.keyboardFnKeys = UInt32Le(12)
     self.imeFileName = String("\x00" * 64, readLen=UInt8(64))
     self.postBeta2ColorDepth = ColorDepth.RNS_UD_COLOR_8BPP
     self.clientProductId = UInt16Le(1)
     self.serialNumber = UInt32Le(0)
     self.highColorDepth = HighColor.HIGH_COLOR_24BPP
     self.supportedColorDepths = Support.RNS_UD_24BPP_SUPPORT | Support.RNS_UD_16BPP_SUPPORT | Support.RNS_UD_15BPP_SUPPORT
     self.earlyCapabilityFlags = CapabilityFlags.RNS_UD_CS_SUPPORT_ERRINFO_PDU
     self.clientDigProductId = String("\x00" * 64, readLen=UInt8(64))
     self.connectionType = UInt8()
     self.pad1octet = UInt8()
     self.serverSelectedProtocol = UInt32Le()
Пример #6
0
 def __init__(self):
     CompositeType.__init__(self)
     self.wBlobType = UInt16Le()
     self.wBlobLen = UInt16Le(lambda: sizeof(self.blobData))
     self.blobData = String(readLen=self.wBlobLen,
                            conditional=lambda: self.wBlobLen.value > 0)
Пример #7
0
def writeOctetstring(value):
    '''
    write string in ber representation
    @param value: string
    @return: string ber structure 
    '''
    return (writeUniversalTag(Tag.BER_TAG_OCTET_STRING, False), writeLength(len(value)), String(value))
Пример #8
0
 def __init__(self, text=""):
     CompositeType.__init__(self)
     self.padding = (UInt16Be(), UInt8())
     self.size = UInt32Be(len(text))
     self.message = String(text)