MCPcopy
hub / github.com/CreditTone/hooker / run_su_command

Function run_su_command

hooker.py:272–294  ·  view source on GitHub ↗
(cmd, not_read=False)

Source from the content-addressed store, hash-verified

270 return adb_device.shell(cmd, stream=stream)
271
272def run_su_command(cmd, not_read=False):
273 try:
274 if not_read:
275 _shell(f"{cmd} > /dev/null 2>&1 &")
276 time.sleep(1)
277 return
278 output = _shell(cmd).strip()
279 if output:
280 return output
281 except Exception:
282 pass
283 conn = _shell(["su", "-c", cmd], stream=True)
284 try:
285 if not_read:
286 time.sleep(1)
287 return
288 output = conn.read_until_close()
289 return output.strip()
290 finally:
291 try:
292 conn.close()
293 except Exception as e:
294 pass
295
296
297def get_is_magisk_root() -> bool:

Callers 11

get_is_magisk_rootFunction · 0.85
is_rootFunction · 0.85
hooker.pyFile · 0.85
_get_pid_mapFunction · 0.85
_get_app_label_fastFunction · 0.85
get_remote_file_md5Function · 0.85
compara_and_update_fileFunction · 0.85
un_proxyFunction · 0.85
set_proxyFunction · 0.85

Calls 1

_shellFunction · 0.85

Tested by

no test coverage detected