Use component name as targets

Services can name their process name arbitrarily, for instance the service in
com.google.android.gms that is responsible for SafetyNet is named
com.google.android.gms.unstable. There are many apps out in the wild use
dedicated services with special names to detect root, and previously the user
is expected to add all of them to the hide list.

In this commit, we change from targeting process names to component names.
On Android, component names are composed of <pkg>/<cls>. When targeting
component names, we can always know what application spawned the new process.
This means that if the user adds a package name to the hidelist, MagiskHide can
now target ALL possible processes of that specific application.

To abide with this change, the default SafetyNet target is now changed from
com.google.android.gms.unstable (process name) to
com.google.android.gms/.droidguard.DroidGuardService (component name)
This commit is contained in:
topjohnwu
2018-11-23 15:47:49 -05:00
parent c8c57c74cc
commit 38fcc57bbf
4 changed files with 31 additions and 36 deletions
+9 -5
View File
@@ -17,14 +17,18 @@ bool hide_enabled = false;
[[noreturn]] static void usage(char *arg0) {
fprintf(stderr,
"MagiskHide v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ") (by topjohnwu)\n\n"
"Usage: %s [--options [arguments...] ]\n\n"
"Usage: %s [--option [arguments...] ]\n\n"
"Options:\n"
" --status Return the status of MagiskHide\n"
" --enable Start magiskhide\n"
" --disable Stop magiskhide\n"
" --add PROCESS Add PROCESS to the hide list\n"
" --rm PROCESS Remove PROCESS from the hide list\n"
" --add TARGET Add TARGET to the hide list\n"
" --rm TARGET Remove TARGET from the hide list\n"
" --ls Print out the current hide list\n"
"\n"
"TARGET can be either a package name or a specific component name\n"
"If TARGET is a package name, all components of the app will be targeted\n"
"A component name is composed of <pkg>/<cls>\n"
, arg0);
exit(1);
}
@@ -115,10 +119,10 @@ int magiskhide_main(int argc, char *argv[]) {
fprintf(stderr, "MagiskHide is enabled\n");
break;
case HIDE_ITEM_EXIST:
fprintf(stderr, "Process [%s] already exists in hide list\n", argv[2]);
fprintf(stderr, "[%s] already exists in hide list\n", argv[2]);
break;
case HIDE_ITEM_NOT_EXIST:
fprintf(stderr, "Process [%s] does not exist in hide list\n", argv[2]);
fprintf(stderr, "[%s] does not exist in hide list\n", argv[2]);
break;
/* Errors */