def __init__(self, window_agents): Thread.__init__(self) # Make sure this thread is a daemon not to prevent program exit. self.daemon = True realm = manhole_ssh.TerminalRealm() namespace = { 'Gtk': Gtk, 'walk': walk, 'widgets': lambda: walk(iter(window_agents).next()), 'window_agents': window_agents, 'window': lambda: iter(window_agents).next() } realm.chainedProtocolFactory.protocolFactory = \ lambda _: manhole.Manhole(namespace) p = portal.Portal(realm) p.registerChecker( checkers.InMemoryUsernamePasswordDatabaseDontUse(nemo='nemo')) reactor.listenTCP(2222, manhole_ssh.ConchFactory(p)) # Starting the thread is not enough because the Python interpreter # is no running all the time and therefore the thread will not run # too. Workaround this by using a timer to run the interpreter # periodically. def timer(): time.sleep(0.001) # Yield to other threads. return True GObject.timeout_add(10, timer)
def getManholeFactory(namespace, **passwords): realm = manhole_ssh.TerminalRealm() realm.chainedProtocolFactory.protocolFactory = ( lambda _: manhole.Manhole(namespace) ) p = portal.Portal(realm) p.registerChecker( checkers.InMemoryUsernamePasswordDatabaseDontUse(**passwords) ) f = manhole_ssh.ConchFactory(p) return f
def getManhole(_): return manhole.Manhole(namespace)
def getManhole(_): return manhole.Manhole(namespace) realm.chainedProtocolFactory.protocolFactory = getManhole
def create_remote_protocol(_): return manhole.Manhole(namespace)
def getManhole(serverProtocol): startingNamespace = { 'config': configuration, 'services': services, } return manhole.Manhole(util.getNamespace(startingNamespace))