Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root detection: check whether su binary exists #1194

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Mar 17, 2021

Goal

Adds code to check whether the su binary exists. If the binary does exist then it's a good indication that the device has been rooted.

Changeset

Added code to run which su and check the command output is non-empty.

Testing

Added unit tests to verify the function handles edge cases around IOExceptions etc. Additionally tested this check on a few devices to confirm the results are useful:

  • Returns false for an API 26 rooted emulator (this is expected because the su binary was not actually installed on the emulator)
  • Returns false for an API 29 non-rooted emulator
  • Returns true for a Pixel 3a rooted with Magisk, even when Magisk hide (root detection countermeasures) is enabled

@fractalwrench fractalwrench force-pushed the PLAT-6105/check-su-exists branch from e869899 to a12fe2d Compare March 17, 2021 14:58
@fractalwrench fractalwrench changed the title Root detection: check whether su exists Root detection: check whether su binary exists Mar 17, 2021
@fractalwrench fractalwrench marked this pull request as ready for review March 17, 2021 15:12
@fractalwrench fractalwrench force-pushed the PLAT-6105/check-su-exists branch from a12fe2d to ed18cc0 Compare March 17, 2021 15:21
Copy link
Contributor

@twometresteve twometresteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants