androguard cg - Create Call Graph from APK¶
androcg can create files that can be read using graph visualization software, for example gephi.
Synopsis¶
Traceback (most recent call last):
File "/builddir/build/BUILDROOT/androguard-3.3.5-3.fc33.noarch/usr/bin/androguard", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3253, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3236, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3265, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 584, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 787, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'matplotlib' distribution was not found and is required by androguard
Examples¶
The call graph is constructed from the
Analysis
object and then converted into a
networkx DiGraph.
Note that calls between methods are only added once. Thus, if a method calls
some other method multiple times, this is not saved.
The methods to construct the callgraph from can be filtered. It is highly suggested to do that, as call graphs can get very large:

Of course, you can export the call graph with androguard and filter it later.
Here is an example of an already filtered graph, visualized in gephi. Each node has an attribute to indicate if it is an internal (defined somewhere in the DEXs) or external (might be an API, but definetly not defined in the DEXs) method. In this case all green nodes are internal and all red ones are external. You can see the calls of some SMS Trojan to the API methods to write SMS.
