Skip to content

Commit 7f8a591

Browse files
author
weishu.tws
committed
[Fix]: disable tinker.
1 parent 939d422 commit 7f8a591

File tree

2 files changed

+56
-6
lines changed

2 files changed

+56
-6
lines changed

exposed-core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131
}
3232

3333
group = 'me.weishu.exposed'
34-
version = '0.5.3'
34+
version = '0.5.4'
3535

3636
apply plugin: 'com.novoda.bintray-release'
3737

exposed-core/src/main/java/me/weishu/exposed/ExposedBridge.java

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.os.Build;
1010
import android.os.IBinder;
1111
import android.text.TextUtils;
12+
import android.util.Base64;
1213
import android.util.Log;
1314
import android.util.Pair;
1415
import android.view.AbsSavedState;
@@ -104,6 +105,7 @@ public static void initOnce(Context context, ApplicationInfo applicationInfo, Cl
104105

105106
initForXposedModule(context, applicationInfo, appClassLoader);
106107
initForXposedInstaller(context, applicationInfo, appClassLoader);
108+
initForWechat(context, applicationInfo, appClassLoader);
107109
}
108110

109111
private static boolean patchSystemClassLoader() {
@@ -408,6 +410,54 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
408410
});
409411
}
410412

413+
private static void initForWechat(Context context, ApplicationInfo applicationInfo, ClassLoader appClassLoader) {
414+
if (applicationInfo == null) {
415+
return;
416+
}
417+
final String WECHAT = decodeFromBase64("Y29tLnRlbmNlbnQubW0=");
418+
419+
if (!WECHAT.equals(applicationInfo.packageName)) {
420+
return;
421+
}
422+
if (WECHAT.equals(applicationInfo.processName)) {
423+
// for main process
424+
String dataDir = applicationInfo.dataDir;
425+
426+
File tinker = new File(dataDir, decodeFromBase64("dGlua2Vy"));
427+
File tinker_temp = new File(dataDir, decodeFromBase64("dGlua2VyX3RlbXA="));
428+
File tinker_server = new File(dataDir, decodeFromBase64("dGlua2VyX3NlcnZlcg=="));
429+
430+
deleteDir(tinker);
431+
deleteDir(tinker_temp);
432+
deleteDir(tinker_server);
433+
}
434+
}
435+
436+
public static boolean deleteDir(File dir) {
437+
if (dir == null) {
438+
return false;
439+
}
440+
if (dir.isDirectory()) {
441+
String[] children = dir.list();
442+
for (String file : children) {
443+
boolean success = deleteDir(new File(dir, file));
444+
if (!success) {
445+
return false;
446+
}
447+
}
448+
}
449+
return dir.delete();
450+
}
451+
452+
/**
453+
* avoid from being searched by google.
454+
* @param base64
455+
* @return
456+
*/
457+
private static String decodeFromBase64(String base64) {
458+
return new String(Base64.decode(base64, 0));
459+
}
460+
411461
/**
412462
* write xposed property file to fake xposedinstaller
413463
* @param propertyFile the property file used by XposedInstaller
@@ -456,20 +506,20 @@ private static String getXposedVersionFromProperty(File propertyFile) {
456506
private static boolean loadModuleConfig(String rootDir, String processName) {
457507

458508
if (lastModuleList != null && TextUtils.equals(lastModuleList.first, processName) && lastModuleList.second != null) {
459-
Log.d(TAG, "lastmodule valid, do not load config repeat");
509+
// Log.d(TAG, "lastmodule valid, do not load config repeat");
460510
return true; // xposed installer has config file, and has already loaded for this process, return.
461511
}
462512

463513
// load modules
464514
final File xposedInstallerDir = new File(rootDir, XPOSED_INSTALL_PACKAGE);
465-
Log.d(TAG, "xposedInstaller Dir:" + xposedInstallerDir);
515+
// Log.d(TAG, "xposedInstaller Dir:" + xposedInstallerDir);
466516
if (!xposedInstallerDir.exists()) {
467-
Log.d(TAG, "XposedInstaller not installed, ignore.");
517+
// Log.d(TAG, "XposedInstaller not installed, ignore.");
468518
return false; // xposed installer not enabled, must load all.
469519
}
470520

471521
final File modiles = new File(xposedInstallerDir, "exposed_conf/modules.list");
472-
Log.d(TAG, "module file:" + modiles);
522+
// Log.d(TAG, "module file:" + modiles);
473523
if (!modiles.exists()) {
474524
Log.d(TAG, "xposed installer's modules not exist, ignore.");
475525
return false; // xposed installer config file not exist, load all.
@@ -491,7 +541,7 @@ private static boolean loadModuleConfig(String rootDir, String processName) {
491541
}
492542

493543
lastModuleList = Pair.create(processName, moduleSet);
494-
Log.d(TAG, "last moduleslist: " + lastModuleList);
544+
// Log.d(TAG, "last moduleslist: " + lastModuleList);
495545
return true;
496546
} catch (IOException e) {
497547
e.printStackTrace();

0 commit comments

Comments
 (0)