HwaAnnaLee / androguard

Automatically exported from code.google.com/p/androguard
Apache License 2.0
0 stars 0 forks source link

name 'AAnalyzeAPK' is not defined #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
NameError                                 Traceback (most recent call last)
/root/androguard/androlyze.py in <module>()
----> 1 a,d,dx=AAnalyzeAPK("/root/aaa.apk",decompiler="ded")

NameError: name 'AAnalyzeAPK' is not defined
Why?

Original issue reported on code.google.com by huangxia...@gmail.com on 7 Aug 2012 at 9:34

GoogleCodeExporter commented 9 years ago
androguard1.5

Original comment by huangxia...@gmail.com on 7 Aug 2012 at 9:34

GoogleCodeExporter commented 9 years ago
is a,d,dx=AnalyzeAPK("/root/aaa.apk",decompiler="dad")

Original comment by huangxia...@gmail.com on 7 Aug 2012 at 9:39

GoogleCodeExporter commented 9 years ago
Yes, few changes for the new version

http://doc.androguard.re/html/androlyze.html

Original comment by anthony....@gmail.com on 7 Aug 2012 at 9:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
but why this happened?

In [24]: a,d,dx=AnalyzeAPK("/root/aaa.apk",decompiler="dad")
In [25]: 
d.CLASS_Lcom/wTdtandroid/MainNavigationActivity.METHOD_onCreate.source()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/root/androguard/androlyze.py in <module>()
----> 1 d.CLASS_Lcom/wTdtandroid/MainNavigationActivity.METHOD_onCreate.source()

AttributeError: 'DalvikVMFormat' object has no attribute 'CLASS_Lcom'

Original comment by huangxia...@gmail.com on 7 Aug 2012 at 9:44

GoogleCodeExporter commented 9 years ago
use the tabulation to have automatically the completion. Because you are using 
a bad path to the object, use the tab !

Original comment by anthony....@gmail.com on 7 Aug 2012 at 9:46

GoogleCodeExporter commented 9 years ago
I'm sorry. there is a fault. 
d.CLASS_Lcom/wTdtandroid/MainNavigationActivity.METHOD_onCreate.source()
should be 
d.CLASS_Lcom_wTdtandroid_MainNavigationActivity.METHOD_onCreate.source()

Original comment by huangxia...@gmail.com on 7 Aug 2012 at 9:55

GoogleCodeExporter commented 9 years ago
uhm, is it possible to have the sample ?

Original comment by anthony....@gmail.com on 7 Aug 2012 at 10:19

GoogleCodeExporter commented 9 years ago
But there is another problem.

/root/androguard/androlyze.py in <module>()
----> 1 d.CLASS_Lcom_anksoft_Alarmreceiver.METHOD_onReceive.source()

/root/androguard/androguard/core/bytecodes/dvm.pyc in source(self)
   2787             :rtype: string
   2788         """
-> 2789         self.CM.decompiler_ob.display_source( self )
   2790 
   2791     def get_length(self) :

AttributeError: 'NoneType' object has no attribute 'display_source'

Original comment by huangxia...@gmail.com on 8 Aug 2012 at 8:33

GoogleCodeExporter commented 9 years ago
have you use AndrolyzeAPK with decompiler option ?

Original comment by anthony....@gmail.com on 8 Aug 2012 at 8:36

GoogleCodeExporter commented 9 years ago
This problem has solved. But there is another problem, if i input "ded", an 
error occured:

In [2]: a,d,dx=AnalyzeAPK("/tmp/abc.apk",decompiler="ded")
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
/root/androguard/androlyze.py in <module>()
----> 1 a,d,dx=AnalyzeAPK("/tmp/abc.apk",decompiler="ded")

/root/androguard/androlyze.py in AnalyzeAPK(filename, raw, decompiler)
    111     """
    112     androconf.debug("APK ...")
--> 113     a = APK(filename, raw)
    114 
    115     d, dx = AnalyzeDex( a.get_dex(), raw=True, decompiler=decompiler )

/root/androguard/androguard/core/bytecodes/apk.pyc in __init__(self, filename, 
raw, mode, magic_file)
    159             self.__raw = filename
    160         else :
--> 161             fd = open( filename, "rb" )
    162             self.__raw = fd.read()
    163             fd.close()

IOError: [Errno 2] No such file or directory: '/tmp/abc.apk'

But it is OK if I input "dad".

Original comment by huangxia...@gmail.com on 8 Aug 2012 at 9:52

GoogleCodeExporter commented 9 years ago
Yes of course, DAD is in Androguard. But for DED, you must install it as shown 
in http://code.google.com/p/androguard/wiki/Decompiler

Original comment by anthony....@gmail.com on 8 Aug 2012 at 9:55