MCPcopy
hub / github.com/Gallopsled/pwntools / root

Function root

pwnlib/adb/adb.py:150–172  ·  view source on GitHub ↗

Restarts adbd as root. .. doctest:: :skipif: skip_android >>> adb.root()

()

Source from the content-addressed store, hash-verified

148
149@with_device
150def root():
151 """Restarts adbd as root.
152
153 .. doctest::
154 :skipif: skip_android
155
156 >>> adb.root()
157 """
158 log.info("Enabling root on %s" % context.device)
159
160 with context.quiet:
161 with AdbClient() as c:
162 reply = c.root()
163
164 if 'already running as root' in reply:
165 return
166
167 elif not reply or 'restarting adbd as root' in reply:
168 with context.quiet:
169 wait_for_device()
170
171 else:
172 log.error("Could not run as root:\n%s" % reply)
173
174def no_emulator(f):
175 @functools.wraps(f)

Callers 7

disable_verityFunction · 0.85
remountFunction · 0.85
kallsymsMethod · 0.85
versionMethod · 0.85
cmdlineMethod · 0.85
lastmsgMethod · 0.85
__iter__Method · 0.85

Calls 5

AdbClientClass · 0.90
wait_for_deviceFunction · 0.85
infoMethod · 0.80
rootMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected