Commit 9ad23731 authored by Administrator's avatar Administrator

bugfix: 脱壳机可能遇到apk组装失败

parent cdc2191a
......@@ -12,6 +12,7 @@ import com.virjar.ratel.api.rposed.RposedHelpers;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Enumeration;
......@@ -177,8 +178,10 @@ public class UnPackerToolKit {
continue;
}
zipOutputStream.putNextEntry(zipEntry);
IOUtils.copy(zipFile.getInputStream(zipEntry), zipOutputStream);
zipOutputStream.putNextEntry(new ZipEntry(zipEntry.getName()));
try (InputStream inputStream = zipFile.getInputStream(zipEntry)) {
IOUtils.copy(inputStream, zipOutputStream);
}
if (zipEntry.getName().startsWith("classes")) {
Matcher matcher = classesIndexPattern.matcher(zipEntry.getName());
......@@ -192,7 +195,12 @@ public class UnPackerToolKit {
}
// append dex
for (byte[] dexData : dumpedDex) {
zipOutputStream.putNextEntry(new ZipEntry("classes" + maxIndex + ".dex"));
if (dexData == null) {
continue;
}
String classesFileName = "classes" + maxIndex + ".dex";
Log.i(TAG_UNPACK, "append new dex: " + classesFileName);
zipOutputStream.putNextEntry(new ZipEntry(classesFileName));
zipOutputStream.write(dexData);
maxIndex++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment