Analyzes the use of the apk tool aapt and Its Principle. apkaapt
Through apktool, we can indeed decompile the serialized AndroidManifest. xml and resource files, but is there a fast and effective tool that can obtain the basic content, permissions, and basic information of an apk without any solution? The answer is: this tool is the aapt to be introduced today.
Aapt Introduction
Aapt is the Android Asset Packaging Tool, which can be found in the platform-tools directory of the SDK. Aapt allows you to view, create, and update ZIP file attachments (zip, jar, and apk ). You can also compile the resource file into a binary file. Although you may not have used the aapt tool directly, the build scripts and IDE plug-ins use this tool to package the apk file to form an Android Application.
Main usage
The following parameter list shows how to use the basic functions of aapt and aapt.
123456 |
Aapt l [ist]: list content in the resource package. Aapt d [ump]: view the specified content in the APK package. Aapt p [ackage]: Package and generate a resource compressed package. Aapt r [emove]: deletes a specified file from the compressed package. Aapt a [dd]: Add a specified file to the package. Aapt v [ersion]: print the aapt version. |
Use aapt
Here I will use an application for testing the sample. The application is the application marketplace.List all files in the apk
1 |
walfred@ubuntu:~/lab$ aapt l yingyonghui.apk |
Of course, this apk has too much content, and a piece of paper cannot display all the content. You can redirect it to a specialized file, which is convenient to view.
1 |
walfred@ubuntu:~/lab$ aapt l yingyonghui.apk > yingyonghui.txt |
View basic apk InformationThe most practical function of aapt can be used to view the basic information and permissions of the apk through the d (ump) parameter. However, this parameter also has a value. The optional value is as follows: the syntax of the d parameter is as follows:
12345678 |
aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]values:badging Print the label and icon for the app declared in APK.permissions Print the permissions from the APK.resources Print the resource table from the APK.configurations Print the configurations in the APK.xmltree Print the compiled xmls in the given assets.xmlstrings Print the strings of the given compiled xml assets. |
View Basic Information
1 |
walfred@ubuntu:~/lab$ aapt d badging yingyonghui.apk |
View application Permissions
1 |
walfred@ubuntu:~/lab$ aapt d permissions yingyonghui.apk |
Conclusion
How is it? aapt is a small tool. When we judge whether an apk has malicious behaviors, we can consider using the aapt tool in the first step, we can analyze the permission list of this apk. Once some permissions are too large, such as sending text messages and reading contact information, we can further analyze this apk.
Finally, we recommend that you use an apk security analysis instance for a bank.