mitchfay / androguard

Automatically exported from code.google.com/p/androguard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug in Androguard.get_class(self, class_name)

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. run this python script with an apk which should contain at least one class

from androguard.core.androgen import Androguard
a = Androguard(["/path/to/an/apk/file.apk"])
_class = a.get_bc()[0][1].get_classes()[0] 
print _class
print a.get_class(_class.get_name())


What is the expected output? What do you see instead?
should print something like:
<androguard.core.bytecodes.dvm.ClassDefItem instance at 0x7ff075ca6440>
<androguard.core.bytecodes.dvm.ClassDefItem instance at 0x7ff075ca6440>

but prints:
<androguard.core.bytecodes.dvm.ClassDefItem instance at 0x7ff075ca6440>
None


What version of the product are you using? On what operating system?
androguard 1.9
pyhton 2.7
Linux Mint 4.9.0


Please provide any additional information below.
The error seems to be in 
androguard.core.androgen.py->Androguard.get_class(self, class_name) in the if 
expression. bc.get_class(class_name) returns an object or None, but it is 
checked for True. Removing the "== True" solves the problem for me.

Original issue reported on code.google.com by klaus.tu...@gmail.com on 28 Jun 2015 at 7:49