使用Androguard生成android apk文件的call graph(报错:'DiGraph' object has no attribute 'node'的解决方法-2019年11月)

由于研究需要,今天又尝试了一下用Androguard生成APK文件的Call Graph,发现还是有点坑,这里记录一下。

和之前很多朋友写的记录相比,目前的坑已经算是很简单了,不过还是难免有坑啊!

按照这里的介绍:

https://androguard.readthedocs.io/en/latest/intro/installation.html

可以通过pip和apt install(ubuntu)进行安装,我想偷懒,就尝试了一下这两种方法,但是在生成call graph的时候,命令行参数在这里:https://androguard.readthedocs.io/en/latest/tools/androcg.html

发现都会报:

AttributeError: 'DiGraph' object has no attribute 'node'

的error,这也真是太奇怪了,可以看到这是NetworkX报的错,因为Digraph中并没有名为node的属性呀:https://networkx.github.io/documentation/networkx-2.4/reference/classes/digraph.html

不过仔细看了看其GitHub上的源码,发现并没有报错的这句代码:

if method not in G.node:

已经改成了这句:

https://github.com/androguard/androguard/blob/6d9f09b15ada11c29777ff9466826eb3813c3209/androguard/core/analysis/analysis.py#L1736

这个嘛,还是作者版本控制和回归测试没有做好啊,于是老实按照下载源码的方式使用,果然就不报错了。估计还会有很多朋友和我遇到同样的问题,所以这里简单记录一下。

你可能感兴趣的:(Python技巧)