Open packmad opened 5 years ago
Hello @packmad
You are right, in the current version we don't distinguish external classes from internal ones. One way to workaround this issue is to check if at least one of the method of the class has a code size > 0
(and the class is not abstract)
It looks like this code is doing what I wanted (I'm also intrested in abs classes):
def get_internal_classes(dex) -> Set[str]:
ret = set()
for c in dex.classes:
for m in c.methods:
if len(m.bytecode) > 0:
ret.add(c.fullname)
break
return ret
Describe the bug The field
classes
of the classlief.DEX.File
returned bylief.DEX.parse
contains classes that are not defined in the DEX file, but also classes that are used in parameters, fields, etc.To Reproduce Steps to reproduce the behavior: analyzing the attached file bug.zip with the following code:
For example, this code prints the class
Landroid/service/autofill/SaveRequest;
. But the aforementioned class is not defined in the dex file (confirmed by dexdump and radare).Expected behavior There's the need to distinguish between classes defined in the DEX file and classes without implementation.
Environment: