Batch decompile apk file with Apktool

Source: Internet
Author: User

write it in front.

This is a very simple script, very simple. Why write, because I am to cheat the score.


Application Scenarios

There are a bunch of apk files on the host, sorted by category, now decompile them with Apktool, then store them by category and apk name.


Implement

To use this script, you need to install the Apktool. The comments are very detailed and hope to be useful. Of course, this is implemented in Python, you can also write a shell script.

#!/usr/bin/env python# coding=utf-8 "@author: Chicho@date:2015-01-01@function:use apktool to decompile apk fil Es @rununing: Python python decompileapk.py "import os# apk storage path Apkpath ="/home/chicho/test/apps/"# because the APK storage is categorized by category , so get to each apk storage category Dirlist = Os.listdir (apkpath) # Save path after the APK is deserialized with Apktool outputpath= "/home/chicho/test/apktool_out/" #    After you decompile the APK or store them in the original category for I in range (len (dirlist)): # Get each sub-category under the apk folder FileList = Apkpath + dirlist[i] # Get the path for each category Apklist = Os.listdir (filelist) # Gets the APK list under each path Category_output = OutputPath + dirlist[i] # Output Path list if not O S.path.exists (category_output): #如果输出的路径不存在那么就创建一个路径 os.makedirs (category_output) for APK in Apklist:por Tion=os.path.splitext (APK) #将apk文件按照它们的文件名和后缀做一个分割 apkoutpath=os.path.join (category_output,portion[0]) #portion storage stored is the filename of the APK apk=os.path.join (apkpath+dirlist[i],apk) #if not os.path.exists (apkoutpath): # os.makedirs (Apko Utpath) cmd = "Apktool D {0} {1} '. Format (APK, Apkoutpath) # After you decompile the APK, follow the file name in the store os.system (cmd) print "All work done! Happy New year~ "





















Batch decompile apk file with Apktool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.