What steps will reproduce the problem?
1. Analyze an proguard-obfuscated APK with AnalyzeAPK()
2. Find a class where there are several methods with the same name "a" (for
example)
2. Rename one of the "a" methods with "set_name()"
3. Rename the class containing this method with "set_name()"
3. Display decompiled sources of the class
What is the expected output? What do you see instead?
Let's have a look a the "d" class decompiled source code.
In [2]: d.CLASS_La_a_a_a_a_a_a_d.source()
package a.a.a.a.a.a.a;
public class d {
public static String a(byte[] p1, String p2)
{
IllegalStateException v4;
if (p1 == null) {
v4 = 0;
} else {
try {
v4 = new String(p1, p2);
} catch (IllegalStateException v5) {
throw a.a.a.a.a.a.a.d.a(p2, v5);
}
}
return v4;
}
private static IllegalStateException a(String p3, java.io.UnsupportedEncodingException p4)
{
return new IllegalStateException(new StringBuilder().append(p3).append(": ").append(p4).toString());
}
public static String a(byte[] p1)
{
return a.a.a.a.a.a.a.d.a(p1, "UTF-8");
}
}
We can see the "d" class has 3 methods named "a" for all of them. Androguard
distinguishes them in python exports using their prototype:
In [6]: d.CLASS_La_a_a_a_a_a_a_d.METH
d.CLASS_La_a_a_a_a_a_a_d.METHOD_a_BLjava_lang_String
d.CLASS_La_a_a_a_a_a_a_d.METHOD_a_BLjava_lang_StringLjava_lang_String
d.CLASS_La_a_a_a_a_a_a_d.METHOD_a_Ljava_lang_StringLjava_io_UnsupportedEncodingE
xceptionLjava_lang_IllegalStateException
We modify the name of one of the method to a more explicit name such as "abcd":
In [6]: d.CLASS_La_a_a_a_a_a_a_d.METHOD_a_BLjava_lang_String.get_name()
Out[6]: 'a'
In [7]: d.CLASS_La_a_a_a_a_a_a_d.METHOD_a_BLjava_lang_String.set_name("abcd")
Then, we modify the name of the class:
In [9]: d.CLASS_La_a_a_a_a_a_a_d.get_name()
Out[9]: 'La/a/a/a/a/a/a/d;'
In [10]: d.CLASS_La_a_a_a_a_a_a_d.set_name('La/a/a/a/a/a/a/myClass;')
When we display the modified source code, we can see all the methods names have
been modified instead of just the one we modified:
In [11]: d.CLASS_La_a_a_a_a_a_a_myClass.source()
package a.a.a.a.a.a.a;
public class myClass {
public static String abcd(byte[] p1, String p2)
{
IllegalStateException v4;
if (p1 == null) {
v4 = 0;
} else {
try {
v4 = new String(p1, p2);
} catch (IllegalStateException v5) {
throw a.a.a.a.a.a.a.myClass.abcd(p2, v5);
}
}
return v4;
}
private static IllegalStateException abcd(String p3, java.io.UnsupportedEncodingException p4)
{
return new IllegalStateException(new StringBuilder().append(p3).append(": ").append(p4).toString());
}
public static String abcd(byte[] p1)
{
return a.a.a.a.a.a.a.myClass.abcd(p1, "UTF-8");
}
}
Instead, we should have got:
In [11]: d.CLASS_La_a_a_a_a_a_a_myClass.source()
package a.a.a.a.a.a.a;
public class myClass {
public static String a(byte[] p1, String p2)
{
IllegalStateException v4;
if (p1 == null) {
v4 = 0;
} else {
try {
v4 = new String(p1, p2);
} catch (IllegalStateException v5) {
throw a.a.a.a.a.a.a.myClass.abcd(p2, v5);
}
}
return v4;
}
private static IllegalStateException a(String p3, java.io.UnsupportedEncodingException p4)
{
return new IllegalStateException(new StringBuilder().append(p3).append(": ").append(p4).toString());
}
public static String abcd(byte[] p1)
{
return a.a.a.a.a.a.a.myClass.a(p1, "UTF-8");
}
}
What version of the product are you using? On what operating system?
Androguard revision 11f0822829ad
Please provide any additional information below.
I do not have a working patch at the moment.
Original issue reported on code.google.com by saidel...@gmail.com on 7 Aug 2014 at 5:05
Original issue reported on code.google.com by
saidel...@gmail.com
on 7 Aug 2014 at 5:05