Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/R' into R
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/toolkit/coderstory/CorePatchForR.java
  • Loading branch information
coderstory committed Jun 1, 2021
2 parents 81b90a1 + 2dd7880 commit 65b6462
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 286 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Disable signature verification For Android
### Description
```
branch master -> support android 4.4-7.x
Android8.x -> maybe you need find the commit what change version name to 2.1,then compile by you self
branch Q -> support android 9.0-10.0
branch R -> support android 10-11
Android8.x -> maybe you need find the commit what version name is bump to 2.1,then compile by you self
```

## Fetures
Expand Down Expand Up @@ -41,7 +41,6 @@ https://github.com/coderstory/CorePatch/actions

### community
[TG Chat](https://t.me/core_patch_chat)
[QQ Chat](https://qm.qq.com/cgi-bin/qm/qr?k=CWxud1wEJKsp4Zh4W7L8PdMVglTno4EG&jump_from=webapi)


### donate
Expand Down
9 changes: 3 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.coderstory.toolkit"
minSdkVersion 29
targetSdkVersion 30
versionCode 1810
versionName "3.4"
versionCode 1820
versionName "3.5"
}

signingConfigs {
Expand All @@ -27,7 +27,7 @@ android {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles 'proguard-rules.pro'
}
}
compileOptions {
Expand All @@ -37,8 +37,5 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'androidx.preference:preference:1.1.1'
compileOnly 'de.robv.android.xposed:api:82'
}
3 changes: 3 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
-keep class toolkit.coderstory.MainHook

-repackageclasses
-allowaccessmodification
-overloadaggressively
13 changes: 8 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.coderstory.toolkit">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="toolkit.coderstory.SettingsActivity">
android:theme="@style/AppTheme"
tools:ignore="MissingApplicationIcon">
<activity
android:name="toolkit.coderstory.SettingsActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
Expand All @@ -30,4 +33,4 @@

</application>

</manifest>
</manifest>
6 changes: 3 additions & 3 deletions app/src/main/java/toolkit/coderstory/CorePatchForQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
if (prefs.getBoolean("authcreak", true)) {
if ((Integer) param.args[1] != 4 && prefs.getBoolean("authcreak", true)) {
param.setResult(Boolean.TRUE);
}
}
Expand All @@ -107,7 +107,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
if (prefs.getBoolean("authcreak", true)) {
if ((Integer) param.args[1] != 4 && prefs.getBoolean("authcreak", true)) {
param.setResult(Boolean.TRUE);
}
}
Expand All @@ -129,7 +129,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
public void initZygote(StartupParam startupParam) {
if (prefs.getBoolean("enhancedMode", false)) {
hookAllMethods("android.content.pm.PackageParser", null, "getApkSigningVersion", XC_MethodReplacement.returnConstant(1));
hookAllConstructors("android.util.jar.StrictJarVerifier", new XC_MethodHook() {
Expand Down
25 changes: 23 additions & 2 deletions app/src/main/java/toolkit/coderstory/CorePatchForR.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
// Package " + packageName + " signatures do not match previously installed version; ignoring!"
// public boolean checkCapability(String sha256String, @CertCapabilities int flags) {
// public boolean checkCapability(SigningDetails oldDetails, @CertCapabilities int flags)
hookAllMethods("android.content.pm.PackageParser", loadPackageParam.classLoader, "checkCapability", XC_MethodReplacement.returnConstant(true));
hookAllMethods("android.content.pm.PackageParser", loadPackageParam.classLoader, "checkCapability", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
// Or applications will have all privileged permissions
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
if ((Integer) param.args[1] != 4) {
param.setResult(true);
}
}
});

// 当verifyV1Signature抛出转换异常时,替换一个签名作为返回值
Class<?> signingDetails = XposedHelpers.findClass("android.content.pm.PackageParser.SigningDetails", loadPackageParam.classLoader);
Expand Down Expand Up @@ -104,6 +114,17 @@ public void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable
//New package has a different signature
//处理覆盖安装但签名不一致
Class<?> signingDetails = XposedHelpers.findClass("android.content.pm.PackageParser.SigningDetails", loadPackageParam.classLoader);
hookAllMethods(signingDetails, "checkCapability", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
// Or applications will have all privileged permissions
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
if ((Integer) param.args[1] != 4) {
param.setResult(true);
}
}
});
hookAllMethods(signingDetails, "checkCapability", XC_MethodReplacement.returnConstant(true));

// if app is system app, allow to use hidden api, even if app not using a system signature
Expand All @@ -122,7 +143,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
public void initZygote(StartupParam startupParam) {
if (prefs.getBoolean("enhancedMode", false)) {
hookAllMethods("android.content.pm.PackageParser", null, "getApkSigningVersion", XC_MethodReplacement.returnConstant(1));
hookAllConstructors("android.util.jar.StrictJarVerifier", new XC_MethodHook() {
Expand Down
30 changes: 20 additions & 10 deletions app/src/main/java/toolkit/coderstory/SettingsActivity.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
package toolkit.coderstory;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
import android.preference.PreferenceFragment;
import android.view.View;

import com.coderstory.toolkit.R;


public class SettingsActivity extends AppCompatActivity {
public class SettingsActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
checkEdXposed();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
getFragmentManager().beginTransaction()
.add(R.id.fragment_container, new SettingsFragment()).commit();
}
}
Expand All @@ -40,12 +39,23 @@ private void checkEdXposed() {
}
}

public static class SettingsFragment extends PreferenceFragmentCompat {

public static class SettingsFragment extends PreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName("conf");
addPreferencesFromResource(R.xml.prefs);
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
View list = view.findViewById(android.R.id.list);
list.setOnApplyWindowInsetsListener((v, insets) -> {
list.setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getStableInsetBottom());
return insets.consumeSystemWindowInsets();
});
super.onViewCreated(view, savedInstanceState);
}
}
}
170 changes: 0 additions & 170 deletions app/src/main/res/drawable/ic_launcher_background.xml

This file was deleted.

Loading

0 comments on commit 65b6462

Please sign in to comment.