Skip to content

Instantly share code, notes, and snippets.

@davethomas11
Last active February 4, 2018 19:41
Show Gist options
  • Save davethomas11/1204f65345d17d9b3ba90f11be283cf6 to your computer and use it in GitHub Desktop.
Save davethomas11/1204f65345d17d9b3ba90f11be283cf6 to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
text_view.text = loadDexFile("dm.dex").text
textView2.text = loadDexFile("dm2.dex").text
}
fun sourceFile(name: String) = packageManager.getPackageInfo(packageName, 0)
.applicationInfo.dataDir + "/files/" + name
fun copyDexFile(name: String) = FileUtils.copyToFile(assets.open(name), File(sourceFile(name)))
.let { File(sourceFile(name)) }
fun loadDexFile(name: String) = ModuleLoader(cacheDir.absolutePath).load(copyDexFile(name))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment