summaryrefslogtreecommitdiff
path: root/plugins/python/androperms/panel.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/python/androperms/panel.py')
-rw-r--r--plugins/python/androperms/panel.py125
1 files changed, 0 insertions, 125 deletions
diff --git a/plugins/python/androperms/panel.py b/plugins/python/androperms/panel.py
deleted file mode 100644
index 8f8e925..0000000
--- a/plugins/python/androperms/panel.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-from pychrysalide.format.dex import DexFormat
-from pychrysalide.gui.panels import PanelItem
-
-import gtk
-import os
-
-
-def _build_permissions_panel_content():
- """Build content for permissions panels."""
-
- scrolled_window = gtk.ScrolledWindow()
- scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scrolled_window.show()
-
- tree = gtk.TreeView()
- tree.set_headers_visible(False)
- tree.show()
- scrolled_window.add_with_viewport(tree)
-
- locations = gtk.TreeViewColumn()
- tree.append_column(locations)
-
- cell = gtk.CellRendererPixbuf()
- locations.pack_start(cell, False)
- locations.add_attribute(cell, 'pixbuf', 0)
-
- cell = gtk.CellRendererText()
- locations.pack_start(cell, False)
- locations.add_attribute(cell, 'text', 1)
-
- functions = gtk.TreeViewColumn()
- tree.append_column(functions)
-
- cell = gtk.CellRendererPixbuf()
- functions.pack_start(cell, False)
- functions.add_attribute(cell, 'pixbuf', 2)
-
- cell = gtk.CellRendererText()
- functions.pack_start(cell, True)
- functions.add_attribute(cell, 'text', 3)
-
- store = gtk.TreeStore(gtk.gdk.Pixbuf, str, gtk.gdk.Pixbuf, str, str)
- tree.set_model(store)
-
- return scrolled_window, tree, store
-
-
-class PermsPanel(PanelItem):
- """Display all permissions found in the Manifest."""
-
- def __new__(cls):
- """Create the GLib instance relative this class as soon as possible,
- for the pygobject registering process."""
-
- scrolled_window, tree, store = _build_permissions_panel_content()
-
- self = super(PermsPanel, cls).__new__(cls, 'Permissions', 'Android Permissions', \
- scrolled_window, 'SE')
-
- self._scrolled_window = scrolled_window
- self._tree = tree
- self._store = store
-
- self._perms = {}
-
- return self
-
-
- def __init__(self):
- """Initialize the Python instance of the panel."""
-
- self._tree.connect('row-activated', self._on_row_selection)
-
- self.dock()
- self.register()
-
-
- def memorize_permissions(self, binary, perms):
- """Attach found permissions to a new loaded binary."""
-
- self._perms[binary] = perms
-
-
- def update_for_binary(self, binary):
- """Fill the treeview with all found permissions for the given binary."""
-
- self._store.clear()
-
- fmt = binary.get_format()
- if not isinstance(fmt, DexFormat):
- return False
-
- used = self._perms[binary]
-
- for p in used:
-
- if len(used[p]) > 0 or True:
-
- img = os.path.dirname(os.path.abspath(__file__)) + '/android.png'
- buf = gtk.gdk.pixbuf_new_from_file(img)
-
- it = self._store.append(None, [buf, p, None, None, None])
-
- img = os.path.dirname(os.path.abspath(__file__)) + '/routine.png'
- buf = gtk.gdk.pixbuf_new_from_file(img)
-
- for f in used[p]:
- self._store.append(it, [None, f[0], buf, f[1], f[2]])
-
- self._tree.expand_all()
-
-
- def _on_row_selection(self, treeview, path, column):
- """Scroll the current view to the selected address."""
-
- selection = treeview.get_selection()
- model, it = selection.get_selected()
-
- # On ne traite que les lignes de code
- if model.get_value(it, 0) == None:
-
- self.get_current_view().scroll_to_address(int(model.get_value(it, 4)))