Commit 9ad23731 authored by Administrator's avatar Administrator

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

parent cdc2191a
...@@ -12,6 +12,7 @@ import com.virjar.ratel.api.rposed.RposedHelpers; ...@@ -12,6 +12,7 @@ import com.virjar.ratel.api.rposed.RposedHelpers;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Enumeration; import java.util.Enumeration;
...@@ -177,8 +178,10 @@ public class UnPackerToolKit { ...@@ -177,8 +178,10 @@ public class UnPackerToolKit {
continue; continue;
} }
zipOutputStream.putNextEntry(zipEntry); zipOutputStream.putNextEntry(new ZipEntry(zipEntry.getName()));
IOUtils.copy(zipFile.getInputStream(zipEntry), zipOutputStream); try (InputStream inputStream = zipFile.getInputStream(zipEntry)) {
IOUtils.copy(inputStream, zipOutputStream);
}
if (zipEntry.getName().startsWith("classes")) { if (zipEntry.getName().startsWith("classes")) {
Matcher matcher = classesIndexPattern.matcher(zipEntry.getName()); Matcher matcher = classesIndexPattern.matcher(zipEntry.getName());
...@@ -192,7 +195,12 @@ public class UnPackerToolKit { ...@@ -192,7 +195,12 @@ public class UnPackerToolKit {
} }
// append dex // append dex
for (byte[] dexData : dumpedDex) { 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); zipOutputStream.write(dexData);
maxIndex++; 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