Eyewitness integration

This commit is contained in:
speyrefitte
2014-12-02 17:00:42 +01:00
parent 9419bea9b0
commit 44d99eaca4
2 changed files with 22 additions and 9 deletions

View File

@@ -38,6 +38,7 @@ class RDPScreenShotFactory(rdp.ClientFactory):
""" """
@summary: Factory for screenshot exemple @summary: Factory for screenshot exemple
""" """
__INSTANCE__ = 0
def __init__(self, width, height, path, timeout): def __init__(self, width, height, path, timeout):
""" """
@param width: width of screen @param width: width of screen
@@ -45,6 +46,7 @@ class RDPScreenShotFactory(rdp.ClientFactory):
@param path: path of output screenshot @param path: path of output screenshot
@param timeout: close connection after timeout s without any updating @param timeout: close connection after timeout s without any updating
""" """
RDPScreenShotFactory.__INSTANCE__ += 1
self._width = width self._width = width
self._height = height self._height = height
self._path = path self._path = path
@@ -57,8 +59,10 @@ class RDPScreenShotFactory(rdp.ClientFactory):
@param reason: str use to advertise reason of lost connection @param reason: str use to advertise reason of lost connection
""" """
log.info("connection lost : %s"%reason) log.info("connection lost : %s"%reason)
reactor.stop() RDPScreenShotFactory.__INSTANCE__ -= 1
app.exit() if(RDPScreenShotFactory.__INSTANCE__ == 0):
reactor.stop()
app.exit()
def clientConnectionFailed(self, connector, reason): def clientConnectionFailed(self, connector, reason):
""" """
@@ -66,9 +70,11 @@ class RDPScreenShotFactory(rdp.ClientFactory):
@param connector: twisted connector use for rdp connection (use reconnect to restart connection) @param connector: twisted connector use for rdp connection (use reconnect to restart connection)
@param reason: str use to advertise reason of lost connection @param reason: str use to advertise reason of lost connection
""" """
log.info("connection failes : %s"%reason) log.info("connection failed : %s"%reason)
reactor.stop() RDPScreenShotFactory.__INSTANCE__ -= 1
app.exit() if(RDPScreenShotFactory.__INSTANCE__ == 0):
reactor.stop()
app.exit()
def buildObserver(self, controller, addr): def buildObserver(self, controller, addr):
@@ -124,6 +130,7 @@ class RDPScreenShotFactory(rdp.ClientFactory):
if not self._hasUpdated: if not self._hasUpdated:
log.info("close connection on timeout without updating orders") log.info("close connection on timeout without updating orders")
self._controller.close(); self._controller.close();
self._brandWidthTask.stop()
return return
self._hasUpdated = False self._hasUpdated = False

View File

@@ -37,11 +37,13 @@ class RFBScreenShotFactory(rfb.ClientFactory):
""" """
@summary: Factory for screenshot exemple @summary: Factory for screenshot exemple
""" """
__INSTANCE__ = 0
def __init__(self, password, path): def __init__(self, password, path):
""" """
@param password: password for VNC authentication @param password: password for VNC authentication
@param path: path of output screenshot @param path: path of output screenshot
""" """
RFBScreenShotFactory.__INSTANCE__ += 1
self._path = path self._path = path
self._password = password self._password = password
@@ -52,8 +54,10 @@ class RFBScreenShotFactory(rfb.ClientFactory):
@param reason: str use to advertise reason of lost connection @param reason: str use to advertise reason of lost connection
""" """
log.info("connection lost : %s"%reason) log.info("connection lost : %s"%reason)
reactor.stop() RFBScreenShotFactory.__INSTANCE__ -= 1
app.exit() if(RFBScreenShotFactory.__INSTANCE__ == 0):
reactor.stop()
app.exit()
def clientConnectionFailed(self, connector, reason): def clientConnectionFailed(self, connector, reason):
""" """
@@ -62,8 +66,10 @@ class RFBScreenShotFactory(rfb.ClientFactory):
@param reason: str use to advertise reason of lost connection @param reason: str use to advertise reason of lost connection
""" """
log.info("connection failed : %s"%reason) log.info("connection failed : %s"%reason)
reactor.stop() RFBScreenShotFactory.__INSTANCE__ -= 1
app.exit() if(RFBScreenShotFactory.__INSTANCE__ == 0):
reactor.stop()
app.exit()
def buildObserver(self, controller, addr): def buildObserver(self, controller, addr):