从android apk中的.smali文件中提取所有API调用 [英] Extracting all API calls from .smali files in android apk

查看:803
本文介绍了从android apk中的.smali文件中提取所有API调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Android应用程序的apk中提取所有API调用.我已经使用apktool从apk获取smali代码文件.手动可以发现一些API调用,但是我需要一种自动方法.例如,我可以在以下代码行中看到getNetworkInfo调用:

I want to extract all API calls from an Android application's apk. I have used apktool to get the smali code files from the apk. Manually I can spot some API calls, but I need an automated method. For example, I can see the getNetworkInfo call in this line of code:

    invoke-virtual {p0, v0}, Landroid/net/ConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;

我对smali代码没有经验,对Android应用程序分析也很少.我只发现了上面的API调用,因为我碰巧知道"getNetworkInfo"是一个.但是,当然,我不想做的是从所有可能的API调用列表开始,然后在smali文件中逐个搜索它们.

I have no experience with smali code and very little with Android application analysis; I only spotted the above API call because I happened to know that "getNetworkInfo" is one. But of course, what I don't want to do is begin with a list of all possible API calls and search for each of them in the smali files one by one.

是否还有API调用的指示? invoke-virtualinvoke-direct将始终表示API调用吗?

Is there another indication of an API call? Will invoke-virtual or invoke-direct will always mean an API call?

推荐答案

invoke-virtualinvoke-direct分别调用具有或不具有虚拟方法解析度的某些对象的方法.这不一定必须是API调用;您可以将这些指令用于任何类型的对象,包括您在自己的代码中定义的类的实例.

invoke-virtual and invoke-direct just call a method of some object with and without virtual method resolution, respectively. This doesn't necessarily have to be an API call; you could use these instructions with any kind of object, including instances of classes you define in your own code.

在这种情况下,您在android.net.ConnectivityManager类中找到了对方法的调用.如果要查找更多的API调用,可以先搜索引用某些类的invoke-*指令,例如,其中可能包含android.*java.*javax.*等下的任何内容.

In this case, you found a call to a method in the android.net.ConnectivityManager class. If you want to find more API calls, you could start by searching for invoke-* instructions that reference certain classes, which for example might include anything under android.*, java.*, javax.*, etc.

这篇关于从android apk中的.smali文件中提取所有API调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆