Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Should we tunnel over SSH?
if 'sshhost' in info:
sshtunnel.ammendfromconfig(info)
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
sshtunnel.getservice(reactor, info).addCallbacks(sshconnect, genericfailure)
# We shouldn't tunnel, set up a regular connection
else:
log.msg("Attempting VNC connection to %s:%d" % (info['vnchost'], info['vncport']))
reactor.connectTCP(info['vnchost'], info['vncport'], factory)
return d