def test_run(self): idb = IDB() with patch( "platforms.platform_util_base.PlatformUtilBase.run", side_effect=self._util_base_run, ): idb.run()
def getDevices(self): idb = IDB() rows = idb.run("--detect") if len(rows) == 0: return {} rows.pop(0) pattern = re.compile(".* Found ([\d|a-f]+) \((\w+), .+\) a\.k\.a\. .*") devices = {} for row in rows: match = pattern.match(row) if match: hash = match.group(1) model = match.group(2) devices[hash] = model return devices
def getDevices(self, silent=True, retry=1): idb = IDB() rows = idb.run(["--detect", "--timeout", "1"], silent=silent, retry=1) if len(rows) == 0: return {} rows.pop(0) pattern = re.compile( r".* Found ([\d|a-f|\-|A-F]+) \((\w+), .+, .+, (.+), (.+), .+\) a\.k\.a\. .*" ) devices = {} for row in rows: match = pattern.match(row) if match: hash = match.group(1) model = match.group(2) abi = match.group(3) os_version = match.group(4) devices[hash] = {"model": model, "abi": abi, "os_version": os_version} return devices