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

check version #43

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
36b0d45
0.3.6
Jan 12, 2018
c3f97e0
[Exposed]: remove hooks for module fragment(has been done in XposedIn…
Jan 13, 2018
1d89fa5
[Exposed]:
Jan 15, 2018
6705832
[Exposed]: remove the dependency of Dexposed.
Jan 15, 2018
4dc3dd2
[Exposed]: Fix the NPE caused by Android N's classloader bug.
Jan 17, 2018
1116d14
[Exposed] Fix: The Xposed class in 'external' package may not found.
Jan 24, 2018
8e05eb3
[Exposed] init for Xposed module.
Jan 25, 2018
4f27d22
[Exposed] tempera solution for wexposed do not show avatar.
Jan 26, 2018
009adff
0.4.0
Jan 26, 2018
60ee5fd
[Exposed]: fix freezing UI of wexposed.
Jan 27, 2018
8946376
0.4.1
Jan 27, 2018
69cfdc9
[Exposed] : collect more log.
Jan 27, 2018
9290976
[Exposed] : collect more log.
Jan 27, 2018
a6ea43e
[Exposed] : do not load any module for XposedInstaller.
Feb 2, 2018
4474641
[Exposed] : fix the notification can not show on some devices.
Feb 2, 2018
d2c74d5
0.4.4
Feb 2, 2018
728fb69
[Exposed] try inject the systemclassloader instead; (do not replace t…
Feb 3, 2018
c828edb
[Exposed]: set the XPOSED_BRIDEGE_VERSION, becuase some plugin use it.
Feb 3, 2018
04835ab
0.4.5
Feb 3, 2018
8a7250f
[Structure] revert inject system classloader.
Feb 7, 2018
3eb5089
[Misc]: Becuase of the epic improvement, remove restricts for wexposed.
Feb 28, 2018
a6d75ff
0.5.0
Feb 28, 2018
19b536a
update dependency version
Mar 12, 2018
939d422
[Fix]: fix crash when use XposedInstaller below 3.1.5.
Mar 13, 2018
7f8a591
[Fix]: disable tinker.
Mar 13, 2018
071d59b
[Fix]: toast when use external xposed installer.
Mar 16, 2018
039bfde
[Fix]: do not hook stickylistview below android o.
Mar 20, 2018
3597465
[Refactor]: do not use dexposed directly.
Mar 24, 2018
f1248a7
[VXP]: disable hotpatch of QQ.
Apr 10, 2018
9696683
[VXP]: There is a bug in VA: /proc/<pid>/cmdline is incorrect, but ca…
Apr 12, 2018
0fb1f6c
ignore wechat push process's hook.
Apr 16, 2018
5258cda
replace the hook of Application.attach with ContextWrapper.attachBase…
Apr 16, 2018
046844b
do not load module for wechat appbrand.
Apr 16, 2018
7ac6f10
[VXP]: yield mode.
Apr 24, 2018
5a3c98a
[VXP]: add system environment for virtualxposed.
Apr 24, 2018
c932102
Merge branch 'master' of github.com:android-hacker/exposed
Apr 25, 2018
c2a245d
Merge branch 'master' of github.com:android-hacker/exposed
Apr 25, 2018
38b7529
0.6.0
May 1, 2018
4e4c93d
improve the compatibility with some Xposed Module.
May 9, 2018
87e1090
replace Application.onCreate with Instrumentation.callApplicationOnCr…
May 9, 2018
5fb7933
replace Application.onCreate with ContextWrapper.attachBaseContext fo…
May 9, 2018
876e016
[Exposed]: fix the call origin exception.
May 14, 2018
cd31c3e
update dependency.
May 14, 2018
89410df
placeholder for X86(not implemented.)
May 14, 2018
f4b2e42
[VXP]: fix bug of MultiEntry in one module.
May 29, 2018
220a9eb
Merge branch 'master' of https://github.com/android-hacker/exposed
May 29, 2018
510f056
0.6.6
May 30, 2018
dfcf21c
1. fix the Application.attach may be hooked multi-times.
Jun 19, 2018
ccebbd0
remove yield mode, preload native so instead.
Jun 26, 2018
bf94a6a
update dependency.
Jun 26, 2018
faa9a2c
fix crash of multi-user in XSharedPreference.
Jun 26, 2018
9821a58
keep api back compatible.
Jun 27, 2018
64d528d
Update README.md
tiann Oct 7, 2018
de72b91
Update README.md
tiann Jan 8, 2019
1972a5a
Suggestion : Improvement of String.equals("xxx")
o0lwj0o Jan 10, 2019
610f735
Merge pull request #41 from o0lwj0o/patch-1
tiann Jan 10, 2019
b9ef3e3
make the fucking cache invalid.
Jun 27, 2018
0e35cbe
bump version
Sep 1, 2018
6f4c7fa
Update version
Aug 18, 2019
b70fed9
Update dependencies
Aug 18, 2019
f06e2ee
Update dependencies
Aug 18, 2019
a593ccd
Update dependencies
tiann Nov 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
# 简介

Exposed 致力于在**非Root**环境下实现Xposed的功能。基本思路是使用沙盒机制运行APP,在沙盒环境下HOOK本进程从而实现HOOK任意APP的功能
exposed 致力于为App提供 Xposed 运行环境。基本思路是劫持APP进程启动的入口,加载 Xposed 插件以及 hook框架 [epic](https://github.com/tiann/epic)

Exposed本质上是一个Xposed与沙盒之间的兼容层,它给Xposed模块提供运行环境,但不强依赖于双开宿主。不过目前的唯一实现基于[VirtualApp](https://github.com/asLody/VirtualApp),同时HOOK模块
使用 [epic](https://github.com/tiann/epic)
exposed本质上是一个 Xposed 与 APP进程 之间的兼容层,它给Xposed模块提供运行环境(如插件加载、hook环境等)。

目前使用最广泛的实现是 VirtualXposed,它使用 [VirtualApp](https://github.com/asLody/VirtualApp) 来运行APP并提供进程入口劫持。但是,exposed 本身并不依赖双开宿主;甚至不需要双开。

另外,基于APP加固的思路,甚至直接修改APK,或者通过magisk注入进程的方式,都可以实现 Xposed。

目前有以下几种实现方式:

- [VirtualXposed](https://github.com/android-hacker/VirtualXposed) :基于双开实现,通过 VirtualApp 运行目标APK,在进程启动入口加载 exposed。优势:免安装,无篡改签名问题。劣势:性能 & 稳定性受限于双开,无法与系统完全交互。
- [太极](https://www.coolapk.com/apk/me.weishu.exp):基于修改APK实现。在 Application 类的入口织入 exposed 入口代码,从而加载 exposed。优势:可以与系统完全交互,性能好。劣势:签名改变,虽有独特技术可以绕过所有检测,但是依然有风险。部分APP调用其他会检测签名,使得所有APP必须被“太极化”,风险极高。
- [太极·Magisk](https://mp.weixin.qq.com/s?__biz=MjM5Njg5ODU2NA==&tempkey=OTkwX0JJa0I4ZW9qcmd5bGlJSXlwQjBJOTZsWGc0TllULXVXdGVicTQxcWRyWE9McnZFQVozRGpNS21OaHEySDNHbFlfMUVudk9wbHo0akE4c29hOTZhNGs5UENXQlFISlFvQjZFSS1CT1dCa1hSZWt4XzFKNV9abEZITTJNOEJkVkotVEdrN2owcmxzeU9WVF9oaVUxdlJwd3pkcHZDWXFPOTFNVEhBeUF%2Bfg%3D%3D&chksm=25983cf012efb5e6ac3fe06bd73883139a89912fa37aee74f3b3baca9e358b2c41a260cee682#rd):通过 Magisk 修改系统文件,在 Zygote 进程启动的时候执行 exposed 入口代码,从而加载 exposed。优势:完全体,不存在上述所有问题。劣势:需要解锁Bootloader和刷机。

# 使用

Exposed 是一个library,是提供给沙盒开发者使用的;如果你需要在非ROOT环境下运行Xposed,请移步项目 [VAExposed](https://github.com/android-hacker/VAExposed)
Exposed 是一个library,是提供给开发者使用的;如果你需要在非ROOT环境下运行Xposed,请移步项目 [VAExposed](https://github.com/android-hacker/VAExposed)

如果需要在沙盒中提供Xposed运行环境,在给启动沙盒进程的时候,执行如下调用即可:
如果需要在APP进程中中提供Xposed运行环境,在进程启动的入口,执行如下调用即可:

```java
ExposedBridge.initOnce(context, applicationInfo, appClassLoader);
```

同时,为了加载沙盒中的Xposed模块,需要在进程启动的时候执行模块加载:
同时,为了加载Xposed模块,需要在进程启动的时候执行模块加载:

```java
ExposedBridge.loadModule(moduleApk, apkOdexDir, moduleLibDir, applicationInfo, appClassLoader);
Expand Down
14 changes: 8 additions & 6 deletions exposed-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 14
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand All @@ -23,13 +23,15 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'me.weishu:epic:0.3.5' // The AOP Framework
compile 'me.weishu.exposed:exposed-xposedapi:0.3.0' // The Xposed API
compile 'me.weishu.exposed:exposed-xposedapi:0.4.5' // The Xposed API
compile ('me.weishu:epic:0.8.0-c') { // The AOP Framework
exclude group: 'me.weishu.exposed', module: 'exposed-xposedapi'
}
compile 'com.getkeepsafe.relinker:relinker:1.2.3' // for load library
}

group = 'me.weishu.exposed'
version = '0.3.5'
version = '0.8.0'

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package de.robv.android.xposed;

import android.util.Log;

import java.lang.reflect.Member;

/**
* Created by weishu on 17/11/30.
*/
public class ExposedHelper {

private static final String TAG = "ExposedHelper";

public static void initSeLinux(String processName) {
SELinuxHelper.initOnce();
SELinuxHelper.initForProcess(processName);
}

public static boolean isIXposedMod(Class<?> moduleClass) {
return IXposedMod.class.isAssignableFrom(moduleClass);
}
Log.d(TAG, "module's classLoader : " + moduleClass.getClassLoader() + ", super: " + moduleClass.getSuperclass());
Log.d(TAG, "IXposedMod's classLoader : " + IXposedMod.class.getClassLoader());

public static void beforeHookedMethod(XC_MethodHook methodHook, XC_MethodHook.MethodHookParam param) throws Throwable {
methodHook.beforeHookedMethod(param);
return IXposedMod.class.isAssignableFrom(moduleClass);
}

public static void afterHookedMethod(XC_MethodHook methodHook, XC_MethodHook.MethodHookParam param) throws Throwable {
methodHook.afterHookedMethod(param);
}

public static XC_MethodHook.Unhook newUnHook(XC_MethodHook methodHook, Member member) {
return methodHook.new Unhook(member);
Expand All @@ -34,4 +34,12 @@ public static void callInitZygote(String modulePath, Object moduleInstance) thro
param.startsSystemServer = false;
((IXposedHookZygoteInit) moduleInstance).initZygote(param);
}

public static void beforeHookedMethod(XC_MethodHook methodHook, XC_MethodHook.MethodHookParam param) throws Throwable{
methodHook.beforeHookedMethod(param);
}

public static void afterHookedMethod(XC_MethodHook methodHook, XC_MethodHook.MethodHookParam param) throws Throwable{
methodHook.afterHookedMethod(param);
}
}
77 changes: 77 additions & 0 deletions exposed-core/src/main/java/me/weishu/exposed/CHAHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package me.weishu.exposed;

import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.util.Log;

import java.lang.reflect.Member;
import java.lang.reflect.Method;

import de.robv.android.xposed.DexposedBridge;
import de.robv.android.xposed.ExposedHelper;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;

/**
* @author weishu
* @date 2018/6/19.
*/
public final class CHAHelper {
private static final String TAG = "CHAHelper";

static class ApplicationHookProxy extends XC_MethodHook {

XC_MethodHook original;

ApplicationHookProxy(XC_MethodHook original) {
this.original = original;
}

@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
if (param.thisObject == null) {
throw new IllegalArgumentException("can not use static method!!");
}

if (param.thisObject instanceof Application) {
ExposedHelper.beforeHookedMethod(this.original, param);
} else {
Log.d(TAG, "ignore non-application of ContextWrapper: " + param.thisObject);
}
}

@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
if (param.thisObject == null) {
throw new IllegalArgumentException("can not use static method!!");
}

if (param.thisObject instanceof Application) {
ExposedHelper.afterHookedMethod(this.original, param);
} else {
Log.d(TAG, "ignore non-application of ContextWrapper: " + param.thisObject);
}
}
}

static XC_MethodHook.Unhook replaceForCHA(Member member, final XC_MethodHook callback) {

if (member.getDeclaringClass() == Application.class && "attach".equals(member.getName())) {
XposedBridge.log("replace Application.attach with ContextWrapper.attachBaseContext for CHA");
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
return DexposedBridge.hookMethod(m, new ApplicationHookProxy(callback));
}

if (member.getDeclaringClass() == Application.class && "onCreate".equals(member.getName())) {
XposedBridge.log("replace Application.onCreate with ContextWrapper.attachBaseContext for CHA");
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
return DexposedBridge.hookMethod(m, new ApplicationHookProxy(callback));
}

return null;
}
}
Loading