diff --git a/core/build.gradle b/core/build.gradle index e0c9336..c2a5f2d 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -36,6 +36,7 @@ dependencies { api 'com.github.zhkl0228:unidbg-parent:0.9.7' api 'com.github.zhkl0228:unidbg-api:0.9.7' api 'com.github.zhkl0228:unidbg-android:0.9.7' + implementation 'net.lingala.zip4j:zip4j:2.10.0' implementation 'io.github.qsy7.java.dependencies:slf4j-simple:0.1.0' implementation 'org.ow2.asm:asm-debug-all:5.0.3' compileOnly fileTree(dir:'../libs/',includes:['*jar']) diff --git a/core/src/main/java/jmp0/app/interceptor/unidbg/UnidbgWrapperUtils.kt b/core/src/main/java/jmp0/app/interceptor/unidbg/UnidbgWrapperUtils.kt index 1cb2421..ffe973e 100644 --- a/core/src/main/java/jmp0/app/interceptor/unidbg/UnidbgWrapperUtils.kt +++ b/core/src/main/java/jmp0/app/interceptor/unidbg/UnidbgWrapperUtils.kt @@ -49,7 +49,7 @@ object UnidbgWrapperUtils { } fun toUnidbgObject(vm:VM,obj:Any?,className:String? = null):DvmObject{ - if (obj == null) return DvmObjectWrapper(vm.resolveClass("java/lang/String"),null) + if (obj == null) return DvmObjectWrapper(vm.resolveClass("java/lang/Object"),null) //fixme wrapper fix when(obj){ is String -> return StringObject(vm,obj) diff --git a/core/src/main/java/jmp0/util/ZipUtility.kt b/core/src/main/java/jmp0/util/ZipUtility.kt index 18103da..1060692 100644 --- a/core/src/main/java/jmp0/util/ZipUtility.kt +++ b/core/src/main/java/jmp0/util/ZipUtility.kt @@ -1,13 +1,9 @@ package jmp0.util +import net.lingala.zip4j.ZipFile import java.io.* -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths -import java.util.* import java.util.zip.ZipEntry import java.util.zip.ZipInputStream -import java.util.zip.ZipOutputStream object ZipUtility { private val BUFFER_SIZE = 4096 @@ -61,22 +57,23 @@ object ZipUtility { } bos.close() } - + @SuppressWarnings("unused") fun zip(sourceDirPath: String, zipFilePath: String) { - val p: Path = Files.createFile(Paths.get(zipFilePath)) - ZipOutputStream(Files.newOutputStream(p)).use { zs -> - val pp: Path = Paths.get(sourceDirPath) - Files.walk(pp) - .filter { path -> !Files.isDirectory(path) } - .forEach { path -> - if (path.startsWith("$pp${File.separator}kotlin")) - //exclude kotlin package - return@forEach - val zipEntry = ZipEntry(pp.relativize(path).toString()) - zs.putNextEntry(zipEntry) - zs.write(Files.readAllBytes(path)) - zs.closeEntry() - } - } + ZipFile(zipFilePath).addFolder(File(sourceDirPath)) +// val p: Path = Files.createFile(Paths.get(zipFilePath)) +// ZipOutputStream(Files.newOutputStream(p)).use { zs -> +// val pp: Path = Paths.get(sourceDirPath) +// Files.walk(pp) +// .filter { path -> !Files.isDirectory(path) } +// .forEach { path -> +// if (path.startsWith("$pp${File.separator}kotlin")) +// //exclude kotlin package +// return@forEach +// val zipEntry = ZipEntry(pp.relativize(path).toString()) +// zs.putNextEntry(zipEntry) +// zs.write(Files.readAllBytes(path)) +// zs.closeEntry() +// } +// } } } \ No newline at end of file