def secureConnection(self): """ Create and return a new SSH connection which has been secured and on which authentication has already happened. @return: A L{Deferred} which fires with the ready-to-use connection or with a failure if something prevents the connection from being setup, secured, or authenticated. """ factory = Factory() factory.protocol = _CommandTransport factory.hostname = self.hostname factory.username = self.username factory.keys = self.keys factory.password = self.password factory.agentEndpoint = self.agentEndpoint factory.knownHosts = self.knownHosts factory.command = self.command factory.ui = self.ui factory.creator = self factory.connectionReady = Deferred() sshClient = TCP4ClientEndpoint(self.reactor, self.hostname, self.port) d = sshClient.connect(factory) d.addCallback(lambda ignored: factory.connectionReady) return d
if mode == "s" or mode == "S": is_game = True print(is_game) factory.is_game = is_game factory.maps = [] factory.users_port = {} factory.RealObjects = {} factory.lock_positions = threading.Lock() factory.lock_sockets = threading.Lock() factory.keys = { "Red": key_object.KeyObject(1, 5*64, 5*64, "Red"), "Blue": key_object.KeyObject(2, 6*64, 5*64, "Blue"), "Yellow": key_object.KeyObject(3, 7*64, 5*64, "Yellow"), "Green": key_object.KeyObject(4, 8*64, 5*64, "Green") } config = json.loads(open('data.json').read()) map_0 = "" keys_0 = [] for line in config["map"]: map_0 += line for key in config["keys"]: keys_0.append(factory.keys[key]) factory.maps.append(map.Map(config["id"], map_0,