APK Multi-channel verification tool under Mac

Source: Internet
Author: User
Tags python script

I've previously written an APK multichannel verification tool under the Windows platform based on the JRE environment, see http://blog.csdn.net/h3c4lenovo/article/details/10041047

This scenario is more restrictive, and after modifying the channel provider it is cumbersome to recompile the jar package.

So this time I wrote a multi-channel verification tool based on shell script and Python script, my development environment is Mac, so for Mac, this script does not need to configure the environment separately and need not compile, modify it to meet the needs of everyone.


cannal.sh

count=0rootpath=./toolspath=./tools/currentfoldername=${pwd##*/} #在tools路径下if ["$currentFolderName" = = "Tools"]; Thenrootpath=. /toolspath=./fiapkunzipfolder= "${rootpath}apkunzipfolder" androidmanifesttxt= "${rootpath}androidmanifest.txt" For line in $ (Find ${rootpath}*-prune-iname ' *.apk '); Do     echo "Start check: $line"    unzip-o-q-d $apkUnzipFolder $line    Java-jar ${toolspath}axmlprinter2.jar $ Apkunzipfolder/androidmanifest.xml > $androidManifestTxtpython ${toolspath}xmlparsepy.pylet count= $count + 1doneif [-D $apkUnzipFolder]; Then RM-RF $apkUnzipFolderfiif [-f $ANDROIDMANIFESTTXT]; Then Rm-r $androidManifestTxtfiecho "Done, check ${count} files"

xmlparsepy.py

import os ToolsPath = './' If Os.path.basename (OS.GETCWD ()) = = ' Tools ': ToolsPath = '. /' from xml.dom import minidomxmldoc = Minidom.parse (toolspath+ ' AndroidManifest.txt ') itemlist = Xmldoc.getelementsbytagname (' Meta-data ') for s in itemlist:name = s.attributes[' android:name '].valuevalue = s.attributes[' android:value '].valueif name = = ' Umeng_channel ':p rint value

The main idea is to traverse the current directory, find all the directories under the *.apk end of the file, the unzip decompression, through Axmlprinter2.jar will be confused androidmanifest file decompile.

Use Python to parse XML to find the desired channel name


Resources Download:

http://download.csdn.net/detail/h3c4lenovo/8123251


APK Multi-channel verification tool under Mac

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.