Esempio n. 1
0
 def sshconnect(service):
    protocol = factory.buildProtocol(None)
    transport = sshtunnel.RFBSSHChannel(protocol)
    request = forwarding.packOpen_direct_tcpip(
          (info['vnchost'], info['vncport']),    # The remote endpoint
          ('localhost', 0))                      # The local endpoint
    log.msg("Opening VNC connection to %s:%d over SSH tunnel" % (info['vnchost'], info['vncport']))
    service.openChannel(transport, request)
    return service
Esempio n. 2
0
 def requestRemoteForwarding(self, remotePort, hostport):
     '''
     will get called when the remote forwarding request gets started
     '''
     data = forwarding.packOpen_direct_tcpip(('0.0.0.0',remotePort),hostport)
     d = self.sendGlobalRequest('tcpip-forward', data, wantReply=1)
     log.msg('requesting remote forwarding %s:%s' %(remotePort, hostport))
     d.addCallback(self._cbRemoteForwarding, remotePort, hostport)
     d.addErrback(self._ebRemoteForwarding, remotePort, hostport)
 def requestRemoteForwarding(self, remotePort, hostport):
     '''
     will get called when the remote forwarding request gets started
     '''
     data = forwarding.packOpen_direct_tcpip(('0.0.0.0', remotePort),
                                             hostport)
     d = self.sendGlobalRequest('tcpip-forward', data, wantReply=1)
     log.msg('requesting remote forwarding %s:%s' % (remotePort, hostport))
     d.addCallback(self._cbRemoteForwarding, remotePort, hostport)
     d.addErrback(self._ebRemoteForwarding, remotePort, hostport)
Esempio n. 4
0
 def sshconnect(service):
     protocol = factory.buildProtocol(None)
     transport = sshtunnel.RFBSSHChannel(protocol)
     request = forwarding.packOpen_direct_tcpip(
         (info['vnchost'], info['vncport']),  # The remote endpoint
         ('localhost', 0))  # The local endpoint
     log.msg("Opening VNC connection to %s:%d over SSH tunnel" %
             (info['vnchost'], info['vncport']))
     service.openChannel(transport, request)
     return service
Esempio n. 5
0
 def do_CONNECT(self):
     logger.debug("SSHInputProtocol.do_CONNECT")
     
     if len(sshConnections) == 0:
         self.transport.loseConnection()
         return
     
     self.i = random.randrange(0, len(sshConnections))
     
     sshConnection = sshConnections[self.i]
     self.outputProtocol = SSHChannel(conn = sshConnection)
     self.outputProtocol.inputProtocol = self
     localAddress = self.transport.getHost()
     data = forwarding.packOpen_direct_tcpip((self.remoteAddress, self.remotePort), (localAddress.host, localAddress.port))
     sshConnection.openChannel(self.outputProtocol, data)
Esempio n. 6
0
 def connect(self, remoteAddress, remotePort, inputProtocol):
     twunnel.logger.log(3, "trace: SSHOutputProtocolConnection.connect")
     
     if len(self.connections) == 0:
         return
     
     self.i = self.i + 1
     if self.i >= len(self.connections):
         self.i = 0
     
     connection = self.connections[self.i]
     
     inputProtocol.outputProtocol = SSHChannel(conn = connection)
     inputProtocol.outputProtocol.inputProtocol = inputProtocol
     data = forwarding.packOpen_direct_tcpip((remoteAddress, remotePort), (self.configuration["LOCAL_PROXY_SERVER"]["ADDRESS"], self.configuration["LOCAL_PROXY_SERVER"]["PORT"]))
     connection.openChannel(inputProtocol.outputProtocol, data)
Esempio n. 7
0
    def connect(self):
        logger.debug("SSHInputProtocol.connect")

        if len(sshConnections) == 0:
            self.transport.loseConnection()
            return

        self.i = random.randrange(0, len(sshConnections))

        sshConnection = sshConnections[self.i]
        self.outputProtocol = SSHChannel(conn=sshConnection)
        self.outputProtocol.inputProtocol = self
        localAddress = self.transport.getHost()
        data = forwarding.packOpen_direct_tcpip(
            (self.remoteAddress, self.remotePort),
            (localAddress.host, localAddress.port))
        sshConnection.openChannel(self.outputProtocol, data)
    def connect(self, remoteAddress, remotePort, inputProtocol):
        twunnel.logger.log(3, "trace: SSHOutputProtocolConnection.connect")

        if len(self.connections) == 0:
            return

        self.i = self.i + 1
        if self.i >= len(self.connections):
            self.i = 0

        connection = self.connections[self.i]

        inputProtocol.outputProtocol = SSHChannel(conn=connection)
        inputProtocol.outputProtocol.inputProtocol = inputProtocol
        data = forwarding.packOpen_direct_tcpip(
            (remoteAddress, remotePort),
            (self.configuration["LOCAL_PROXY_SERVER"]["ADDRESS"],
             self.configuration["LOCAL_PROXY_SERVER"]["PORT"]))
        connection.openChannel(inputProtocol.outputProtocol, data)