def _rescan(self): locator = Pyro.naming.NameServerLocator() ns = locator.getNS() for name, isobject in ns.list(":Client"): if isobject: self._clients[name] = remoteclient.get_remote(name) self.add_completion_scope("host", self._clients.keys())
def main(): client = Client(PORT_START, PORT_END) if len(sys.argv) > 1: inet_addr = sys.argv[1] client.addr = inet_addr if not client.connect(): sys.stderr.write('failed to connect to {}\n'.format(inet_addr)) tasks = TaskQueue() wrk = Worker(tasks, client) gui = GUI(tasks) wrk.start() gui.window.mainloop()
#!/usr/bin/env python import time from remote import Client from remote import Server hosts = [] # numbers = [4, 20, 2, 3, 5, 6, 14, 15, 16, 18, 19, 21] numbers = [14, 15, 15, 15, 15, 15, 15] for number in numbers: hosts.append("10.22.1.%d" % number) server_host = hosts[0] client_hosts = hosts[1:] if __name__ == '__main__': server = Server(server_host) server.start() time.sleep(2) clients = [] for client_host in client_hosts: client = Client(client_host, server_host) client.start() clients.append(client) for client in clients: client.wait()
def send_fmt(self, cmd, *args): return self.send(Client.create_msg(cmd, *args))
def rcopy(self, argv): """rcopy <remotefile> <localfile> Copies a file from the remote agent to the local file system.""" src = argv[1] dest = argv[2] remoteclient.remote_copy(self._client, src, dest)