parent
f4b2513182
commit
799bc1d022
|
|
@ -73,6 +73,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: 1.12.1
|
version: 1.12.1
|
||||||
|
|
||||||
|
- name: 設定 CMake
|
||||||
|
uses: jwlawson/actions-setup-cmake@v2
|
||||||
|
with:
|
||||||
|
cmake-version: '4.0.3'
|
||||||
|
|
||||||
- name: 移除 Android 的 cmake
|
- name: 移除 Android 的 cmake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: rm -rf "$ANDROID_HOME/cmake"
|
run: rm -rf "$ANDROID_HOME/cmake"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,6 @@ afterEvaluate {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
|
||||||
implementation("com.squareup.retrofit2:converter-moshi:2.9.0")
|
|
||||||
implementation("com.squareup.moshi:moshi-kotlin:1.15.0")
|
|
||||||
|
|
||||||
implementation(projects.patch)
|
implementation(projects.patch)
|
||||||
implementation(projects.services.daemonService)
|
implementation(projects.services.daemonService)
|
||||||
implementation(projects.share.android)
|
implementation(projects.share.android)
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,11 @@
|
||||||
private static ** getDebugMetadataAnnotation(...) return null;
|
private static ** getDebugMetadataAnnotation(...) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-keep class com.beust.jcommander.** { *; }
|
||||||
-keep class org.lsposed.npatch.database.** { *; }
|
-keep class org.lsposed.npatch.database.** { *; }
|
||||||
-keep class org.lsposed.npatch.Patcher$Options { *; }
|
-keep class org.lsposed.npatch.Patcher$Options { *; }
|
||||||
-keep class org.lsposed.npatch.share.LSPConfig { *; }
|
-keep class org.lsposed.npatch.share.LSPConfig { *; }
|
||||||
-keep class org.lsposed.npatch.share.PatchConfig { *; }
|
-keep class org.lsposed.npatch.share.PatchConfig { *; }
|
||||||
-keepclassmembers class org.lsposed.patch.NPatch { private <fields>;}
|
|
||||||
-keep class com.beust.jcommander.** { *; }-keepattributes Signature
|
|
||||||
-keepattributes *Annotation*
|
|
||||||
-keepattributes RuntimeVisibleAnnotations
|
|
||||||
-keepattributes RuntimeVisibleParameterAnnotations
|
|
||||||
-keep class com.squareup.moshi.** { *; }
|
|
||||||
-keep interface com.squareup.moshi.** { *; }
|
|
||||||
-keep class retrofit2.** { *; }
|
|
||||||
|
|
||||||
-dontwarn com.google.auto.value.AutoValue$Builder
|
-dontwarn com.google.auto.value.AutoValue$Builder
|
||||||
-dontwarn com.google.auto.value.AutoValue
|
-dontwarn com.google.auto.value.AutoValue
|
||||||
-dontwarn com.squareup.moshi.**
|
-dontwarn com.squareup.moshi.**
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package org.lsposed.npatch
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Process
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
@ -22,8 +24,27 @@ class LSPApplication : Application() {
|
||||||
var targetApkFiles: ArrayList<File>? = null
|
var targetApkFiles: ArrayList<File>? = null
|
||||||
val globalScope = CoroutineScope(Dispatchers.Default)
|
val globalScope = CoroutineScope(Dispatchers.Default)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
init {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("verify")
|
||||||
|
} catch (e: UnsatisfiedLinkError) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
||||||
|
verifySignature()
|
||||||
|
try {
|
||||||
|
nativeVerify()
|
||||||
|
} catch (e: UnsatisfiedLinkError) {
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
HiddenApiBypass.addHiddenApiExemptions("")
|
HiddenApiBypass.addHiddenApiExemptions("")
|
||||||
lspApp = this
|
lspApp = this
|
||||||
filesDir.mkdir()
|
filesDir.mkdir()
|
||||||
|
|
@ -33,4 +54,25 @@ class LSPApplication : Application() {
|
||||||
AppBroadcastReceiver.register(this)
|
AppBroadcastReceiver.register(this)
|
||||||
globalScope.launch { NPackageManager.fetchAppList() }
|
globalScope.launch { NPackageManager.fetchAppList() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun verifySignature() {
|
||||||
|
try {
|
||||||
|
val flags = PackageManager.GET_SIGNING_CERTIFICATES
|
||||||
|
val packageInfo = packageManager.getPackageInfo(packageName, flags)
|
||||||
|
val signingInfo = packageInfo.signingInfo
|
||||||
|
val signatures = signingInfo?.apkContentsSigners
|
||||||
|
|
||||||
|
if (signatures != null && signatures.isNotEmpty()) {
|
||||||
|
val currentHash = signatures[0].hashCode()
|
||||||
|
val targetHash = 0x0293FA43
|
||||||
|
if (currentHash != targetHash) {
|
||||||
|
killApp()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
killApp()
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
killApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue