From 5cd6ca82c4761187793f5852261c098f4cdbfcfc Mon Sep 17 00:00:00 2001 From: vadym Date: Fri, 7 Aug 2020 00:31:46 -0700 Subject: [PATCH] 1. dex loader lib fix --- app/build.gradle | 1 - .../chronosx88/yggdrasil/MainActivity.kt | 18 +++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 80c0a92..8890da4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,7 +67,6 @@ dependencies { implementation 'com.google.android.material:material:1.3.0-alpha02' implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.hbb20:ccp:2.4.0' - implementation 'app.artyomd.injector:injector-android:0.5.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt index 702e1c5..817f032 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt @@ -11,7 +11,6 @@ import android.view.View import android.widget.* import androidx.appcompat.app.AppCompatActivity import androidx.preference.PreferenceManager -import app.artyomd.injector.DexUtils import dalvik.system.DexFile import io.github.chronosx88.yggdrasil.models.DNSInfo import io.github.chronosx88.yggdrasil.models.PeerInfo @@ -24,7 +23,6 @@ import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.deserializeS import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.deserializeStringSet2PeerInfoSet import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.serializeDNSInfoSet2StringList import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.serializePeerInfoSet2StringList -import java.io.File import java.lang.reflect.Method import kotlin.concurrent.thread @@ -142,7 +140,11 @@ class MainActivity : AppCompatActivity() { ipLayout.visibility = View.VISIBLE findViewById(R.id.ip).text = address } - val c: Class<*> = dummy.Dummy::class.java + + val sourceDir: String = this.applicationInfo.sourceDir + val dexFile = DexFile(sourceDir) + val cl = classLoader + val c: Class<*> = dexFile.loadClass("dummy/Dummy", cl) val methods: Array = c.declaredMethods showToast("Getting dummy.Dummy class methods list") if(methods.isEmpty()){ @@ -152,16 +154,6 @@ class MainActivity : AppCompatActivity() { showToast("The method is: " + m.toString()) } } - val sourceDir = listOf(File(this.applicationInfo.sourceDir)) - DexUtils.loadDex(this, sourceDir) - showToast("Getting dummy.Dummy class methods list") - if(methods.isEmpty()){ - showToast("No class methods found in dummy.Dummy") - } else { - for (m in methods) { - showToast("The method is: " + m.toString()) - } - } } private fun stopVpn(){