def __get_wdaport_by_udid(udid): outputlines = CmdExecuter.executeAndWait("ps -ef|grep \"iproxy [0-9]\+ 8100 " + udid + "\"") for line in outputlines: ret = re.search("iproxy ([0-9]+) 8100 " + udid, line.decode("utf-8")) if ret: return ret.group(1) outputlines = CmdExecuter.executeAndWait("ps -ef|grep \"iproxy [0-9]\+ 8100" + "\"") for line in outputlines: ret = re.search("iproxy ([0-9]+) 8100$", line.decode("utf-8")) if ret: return ret.group(1) logger.warn("No wda port detected for device.. " + udid) return None
def removeAllForwards(self): for key, value in self.forward_list.items(): localport = str(key) cmd = "iproxy " + localport + " " CmdExecuter.executeAndWait("pkill -f \"" + cmd + "\"") self.forward_list.clear()
def removeForward(self, localport): localport = str(localport) cmd = "iproxy " + localport + " " CmdExecuter.executeAndWait("pkill -f \"" + cmd + "\"") if localport in self.forward_list.keys(): self.forward_list.pop(localport)
def install(self, ipapath): cmd = "ideviceinstaller -i " + ipapath if self.udid != None: cmd = " -u " + self.udid CmdExecuter.executeAndWait(cmd)
def uninstall(self, bundleid): cmd = "ideviceinstaller -U " + bundleid if self.udid != None: cmd = " -u " + self.udid CmdExecuter.executeAndWait(cmd)