使用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

這個嘛,還是作者版本控制和迴歸測試沒有做好啊,於是老實按照下載源碼的方式使用,果然就不報錯了。估計還會有很多朋友和我遇到同樣的問題,所以這裏簡單記錄一下。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章