好友
阅读权限10
听众
最后登录1970-1-1
|
第一个页面选中要对其隐藏的应用,然后按+里面的确定
第二个页面选中需要隐藏的应用,然后按+里面的确定
运行效果,全屏蔽了,读取不到
xposed hook的源码
public class HookToast implements IXposedHookLoadPackage, IXposedHookZygoteInit {
private static String str_json;
private static Maphelper maphelper;
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
if (loadPackageParam.packageName.equals("android") || loadPackageParam.packageName.equals("de.robv.android.xposed.installer")) {
return;
}
if (loadPackageParam.packageName.contains(BuildConfig.APPLICATION_ID)) {
findAndHookMethod("com.ppqqjy.apkhide.other", loadPackageParam.classLoader, "isXposedWork", new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return true;
}
});
return;
}
if (maphelper == null) {
maphelper = new Maphelper(1);
}
String Str = "";
if (maphelper != null) {
Str = maphelper.getstring("app");
}
if (Str.length() < 1) {
return;
}
final Map maps = JSONObject.parseObject(Str);
if (!maps.containsKey(loadPackageParam.packageName)) {
return;
}
if (maps.get(loadPackageParam.packageName).toString().contains("true")) {
// Log.d("调试输出:1111111111", loadPackageParam.packageName);
str_json = maphelper.getstring("hide");
if (str_json.length() < 1) {
return;
}
findAndHookMethod("android.app.ApplicationPackageManager", loadPackageParam.classLoader, "getInstalledApplications", int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
List<ApplicationInfo> applicationList = (List) param.getResult();
List<ApplicationInfo> resultapplicationList = new ArrayList<>();
for (ApplicationInfo applicationInfo : applicationList) {
String packageName = applicationInfo.packageName;
if (isTarget_hide(packageName)) {
} else {
resultapplicationList.add(applicationInfo);
}
}
param.setResult(resultapplicationList);
}
});
findAndHookMethod("android.app.ApplicationPackageManager", loadPackageParam.classLoader, "getInstalledPackages", int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
List<PackageInfo> packageInfoList = (List) param.getResult();
List<PackageInfo> resultpackageInfoList = new ArrayList<>();
for (PackageInfo packageInfo : packageInfoList) {
String packageName = packageInfo.packageName;
if (isTarget_hide(packageName)) {
} else {
resultpackageInfoList.add(packageInfo);
}
}
param.setResult(resultpackageInfoList);
}
});
findAndHookMethod("android.app.ApplicationPackageManager", loadPackageParam.classLoader, "getPackageInfo", String.class, int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
List<PackageInfo> packageInfoList = (List) param.getResult();
List<PackageInfo> resultpackageInfoList = new ArrayList<>();
for (PackageInfo packageInfo : packageInfoList) {
String packageName = packageInfo.packageName;
if (isTarget_hide(packageName)) {
} else {
resultpackageInfoList.add(packageInfo);
}
}
param.setResult(resultpackageInfoList);
}
});
findAndHookMethod("android.app.ApplicationPackageManager", loadPackageParam.classLoader, "getApplicationInfo", String.class, int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
String packageName = (String) param.args[0];
String packageName_ = "";
if (isTarget_hide(packageName)) {
}
param.setResult(packageName_);
}
});
findAndHookMethod("android.app.ActivityManager", loadPackageParam.classLoader, "getRunningServices", int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
List<ActivityManager.RunningServiceInfo> serviceInfoList = (List) param.getResult();
List<ActivityManager.RunningServiceInfo> resultList = new ArrayList<>();
for (ActivityManager.RunningServiceInfo runningServiceInfo : serviceInfoList) {
String serviceName = runningServiceInfo.process;
if (isTarget_hide(serviceName)) {
} else {
resultList.add(runningServiceInfo);
}
}
param.setResult(resultList);
}
});
findAndHookMethod("android.app.ActivityManager", loadPackageParam.classLoader, "getRunningTasks", int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
List<ActivityManager.RunningTaskInfo> serviceInfoList = (List) param.getResult();
List<ActivityManager.RunningTaskInfo> resultList = new ArrayList<>();
for (ActivityManager.RunningTaskInfo runningTaskInfo : serviceInfoList) {
String taskName = runningTaskInfo.baseActivity.flattenToString();
if (isTarget_hide(taskName)) {
} else {
resultList.add(runningTaskInfo);
}
}
param.setResult(resultList);
}
});
findAndHookMethod("android.app.ActivityManager", loadPackageParam.classLoader, "getRunningAppProcesses", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfos = (List) param.getResult();
List<ActivityManager.RunningAppProcessInfo> resultList = new ArrayList<>();
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcessInfos) {
String processName = runningAppProcessInfo.processName;
if (isTarget_hide(processName)) {
} else {
resultList.add(runningAppProcessInfo);
}
}
param.setResult(resultList);
}
});
}
}
final private boolean isTarget_hide(String name) {
String Str;
final Map maps = JSONObject.parseObject(str_json);
if (!maps.containsKey(name)) {
if (name.contains(":")) {
Str = getSubString("SubString" + name, "SubString", ":");
} else if (name.contains("/")) {
Str = getSubString("SubString" + name, "SubString", "/");
} else {
Str = name;
}
if (!maps.containsKey(Str)) {
return false;
}
return maps.get(Str).toString().contains("true");
}
return maps.get(name).toString().contains("true");
}
public String getSubString(String text, String left, String right) {
String result = "";
int zLen;
if (left == null || left.isEmpty()) {
zLen = 0;
} else {
zLen = text.indexOf(left);
if (zLen > -1) {
zLen += left.length();
} else {
zLen = 0;
}
}
int yLen = text.indexOf(right, zLen);
if (yLen < 0 || right == null || right.isEmpty()) {
yLen = text.length();
}
result = text.substring(zLen, yLen);
return result;
}
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
return;
}
}
没有任何广告或者连接服务器行为。
链接:https://pan.baidu.com/s/13-39fI_nPKz5VVh7IFV4uw
提取码:rs5m |
免费评分
-
查看全部评分
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|