diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-08-03 13:03:26 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-08-03 13:03:26 (GMT) |
commit | b7c83221f2a60be8ee5d44a7599dbe6869af005f (patch) | |
tree | 814e294533920d18f8734baa9aaef47c676e520a /plugins/python/androperms/androperms.py | |
parent | 7d2b7ca95966c2d687526cd75a96d1ea67d3f503 (diff) |
Loaded the permissions used by an APK file.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@255 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/python/androperms/androperms.py')
-rw-r--r-- | plugins/python/androperms/androperms.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/python/androperms/androperms.py b/plugins/python/androperms/androperms.py new file mode 100644 index 0000000..f85d402 --- /dev/null +++ b/plugins/python/androperms/androperms.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from pychrysalide import Plugin +from manifest import AndroidManifest +from xml.dom import minidom + +import zipfile + + +class AndroPerms(Plugin): + """List all permissions given to an APK files.""" + + + def get_action(self): + """Register the plugin for given actions.""" + + return Plugin.PGA_DISASS_PROCESS + + + def execute_on_binary(self, binary, action): + """Process once a binary is disassembled.""" + + zf = zipfile.ZipFile(binary.get_filename()) + + f = zf.open('AndroidManifest.xml', 'r') + data = f.read() + f.closed + + manifest = AndroidManifest(data) + xml = minidom.parseString(manifest.getXML()) + + print + print "Permissions for ", binary.get_filename(), " :" + print "-------------" + print + + for p in xml.getElementsByTagName("uses-permission"): + print p.getAttribute("android:name") + + print |