bug
This commit is contained in:
12
rdpy/main.py
12
rdpy/main.py
@@ -11,14 +11,6 @@ from rdpy.protocol.rdp import tpkt, tpdu, mcs
|
||||
from twisted.internet import ssl
|
||||
from OpenSSL import SSL
|
||||
|
||||
class ClientTLSContext(ssl.ClientContextFactory):
|
||||
isClient = 1
|
||||
def getContext(self):
|
||||
context = SSL.Context(SSL.TLSv1_METHOD)
|
||||
context.set_options(SSL.OP_DONT_INSERT_EMPTY_FRAGMENTS)
|
||||
context.set_options(SSL.OP_TLS_BLOCK_PADDING_BUG)
|
||||
return context
|
||||
|
||||
if __name__ == '__main__':
|
||||
#app = QtGui.QApplication(sys.argv)
|
||||
#import qt4reactor
|
||||
@@ -31,7 +23,7 @@ if __name__ == '__main__':
|
||||
#w.show()
|
||||
from twisted.internet import reactor
|
||||
#reactor.connectTCP("127.0.0.1", 5901, factory.RfbFactory(protocol))
|
||||
#reactor.connectTCP("192.168.1.90", 3389, factory.RfbFactory(tpkt.TPKT(tpdu.TPDU(mcs.MCS()))))
|
||||
reactor.connectTCP("192.168.135.73", 3389, factory.RfbFactory(tpkt.TPKT(tpdu.TPDU(mcs.MCS()))))
|
||||
reactor.connectTCP("192.168.1.90", 3389, factory.RfbFactory(tpkt.TPKT(tpdu.TPDU(mcs.MCS()))))
|
||||
#reactor.connectTCP("192.168.135.73", 3389, factory.RfbFactory(tpkt.TPKT(tpdu.TPDU(mcs.MCS()))))
|
||||
reactor.run()
|
||||
#sys.exit(app.exec_())
|
||||
@@ -51,19 +51,20 @@ def readLength(s):
|
||||
@return: int or python long
|
||||
'''
|
||||
size = None
|
||||
byte = UInt8()
|
||||
s.readType(byte)
|
||||
if (byte & UInt8(0x80)) == UInt8(0x80):
|
||||
byte &= ~UInt8(0x80)
|
||||
if byte == UInt8(1):
|
||||
length = UInt8()
|
||||
s.readType(length)
|
||||
byte = length.value
|
||||
if (byte & 0x80):
|
||||
byte &= 0x80
|
||||
if byte == 1:
|
||||
size = UInt8()
|
||||
elif byte == UInt8(2):
|
||||
elif byte == 2:
|
||||
size = UInt16Be()
|
||||
else:
|
||||
raise InvalidExpectedDataException("ber length may be 1 or 2")
|
||||
s.readType(size)
|
||||
else:
|
||||
size = byte
|
||||
size = length
|
||||
return size.value
|
||||
|
||||
def writeLength(size):
|
||||
@@ -86,7 +87,7 @@ def readUniversalTag(s, tag, pc):
|
||||
'''
|
||||
byte = UInt8()
|
||||
s.readType(byte)
|
||||
return byte == (Class.BER_CLASS_UNIV | berPC(pc) | (Tag.BER_TAG_MASK & tag))
|
||||
return byte == ((Class.BER_CLASS_UNIV | berPC(pc)) | (Tag.BER_TAG_MASK & tag))
|
||||
|
||||
def writeUniversalTag(tag, pc):
|
||||
'''
|
||||
@@ -95,7 +96,7 @@ def writeUniversalTag(tag, pc):
|
||||
@param pc: boolean
|
||||
@return: UInt8
|
||||
'''
|
||||
return (Class.BER_CLASS_UNIV | berPC(pc) | (Tag.BER_TAG_MASK & tag))
|
||||
return ((Class.BER_CLASS_UNIV | berPC(pc)) | (Tag.BER_TAG_MASK & tag))
|
||||
|
||||
def readApplicationTag(s, tag):
|
||||
'''
|
||||
@@ -220,7 +221,7 @@ def writeOctetstring(value):
|
||||
return (writeUniversalTag(Tag.BER_TAG_OCTET_STRING, False), writeLength(len(value)), String(value))
|
||||
|
||||
def readEnumerated(s):
|
||||
'''
|
||||
'''rt-successful
|
||||
read enumerated structure
|
||||
@param s: Stream
|
||||
@return: int or long
|
||||
|
||||
@@ -123,22 +123,22 @@ class ClientCoreSettings(CompositeType):
|
||||
def __init__(self):
|
||||
CompositeType.__init__(self)
|
||||
self.rdpVersion = Version.RDP_VERSION_5_PLUS
|
||||
self.desktopWidth = UInt16Le(800)
|
||||
self.desktopHeight = UInt16Le(600)
|
||||
self.desktopWidth = UInt16Le(1280)
|
||||
self.desktopHeight = UInt16Le(1024)
|
||||
self.colorDepth = ColorDepth.RNS_UD_COLOR_8BPP
|
||||
self.sasSequence = Sequence.RNS_UD_SAS_DEL
|
||||
self.kbdLayout = UInt32Le(0x409)
|
||||
self.clientBuild = UInt32Le(2100)
|
||||
self.clientBuild = UInt32Le(3790)
|
||||
self.clientName = UniString("rdpy" + "\x00"*11)
|
||||
self.keyboardType = UInt32Le(4)
|
||||
self.keyboardSubType = UInt32Le(0)
|
||||
self.keyboardFnKeys = UInt32Le(12)
|
||||
self.padding3 = String("\x00"*64)
|
||||
self.imeFileName = String("\x00"*64)
|
||||
self.postBeta2ColorDepth = ColorDepth.RNS_UD_COLOR_8BPP
|
||||
self.clientProductId = UInt16Le(1)
|
||||
self.serialNumber = UInt32Le()
|
||||
self.serialNumber = UInt32Le(0)
|
||||
self.highColorDepth = HighColor.HIGH_COLOR_24BPP
|
||||
self.supportedColorDepths = Support.RNS_UD_24BPP_SUPPORT | Support.RNS_UD_15BPP_SUPPORT
|
||||
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)
|
||||
self.connectionType = UInt8()
|
||||
@@ -160,7 +160,7 @@ class ClientSecuritySettings(CompositeType):
|
||||
'''
|
||||
def __init__(self):
|
||||
CompositeType.__init__(self)
|
||||
self.encryptionMethods = Encryption.ENCRYPTION_FLAG_128BIT | Encryption.ENCRYPTION_FLAG_40BIT | Encryption.ENCRYPTION_FLAG_56BIT | Encryption.FIPS_ENCRYPTION_FLAG
|
||||
self.encryptionMethods = UInt32Le()
|
||||
self.extEncryptionMethods = UInt32Le()
|
||||
|
||||
class Channel(object):
|
||||
|
||||
@@ -132,7 +132,7 @@ def writeInteger(value):
|
||||
@param value: int or long python value
|
||||
@return: UInt8, UInt16Be or UInt32Be
|
||||
'''
|
||||
if value < 0xff:
|
||||
if value <= 0xff:
|
||||
return (writeLength(1), UInt8(value))
|
||||
elif value < 0xffff:
|
||||
return (writeLength(2), UInt16Be(value))
|
||||
@@ -192,7 +192,7 @@ def writeObjectIdentifier(oid):
|
||||
@param oid: tuple of 6 int
|
||||
@return: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8)
|
||||
'''
|
||||
return (UInt8(5), UInt8(oid[0] << 4 | oid[1] & 0x0f), UInt8(oid[2]), UInt8(oid[3]), UInt8(oid[4]), UInt8(oid[5]))
|
||||
return (UInt8(5), UInt8((oid[0] << 4) & (oid[1] & 0x0f)), UInt8(oid[2]), UInt8(oid[3]), UInt8(oid[4]), UInt8(oid[5]))
|
||||
|
||||
def writeNumericString(nStr, minValue):
|
||||
'''
|
||||
@@ -218,10 +218,8 @@ def writeNumericString(nStr, minValue):
|
||||
c2 = (c2 - 0x30) % 10
|
||||
|
||||
result.append(UInt8((c1 << 4) | c2))
|
||||
|
||||
s = Stream()
|
||||
s.writeType((writeLength(mlength), tuple(result)))
|
||||
return String(s.getvalue())
|
||||
|
||||
return (writeLength(mlength), tuple(result))
|
||||
|
||||
def readPadding(s, length):
|
||||
'''
|
||||
|
||||
@@ -122,7 +122,7 @@ class TPDU(LayerAutomata):
|
||||
add TPDU header
|
||||
'''
|
||||
self._transport.send((UInt8(2), MessageType.X224_TPDU_DATA, UInt8(0x80), message))
|
||||
|
||||
|
||||
def readNeg(self, data):
|
||||
'''
|
||||
read negotiation response
|
||||
|
||||
Reference in New Issue
Block a user