start server side app

This commit is contained in:
citronneur@gmail.com
2014-02-09 22:03:51 +01:00
parent 120f142926
commit ec971361c1
7 changed files with 30 additions and 19 deletions

View File

@@ -7,11 +7,11 @@ class Factory(protocol.Factory):
'''
Factory of RDP protocol
'''
def __init__(self):
pass
def __init__(self, mode):
self._mode = mode
def buildProtocol(self, addr):
return tpkt.TPKT(tpdu.TPDU(mcs.MCS(sil.SIL())));
return tpkt.TPKT(tpdu.TPDU(mcs.MCS(sil.SIL(self._mode))));
def startedConnecting(self, connector):
print 'Started to connect.'

View File

@@ -391,11 +391,11 @@ class SIL(LayerAutomata):
Global channel for mcs that handle session
identification user, licensing management, and capabilities exchange
'''
def __init__(self):
def __init__(self, mode):
'''
Constructor
'''
LayerAutomata.__init__(self, None)
LayerAutomata.__init__(self, mode, None)
#set by mcs layer channel init
self._channelId = UInt16Be()
#logon info send from client to server

View File

@@ -1,7 +1,7 @@
'''
@author: sylvain
'''
from rdpy.network.layer import LayerAutomata
from rdpy.network.layer import LayerAutomata, LayerMode
from rdpy.network.type import UInt8, UInt16Le, UInt16Be, UInt32Le, CompositeType, sizeof
from rdpy.network.error import InvalidExpectedDataException
from rdpy.network.const import ConstAttributes, TypeAttributes
@@ -95,12 +95,12 @@ class TPDU(LayerAutomata):
TPDU layer management
there is an connection automata
'''
def __init__(self, presentation = None):
def __init__(self, presentation):
'''
Constructor
@param presentation: MCS layer
'''
LayerAutomata.__init__(self, presentation)
LayerAutomata.__init__(self, presentation._mode, presentation)
#default selectedProtocol is SSl because is the only supported
#in this version of RDPY
#client requested selectedProtocol
@@ -113,7 +113,10 @@ class TPDU(LayerAutomata):
connection request
for client send a connection request packet
'''
self.sendConnectionRequest()
if self._mode == LayerMode.CLIENT:
self.sendConnectionRequest()
else:
self.setNextState(self.recvConnectionRequest)
def recvConnectionConfirm(self, data):
'''

View File

@@ -1,7 +1,7 @@
'''
@author: sylvain
'''
from rdpy.network.layer import RawLayer
from rdpy.network.layer import RawLayer, LayerMode
from rdpy.network.type import UInt8, UInt16Be, sizeof
class TPKT(RawLayer):
@@ -17,7 +17,7 @@ class TPKT(RawLayer):
'''
Constructor
'''
RawLayer.__init__(self, presentation)
RawLayer.__init__(self, LayerMode.NONE, presentation)
#last packet version read from header
self._lastPacketVersion = UInt8()
#length may be coded on more than 1 bytes