diff options
Diffstat (limited to 'plugins/python')
| -rw-r--r-- | plugins/python/androperms/androperms.py | 18 | ||||
| -rw-r--r-- | plugins/python/androperms/db.py | 24 | ||||
| -rw-r--r-- | plugins/python/androperms/panel.py | 8 | 
3 files changed, 28 insertions, 22 deletions
| diff --git a/plugins/python/androperms/androperms.py b/plugins/python/androperms/androperms.py index 18443fc..ddccb8a 100644 --- a/plugins/python/androperms/androperms.py +++ b/plugins/python/androperms/androperms.py @@ -56,8 +56,9 @@ class AndroPerms(Plugin):          db = PermsDataBase()          db.filter_permissions(plist) +        fmt = binary.get_format()          instrs = binary.get_instructions() -        buffer = binary.disassembled_buffer +        buf = binary.disassembled_buffer          pfn = re.compile('<.* ([^ ]*)\(') @@ -65,15 +66,20 @@ class AndroPerms(Plugin):              if i.keyword.startswith("invoke"): -                line = buffer.find_line_by_addr(i.address) +                line = buf.find_line_by_addr(i.address)                  text = line.get_text() -                #print "check %s" % text -                  name = pfn.search(text)                  if name != None: -                    #print " --> ", name.group(1) -                    db.check_call(i.address, name.group(1)) + +                    resolved = fmt.resolve_relative_routine(i.address) + +                    if resolved == None: +                        reladdr = "0x%08x" % i.address +                    else: +                        reladdr = "<%s()+0x%x>" % (resolved[0], resolved[1]) + +                    db.check_call(i.address, name.group(1), reladdr)          self._panel.memorize_permissions(binary, db.get_used_permissions()) diff --git a/plugins/python/androperms/db.py b/plugins/python/androperms/db.py index 625d400..7014915 100644 --- a/plugins/python/androperms/db.py +++ b/plugins/python/androperms/db.py @@ -53,7 +53,7 @@ class PermsDataBase:              self._used[p] = [] -    def check_call(self, addr, line): +    def check_call(self, addr, line, reladdr):          """Check if a call requires some rights."""          found = False @@ -69,23 +69,23 @@ class PermsDataBase:                  #if line.find(c) > -1:                  if c.find(line) > -1: -                    self._used[p].append([addr, c + "()"]) -                    #found = True +                    self._used[p].append([reladdr, c + "()", addr]) +                    found = True -        if not found: +        # if not found: -            func = line.split('.')[-1] +        #     func = line.split('.')[-1] -            for p in self._perms: +        #     for p in self._perms: -                for c in self._perms[p]: +        #         for c in self._perms[p]: -                    if line.find("Wall") > -1: -                        print " <> ", c, " vs ", func +        #             if c.find(func) > -1: -                    if c.find(func) > -1: -                        self._used[p].append([addr, line + "()"]) -                        break +        #                 #print ">>> %s found in %s" % (func, c) + +        #                 self._used[p].append([reladdr, line + "()", addr]) +        #                 break      def get_used_permissions(self): diff --git a/plugins/python/androperms/panel.py b/plugins/python/androperms/panel.py index bebeed5..b892339 100644 --- a/plugins/python/androperms/panel.py +++ b/plugins/python/androperms/panel.py @@ -41,7 +41,7 @@ def _build_permissions_panel_content():      functions.pack_start(cell, True)      functions.add_attribute(cell, 'text', 3) -    store = gtk.TreeStore(gtk.gdk.Pixbuf, str, gtk.gdk.Pixbuf, str) +    store = gtk.TreeStore(gtk.gdk.Pixbuf, str, gtk.gdk.Pixbuf, str, str)      tree.set_model(store)      return scrolled_window, tree, store @@ -97,13 +97,13 @@ class PermsPanel(PanelItem):                  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]) +                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, "0x%08x" % f[0], buf, f[1]]) +                    self._store.append(it, [None, f[0], buf, f[1], f[2]])          self._tree.expand_all() @@ -117,4 +117,4 @@ class PermsPanel(PanelItem):          # 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, 1), 16)) +            self.get_current_view().scroll_to_address(int(model.get_value(it, 4))) | 
