ready for 1.2.0
This commit is contained in:
@@ -29,7 +29,7 @@ from rdpy.protocol.rdp import rdp
|
|||||||
from rdpy.core.error import RDPSecurityNegoFail
|
from rdpy.core.error import RDPSecurityNegoFail
|
||||||
|
|
||||||
import rdpy.core.log as log
|
import rdpy.core.log as log
|
||||||
#log._LOG_LEVEL = log.Level.INFO
|
log._LOG_LEVEL = log.Level.INFO
|
||||||
|
|
||||||
class RDPClientQtFactory(rdp.ClientFactory):
|
class RDPClientQtFactory(rdp.ClientFactory):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class ProxyServer(rdp.RDPServerObserver):
|
|||||||
if self._client is None:
|
if self._client is None:
|
||||||
#try a connection
|
#try a connection
|
||||||
domain, username, password = self._controller.getCredentials()
|
domain, username, password = self._controller.getCredentials()
|
||||||
|
log.info("Credentials dump : connection from %s with %s\\%s [%s]"%(self._controller.getHostname(), domain, username, password))
|
||||||
|
|
||||||
width, height = self._controller.getScreen()
|
width, height = self._controller.getScreen()
|
||||||
reactor.connectTCP(self._target[0], int(self._target[1]), ProxyClientFactory(self, width, height,
|
reactor.connectTCP(self._target[0], int(self._target[1]), ProxyClientFactory(self, width, height,
|
||||||
@@ -223,6 +224,7 @@ class ProxyClientFactory(rdp.ClientFactory):
|
|||||||
self._domain = domain
|
self._domain = domain
|
||||||
self._username = username
|
self._username = username
|
||||||
self._password = password
|
self._password = password
|
||||||
|
self._security = "ssl"
|
||||||
|
|
||||||
def buildObserver(self, controller, addr):
|
def buildObserver(self, controller, addr):
|
||||||
"""
|
"""
|
||||||
@@ -238,8 +240,23 @@ class ProxyClientFactory(rdp.ClientFactory):
|
|||||||
controller.setDomain(self._domain)
|
controller.setDomain(self._domain)
|
||||||
controller.setUsername(self._username)
|
controller.setUsername(self._username)
|
||||||
controller.setPassword(self._password)
|
controller.setPassword(self._password)
|
||||||
|
controller.setSecurityLevel(self._security)
|
||||||
return ProxyClient(controller, self._server)
|
return ProxyClient(controller, self._server)
|
||||||
|
|
||||||
|
def clientConnectionLost(self, connector, reason):
|
||||||
|
"""
|
||||||
|
@summary: Connection lost event
|
||||||
|
@param connector: twisted connector use for rdp connection (use reconnect to restart connection)
|
||||||
|
@param reason: str use to advertise reason of lost connection
|
||||||
|
"""
|
||||||
|
#try reconnect with basic RDP security
|
||||||
|
if reason.type == error.RDPSecurityNegoFail:
|
||||||
|
#stop nego
|
||||||
|
log.info("due to security nego error back to standard RDP security layer")
|
||||||
|
self._security = "rdp"
|
||||||
|
connector.connect()
|
||||||
|
return
|
||||||
|
|
||||||
class Shadow(rdp.RDPServerObserver):
|
class Shadow(rdp.RDPServerObserver):
|
||||||
"""
|
"""
|
||||||
@summary: Use to manage admin session
|
@summary: Use to manage admin session
|
||||||
|
|||||||
@@ -101,19 +101,16 @@ class RDPScreenShotFactory(rdp.ClientFactory):
|
|||||||
"""
|
"""
|
||||||
@summary: observer that connect, cache every image received and save at deconnection
|
@summary: observer that connect, cache every image received and save at deconnection
|
||||||
"""
|
"""
|
||||||
def __init__(self, controller, width, height, security, path, timeout, reactor):
|
def __init__(self, controller, width, height, path, timeout, reactor):
|
||||||
"""
|
"""
|
||||||
@param controller: {RDPClientController}
|
@param controller: {RDPClientController}
|
||||||
@param width: {integer} width of screen
|
@param width: {integer} width of screen
|
||||||
@param height: {integer} height of screen
|
@param height: {integer} height of screen
|
||||||
@param security: {str} (ssl | rdp) security level
|
|
||||||
@param path: {str} path of output screenshot
|
@param path: {str} path of output screenshot
|
||||||
@param timeout: {float} close connection after timeout s without any updating
|
@param timeout: {float} close connection after timeout s without any updating
|
||||||
@param reactor: twisted reactor
|
@param reactor: twisted reactor
|
||||||
"""
|
"""
|
||||||
rdp.RDPClientObserver.__init__(self, controller)
|
rdp.RDPClientObserver.__init__(self, controller)
|
||||||
controller.setScreen(width, height);
|
|
||||||
controller.setSecurityLevel(security)
|
|
||||||
self._buffer = QtGui.QImage(width, height, QtGui.QImage.Format_RGB32)
|
self._buffer = QtGui.QImage(width, height, QtGui.QImage.Format_RGB32)
|
||||||
self._path = path
|
self._path = path
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
@@ -148,7 +145,9 @@ class RDPScreenShotFactory(rdp.ClientFactory):
|
|||||||
def checkUpdate(self):
|
def checkUpdate(self):
|
||||||
self._controller.close();
|
self._controller.close();
|
||||||
|
|
||||||
return ScreenShotObserver(controller, self._width, self._height, self._security, self._path, self._timeout, self._reactor)
|
controller.setScreen(width, height);
|
||||||
|
controller.setSecurityLevel(self._security)
|
||||||
|
return ScreenShotObserver(controller, self._width, self._height, self._path, self._timeout, self._reactor)
|
||||||
|
|
||||||
def main(width, height, path, timeout, hosts):
|
def main(width, height, path, timeout, hosts):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -265,20 +265,11 @@ class LicenseManager(object):
|
|||||||
self._username = ""
|
self._username = ""
|
||||||
self._hostname = ""
|
self._hostname = ""
|
||||||
|
|
||||||
def generateKeys(self):
|
|
||||||
"""
|
|
||||||
@summary: generate keys for license session
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def recv(self, s):
|
def recv(self, s):
|
||||||
"""
|
"""
|
||||||
@summary: receive license packet from PDU layer
|
@summary: receive license packet from PDU layer
|
||||||
@return true when license automata is finish
|
@return true when license automata is finish
|
||||||
"""
|
"""
|
||||||
with open("/tmp/toto", "wb") as f:
|
|
||||||
f.write(s.getvalue()[s.pos:].encode('base64'))
|
|
||||||
|
|
||||||
licPacket = LicPacket()
|
licPacket = LicPacket()
|
||||||
s.readType(licPacket)
|
s.readType(licPacket)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Some use full methods for security in RDP
|
RDP Standard security layer
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sha, md5
|
import sha, md5
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -4,7 +4,7 @@ import setuptools
|
|||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
|
|
||||||
setup(name='rdpy',
|
setup(name='rdpy',
|
||||||
version='1.1.3',
|
version='1.2.0',
|
||||||
description='Remote Desktop Protocol in Python',
|
description='Remote Desktop Protocol in Python',
|
||||||
long_description="""
|
long_description="""
|
||||||
RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol.
|
RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol.
|
||||||
@@ -16,6 +16,7 @@ setup(name='rdpy',
|
|||||||
packages=[
|
packages=[
|
||||||
'rdpy',
|
'rdpy',
|
||||||
'rdpy.core',
|
'rdpy.core',
|
||||||
|
'rdpy.security',
|
||||||
'rdpy.protocol',
|
'rdpy.protocol',
|
||||||
'rdpy.protocol.rdp',
|
'rdpy.protocol.rdp',
|
||||||
'rdpy.protocol.rdp.pdu',
|
'rdpy.protocol.rdp.pdu',
|
||||||
|
|||||||
Reference in New Issue
Block a user