Enable openat hook
This commit is contained in:
parent
7c7b9d20b6
commit
ecf6c9d5ea
|
|
@ -1,6 +1,7 @@
|
|||
package org.lsposed.lspatch.loader;
|
||||
|
||||
import static android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE;
|
||||
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APK_ASSET_PATH;
|
||||
import static org.lsposed.lspd.service.ConfigFileManager.loadModule;
|
||||
|
||||
import android.app.ActivityThread;
|
||||
|
|
@ -276,20 +277,12 @@ public class LSPApplication extends ApplicationServiceClient {
|
|||
byPassSignature(context);
|
||||
}
|
||||
if (bypassLv >= Constants.SIGBYPASS_LV_PM_OPENAT) {
|
||||
File apk = new File(context.getCacheDir(), "lspatchapk.so");
|
||||
if (!apk.exists()) {
|
||||
try (InputStream inputStream = context.getAssets().open("origin_apk.bin");
|
||||
FileOutputStream buffer = new FileOutputStream(apk)) {
|
||||
|
||||
int nRead;
|
||||
byte[] data = new byte[16384];
|
||||
|
||||
while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
|
||||
buffer.write(data, 0, nRead);
|
||||
String cacheApkPath;
|
||||
var aInfo = context.getApplicationInfo();
|
||||
try (ZipFile sourceFile = new ZipFile(aInfo.sourceDir)) {
|
||||
cacheApkPath = aInfo.dataDir + "/cache/lspatch/origin/" + sourceFile.getEntry(ORIGINAL_APK_ASSET_PATH).getCrc();
|
||||
}
|
||||
}
|
||||
}
|
||||
SigBypass.enableOpenatHook(context.getApplicationInfo().packageName);
|
||||
SigBypass.enableOpenatHook(context.getApplicationInfo().sourceDir, cacheApkPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package org.lsposed.lspatch.appstub;
|
||||
|
||||
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APK_ASSET_PATH;
|
||||
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APP_COMPONENT_FACTORY_ASSET_PATH;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AppComponentFactory;
|
||||
|
|
@ -24,8 +27,6 @@ import dalvik.system.PathClassLoader;
|
|||
public class LSPAppComponentFactoryStub extends AppComponentFactory {
|
||||
private static final String TAG = "LSPatch";
|
||||
private static final String PROXY_APPLICATION = "org.lsposed.lspatch.appstub.LSPApplicationStub";
|
||||
private static final String ORIGINAL_APK_ASSET_PATH = "assets/origin_apk.bin";
|
||||
private static final String ORIGINAL_APP_COMPONENT_FACTORY_ASSET_PATH = "assets/original_app_component_factory.ini";
|
||||
|
||||
private ClassLoader appClassLoader = null;
|
||||
private ClassLoader lspClassLoader = null;
|
||||
|
|
|
|||
2
core
2
core
|
|
@ -1 +1 @@
|
|||
Subproject commit 6b4c519cf1b0d1ada03c9f39e27c3a0971b47f9e
|
||||
Subproject commit 8c96190a8ebfa45bcf08f98b0bb374d35e0c00d6
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
package org.lsposed.patch;
|
||||
|
||||
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APK_ASSET_PATH;
|
||||
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APP_COMPONENT_FACTORY_ASSET_PATH;
|
||||
|
||||
import com.android.tools.build.apkzlib.sign.SigningExtension;
|
||||
import com.android.tools.build.apkzlib.sign.SigningOptions;
|
||||
import com.android.tools.build.apkzlib.zip.AlignmentRules;
|
||||
|
|
@ -84,10 +87,8 @@ public class LSPatch {
|
|||
|
||||
private static final String PROXY_APP_COMPONENT_FACTORY = "org.lsposed.lspatch.appstub.LSPAppComponentFactoryStub";
|
||||
|
||||
private static final String APP_COMPONENT_FACTORY_ASSET_PATH = "assets/original_app_component_factory.ini";
|
||||
private static final String SIGNATURE_INFO_ASSET_PATH = "assets/original_signature_info.ini";
|
||||
private static final String USE_MANAGER_CONTROL_PATH = "assets/use_manager.ini";
|
||||
private static final String ORIGINAL_APK_ASSET_PATH = "assets/origin_apk.bin";
|
||||
private static final String ANDROID_MANIFEST_XML = "AndroidManifest.xml";
|
||||
private static final HashSet<String> ARCHES = new HashSet<>(Arrays.asList(
|
||||
"armeabi-v7a",
|
||||
|
|
@ -229,7 +230,7 @@ public class LSPatch {
|
|||
|
||||
// save original appComponentFactory name to asset file even its empty
|
||||
try (var is = new ByteArrayInputStream(appComponentFactory.getBytes(StandardCharsets.UTF_8))) {
|
||||
dstZFile.add(APP_COMPONENT_FACTORY_ASSET_PATH, is);
|
||||
dstZFile.add(ORIGINAL_APP_COMPONENT_FACTORY_ASSET_PATH, is);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package org.lsposed.lspatch.share;
|
||||
|
||||
public class Constants {
|
||||
final static public String ORIGINAL_APK_ASSET_PATH = "assets/origin_apk.bin";
|
||||
final static public String ORIGINAL_APP_COMPONENT_FACTORY_ASSET_PATH = "assets/original_app_component_factory.ini";
|
||||
|
||||
final static public String MANAGER_PACKAGE_NAME = "org.lsposed.lspatch";
|
||||
final static public String CONFIG_NAME_SIGBYPASSLV = "lspatch_sigbypasslv";
|
||||
final static public int SIGBYPASS_LV_DISABLE = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue