-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCleanSplit.java
More file actions
45 lines (42 loc) · 1.81 KB
/
Copy pathCleanSplit.java
File metadata and controls
45 lines (42 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.*;
import java.util.zip.*;
import java.util.*;
public class CleanSplit {
public static void main(String[] args) throws Exception {
File src = new File("D:/Ideas/Antigravity/Notes/apks_extracted/split_config.arm64_v8a.apk");
File dest = new File("D:/Ideas/Antigravity/Notes/no_talsec_split/split_config.arm64_v8a.apk");
dest.getParentFile().mkdirs();
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(src));
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(dest))) {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String name = entry.getName();
// KILL TALSEC NATIVE LIBS
if (name.contains("libtmlib.so") || name.contains("libsecurity.so")) {
zis.closeEntry();
continue;
}
byte[] data = readAll(zis);
ZipEntry newEntry = new ZipEntry(name);
if (entry.getMethod() == ZipEntry.STORED) {
newEntry.setMethod(ZipEntry.STORED);
newEntry.setSize(data.length);
CRC32 crc = new CRC32();
crc.update(data);
newEntry.setCrc(crc.getValue());
}
zos.putNextEntry(newEntry);
zos.write(data);
zos.closeEntry();
}
}
System.out.println("Talsec Native Libs Nuked.");
}
private static byte[] readAll(InputStream is) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int len;
while ((len = is.read(buf)) > 0) bos.write(buf, 0, len);
return bos.toByteArray();
}
}