Skip to content

Commit

Permalink
新增检查xp框架方法
Browse files Browse the repository at this point in the history
  • Loading branch information
lahm committed May 25, 2018
1 parent 3541499 commit 87f9c90
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ android {
lintOptions{
abortOnError false
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}

dependencies {
Expand Down
20 changes: 13 additions & 7 deletions app/src/main/java/com/lahm/easyprotector/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ protected void onCreate(Bundle savedInstanceState) {
traced.setText(EasyProtectorLib.checkIsBeingTracedByJava() ? "being traced" : "safe");

final Button loadSO = findViewById(R.id.loadSO);
loadSO.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EasyProtectorLib.checkIsBeingTracedByC();
loadSO.setText("log中查看traceId");
loadSO.setClickable(false);
}
loadSO.setOnClickListener(v -> {
EasyProtectorLib.checkIsBeingTracedByC();
loadSO.setText("log中查看traceId");
loadSO.setClickable(false);
});

Button test = findViewById(R.id.test);
test.setOnClickListener(v -> gg());
}

private void gg() {

}


}
11 changes: 9 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@

<Button
android:id="@+id/loadSO"
android:text="click me load so"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:text="click me load so" />

<Button
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="click me" />

</LinearLayout>
13 changes: 12 additions & 1 deletion library/src/main/java/com/lahm/library/SecurityCheckUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,19 @@ public boolean isXposedExists() {
return true;
}

public boolean isEposedExistByThrow() {
try {
throw new Exception("gg");
} catch (Exception e) {
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
if (stackTraceElement.getClassName().contains(XPOSED_BRIDGE)) return true;
}
return false;
}
}

public boolean tryShutdownXposed() {
if (isXposedExists()) {
if (isEposedExistByThrow()) {
Field xpdisabledHooks = null;
try {
xpdisabledHooks = ClassLoader.getSystemClassLoader()
Expand Down

0 comments on commit 87f9c90

Please sign in to comment.