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