Skip to content

Commit

Permalink
Better check for if device has root
Browse files Browse the repository at this point in the history
"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.
  • Loading branch information
goshawk22 committed Jul 20, 2021
1 parent cb6bde5 commit e10ff20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mvt/android/modules/adb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _adb_check_if_root(self):
"""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.
Expand Down

0 comments on commit e10ff20

Please sign in to comment.