MCPcopy Create free account
hub / github.com/HexHive/NASS / execute_privileged_command

Function execute_privileged_command

adb.py:101–129  ·  view source on GitHub ↗

Executes the given privileged command on the device

(
    cmd, device_id, wait_for_termination=True, timeout=None, do_log=True
)

Source from the content-addressed store, hash-verified

99
100
101def execute_privileged_command(
102 cmd, device_id, wait_for_termination=True, timeout=None, do_log=True
103):
104 """Executes the given privileged command on the device"""
105 if (
106 device_id in FANS_PIXEL_2_XL
107 or (type(device_id) == bytes and b"emulator" in device_id)
108 or (type(device_id) == str and "emulator" in device_id)
109 ):
110 out, err = call_adb(
111 ["shell", "su root sh -c '{}'".format(cmd)],
112 device_id=device_id,
113 wait_for_termination=wait_for_termination,
114 timeout=timeout,
115 do_log=do_log,
116 )
117 else:
118 out, err = call_adb(
119 ["shell", "su -c '{}'".format(cmd)],
120 device_id=device_id,
121 wait_for_termination=wait_for_termination,
122 timeout=timeout,
123 do_log=do_log,
124 )
125 if err:
126 log.debug(
127 f">>>[{device_id}]>>> error executing privileged cmd. err: {err}"
128 )
129 return out, err
130
131
132def execute_runas_command(

Callers 15

push_privilegedFunction · 0.85
get_service_pidFunction · 0.85
kill_serviceFunction · 0.85
rebootFunction · 0.85
pull_privilegedFunction · 0.85
path_existsFunction · 0.85
check_deviceFunction · 0.85
is_pid_runningFunction · 0.85
kill_fridaFunction · 0.85
get_md5_filehashFunction · 0.85
reset_serviceFunction · 0.85
clear_logcatFunction · 0.85

Calls 1

call_adbFunction · 0.85

Tested by

no test coverage detected