I'm using baksmali and dexlib2 library in Android Studio project. I'm trying to find a method from dex file. Inside method definition, there is a unique string in one of the method body statements. I want to find that method in the fastest possible way.
As example:
public boolean A01() {
..........
return tvar.quals("unique_string") ? false : true;
}
I want to find this method using this "unique_string"
.
Currently I'm using DexBackedDexFile.getClasses()
to get all classes from the dex file and decoding all of them into smali code. Then searching the string inside the generated smali code. I'm able to find my desired method this way, but decoding thousands of class is time consuming. So I'm thinking if there is a quick way to do that.
There is a way to quickly get a string reference from dex file using DexBackedDexFile.getStringReferences()
, which returns a DexBackedStringReference
object. I can find my desired string reference quickly this way, which contains a stringIndex
. I'm wondering if there is a way to find the method using this index number.
Thanks