Better check for if device has root

"which su" will return the path of the su binary, or it will return nothing. 
The python boolean of a string with something in it (such as the path of the su binary), will be True.
An empty string (where there is no su binary) will be False.
This commit is contained in:
Adam Lawson 2021-07-20 12:52:14 +01:00
parent 425d83e0a0
commit 9317586851
1 changed files with 1 additions and 1 deletions

View File

@ -96,7 +96,7 @@ class AndroidExtraction(MVTModule):
"""Check if we have a `su` binary on the Android device.
:returns: Boolean indicating whether a `su` binary is present or not
"""
return bool(self._adb_command("[ ! -f /sbin/su ] || echo 1"))
return bool(self._adb_command("which su"))
def _adb_root_or_die(self):
"""Check if we have a `su` binary, otherwise raise an Exception.