blob: f85d402b5eac51738313a9da2b1426657434d9ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
|