summaryrefslogtreecommitdiff
path: root/plugins/python/androperms/panel.py
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-09-15 08:19:09 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-09-15 08:19:09 (GMT)
commit944fc0a5638bfe77fc65e514fbdd945d8a652635 (patch)
treecaad1d6c5f001dd02380aa2fae0c6dc8d67d9b60 /plugins/python/androperms/panel.py
parent09d07908465d462101d27ecb1b60df52d63bbe5d (diff)
Shown all Android permissions with links to the code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@262 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/python/androperms/panel.py')
-rw-r--r--plugins/python/androperms/panel.py78
1 files changed, 33 insertions, 45 deletions
diff --git a/plugins/python/androperms/panel.py b/plugins/python/androperms/panel.py
index b852049..ca7bb90 100644
--- a/plugins/python/androperms/panel.py
+++ b/plugins/python/androperms/panel.py
@@ -1,5 +1,6 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
-import gtk
import os
@@ -8,50 +9,12 @@ class PermsPanel:
def __init__(self):
-
- tree = gtk.TreeView()
-
- languages = gtk.TreeViewColumn()
- languages.set_title("Programming languages")
-
- cell = gtk.CellRendererText()
- languages.pack_start(cell, True)
- languages.add_attribute(cell, "text", 0)
-
- treestore = gtk.TreeStore(str)
-
- it = treestore.append(None, ["Scripting languages"])
- treestore.append(it, ["Python"])
- treestore.append(it, ["PHP"])
- treestore.append(it, ["Perl"])
- treestore.append(it, ["Ruby"])
-
- it = treestore.append(None, ["Compiling languages"])
- treestore.append(it, ["C#"])
- treestore.append(it, ["C++"])
- treestore.append(it, ["C"])
- treestore.append(it, ["Java"])
-
- tree.append_column(languages)
- tree.set_model(treestore)
-
- tree.show()
-
- self._view = tree
-
self._perms = { }
+ self._used = { }
self._load_all_definitions()
- def get_widget(self):
-
- return self._view
-
-
-
-
-
def _load_all_definitions(self):
"""Load the database in memory."""
@@ -69,7 +32,10 @@ class PermsPanel:
if p not in self._perms:
self._perms[p] = []
- self._perms[p].append(perm[0])
+ call = perm[0].split("(")[0]
+
+ if call not in self._perms[p]:
+ self._perms[p].append(call)
def filter_permissions(self, used):
@@ -83,7 +49,29 @@ class PermsPanel:
self._perms = keep
- # for p in self._perms:
- # print p
- # for v in self._perms[p]:
- # print " - ", v
+ for p in keep:
+ self._used[p] = []
+
+
+ def check_call(self, addr, line):
+ """Check if a call requires some rights."""
+
+ for p in self._perms:
+
+ for c in self._perms[p]:
+
+ if line.find(c) > -1:
+ self._used[p].append([addr, c + "()"])
+
+
+ def fill_tree(self, store):
+ """Fill a treeview with all found permissions."""
+
+ for p in self._used:
+
+ if len(self._used[p]) > 0:
+
+ it = store.append(None, [p, None])
+
+ for f in self._used[p]:
+ store.append(it, ["0x%08x" % f[0], f[1]])