dex2jar
This commit is contained in:
@@ -15,9 +15,6 @@ compileKotlin.kotlinOptions {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url = uri("http://repository-dex2jar.forge.cloudbees.com/release/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -45,7 +42,7 @@ dependencies {
|
||||
implementation("com.squareup.retrofit2:adapter-rxjava:$retrofit_version")
|
||||
|
||||
|
||||
|
||||
// reactivex
|
||||
implementation("io.reactivex:rxjava:1.3.8")
|
||||
// implementation("io.reactivex:rxandroid:1.2.1")
|
||||
// implementation("com.jakewharton.rxrelay:rxrelay:1.2.0")
|
||||
@@ -64,7 +61,7 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
|
||||
|
||||
// dex2jar
|
||||
implementation("com.googlecode.d2j:dex-reader:2.0")
|
||||
implementation(fileTree("../lib/dex2jar/"))
|
||||
|
||||
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||
|
||||
@@ -8,8 +8,11 @@ import org.xml.sax.InputSource;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
class APKExtractor {
|
||||
// decompressXML -- Parse the 'compressed' binary form of Android XML docs
|
||||
@@ -203,30 +206,29 @@ class APKExtractor {
|
||||
}
|
||||
|
||||
public static String extract_dex_and_read_className(String filePath, String dexPath) throws IOException {
|
||||
InputStream is = null;
|
||||
ZipFile zip = null;
|
||||
|
||||
zip = new ZipFile(filePath);
|
||||
ZipEntry androidManifest = zip.getEntry("AndroidManifest.xml");
|
||||
ZipEntry classesDex = zip.getEntry("classes.dex");
|
||||
is = zip.getInputStream(androidManifest);
|
||||
|
||||
// write dex file
|
||||
InputStream dexStream = zip.getInputStream(classesDex);
|
||||
byte[] dexBuffer = new byte[dexStream.available()];
|
||||
FileOutputStream dexOs = new FileOutputStream(new File(dexPath));
|
||||
dexOs.write(dexBuffer);
|
||||
dexOs.close();
|
||||
|
||||
|
||||
byte[] buf = new byte[10240];
|
||||
int bytesRead = is.read(buf);
|
||||
|
||||
is.close();
|
||||
if (zip != null) {
|
||||
zip.close();
|
||||
try (OutputStream os = Files.newOutputStream(Paths.get(dexPath))) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
while ((len = dexStream.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
// read xml file
|
||||
InputStream is = zip.getInputStream(androidManifest);
|
||||
byte[] buf = new byte[1024000]; // 100 kb
|
||||
is.read(buf);
|
||||
is.close();
|
||||
zip.close();
|
||||
|
||||
String xml = APKExtractor.decompressXML(buf);
|
||||
try {
|
||||
Document xmlDoc = loadXMLFromString(xml);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package ir.armor.tachidesk
|
||||
|
||||
import com.googlecode.d2j.dex.Dex2jar
|
||||
import com.googlecode.d2j.reader.DexFileReader
|
||||
import com.googlecode.dex2jar.tools.Dex2jarCmd
|
||||
|
||||
class Main {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@@ -50,7 +54,12 @@ class Main {
|
||||
|
||||
val apk = "/tmp/tachidesk/tachiyomi-en.killsixbilliondemons-v1.2.3.apk"
|
||||
val dex = "/tmp/tachidesk/tachiyomi-en.killsixbilliondemons-v1.2.3.dex"
|
||||
val jar = "/tmp/tachidesk/tachiyomi-en.killsixbilliondemons-v1.2.3.jar"
|
||||
val pkg = APKExtractor.extract_dex_and_read_className(apk, dex)
|
||||
|
||||
Dex2jarCmd.main(dex, "-o", jar, "--force")
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user