summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/python/Makefile.am2
-rw-r--r--plugins/python/androperms/Makefile.am23
-rw-r--r--plugins/python/androperms/__init__.py2
-rw-r--r--plugins/python/androperms/android.pngbin1102 -> 0 bytes
-rw-r--r--plugins/python/androperms/androperms.py89
-rw-r--r--plugins/python/androperms/db.py94
-rw-r--r--plugins/python/androperms/defs.py53
-rw-r--r--plugins/python/androperms/manifest.py75
-rw-r--r--plugins/python/androperms/panel.py125
-rw-r--r--plugins/python/androperms/parser.py328
-rw-r--r--plugins/python/androperms/reader.py41
-rw-r--r--plugins/python/androperms/routine.pngbin568 -> 0 bytes
-rw-r--r--plugins/python/androperms/stack.py108
-rw-r--r--plugins/python/androperms/string.py82
14 files changed, 1 insertions, 1021 deletions
diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am
index f54e1be..ae5baed 100644
--- a/plugins/python/Makefile.am
+++ b/plugins/python/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = androperms apkfiles samples welcome
+SUBDIRS = apkfiles samples welcome
diff --git a/plugins/python/androperms/Makefile.am b/plugins/python/androperms/Makefile.am
deleted file mode 100644
index b1a1e4e..0000000
--- a/plugins/python/androperms/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-
-andropermsdir = $(datadir)/openida/plugins/python/androperms
-
-androperms_DATA = \
- __init__.py \
- android.png \
- androperms.db \
- androperms.py \
- db.py \
- defs.py \
- manifest.py \
- panel.py \
- parser.py \
- reader.py \
- routine.png \
- stack.py \
- string.py
-
-androperms.db:
- @tmpzip=`tempfile` ; \
- wget http://www.android-permissions.org/permissionmap.zip -O $$tmpzip ; \
- unzip -p $$tmpzip permissionmap/APICalls.txt | tail -n +2 - > androperms.db ; \
- rm $$tmpzip
diff --git a/plugins/python/androperms/__init__.py b/plugins/python/androperms/__init__.py
deleted file mode 100644
index 8a5a159..0000000
--- a/plugins/python/androperms/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-
-from androperms import AndroPerms as androperms
diff --git a/plugins/python/androperms/android.png b/plugins/python/androperms/android.png
deleted file mode 100644
index ce9c905..0000000
--- a/plugins/python/androperms/android.png
+++ /dev/null
Binary files differ
diff --git a/plugins/python/androperms/androperms.py b/plugins/python/androperms/androperms.py
deleted file mode 100644
index f68b9a5..0000000
--- a/plugins/python/androperms/androperms.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-from manifest import AndroidManifest
-from db import PermsDataBase
-from panel import PermsPanel
-from pychrysalide import Plugin
-from pychrysalide.format.dex import DexFormat
-from xml.dom import minidom
-
-import re
-import zipfile
-
-
-class AndroPerms(Plugin):
- """List all permissions given to an APK files."""
-
- def init(self, ref):
- """Initialize the plugin."""
-
- self._panel = PermsPanel()
-
- return True
-
-
- 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."""
-
- fmt = binary.get_format()
- if not isinstance(fmt, DexFormat):
- return False
-
- 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
-
- plist = []
-
- for p in xml.getElementsByTagName("uses-permission"):
- plist.append(p.getAttribute("android:name"))
- # print p.getAttribute("android:name")
-
- # print
-
- db = PermsDataBase()
- db.filter_permissions(plist)
-
- instrs = binary.get_instructions()
- buf = binary.disassembled_buffer
-
- pfn = re.compile('<.* ([^ ]*)\(')
-
- for i in instrs:
-
- if i.keyword.startswith("invoke"):
-
- line = buf.find_line_by_addr(i.address)
- text = line.get_text()
-
- name = pfn.search(text)
-
- if name != None:
-
- 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
deleted file mode 100644
index 7014915..0000000
--- a/plugins/python/androperms/db.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-import os
-
-
-class PermsDataBase:
- """Display all permissions found in the Manifest."""
-
- def __init__(self):
-
- self._perms = { }
- self._used = { }
-
- self._load_all_definitions()
-
-
- def _load_all_definitions(self):
- """Load the database in memory."""
-
- with open(os.path.dirname(__file__) + '/androperms.db', 'r') as f:
-
- for line in f.readlines():
-
- perm = line.strip("\n").split("\t")
-
- for p in perm[1].split(" "):
-
- if not p.startswith("android.permission."):
- continue
-
- if p not in self._perms:
- self._perms[p] = []
-
- call = perm[0].split("(")[0]
-
- if call not in self._perms[p]:
- self._perms[p].append(call)
-
-
- def filter_permissions(self, used):
- """Forget all permissions which are not used."""
-
- keep = {}
-
- for p in self._perms:
- if p in used:
- keep[p] = self._perms[p]
-
- self._perms = keep
-
- for p in keep:
- self._used[p] = []
-
-
- def check_call(self, addr, line, reladdr):
- """Check if a call requires some rights."""
-
- found = False
-
- for p in self._perms:
-
- if line.find("Wall") > -1:
- print "[+]", line, ' ==> ', p
-
- for c in self._perms[p]:
-
- #print " - ", c
-
- #if line.find(c) > -1:
- if c.find(line) > -1:
- self._used[p].append([reladdr, c + "()", addr])
- found = True
-
- # if not found:
-
- # func = line.split('.')[-1]
-
- # for p in self._perms:
-
- # for c in self._perms[p]:
-
- # if c.find(func) > -1:
-
- # #print ">>> %s found in %s" % (func, c)
-
- # self._used[p].append([reladdr, line + "()", addr])
- # break
-
-
- def get_used_permissions(self):
- """Provide the list of used permissions."""
-
- return self._used
diff --git a/plugins/python/androperms/defs.py b/plugins/python/androperms/defs.py
deleted file mode 100644
index e23511e..0000000
--- a/plugins/python/androperms/defs.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/python -u
-# -*- coding: utf-8 -*-
-
-
-ATTRIBUTE_IX_NAMESPACE_URI = 0
-ATTRIBUTE_IX_NAME = 1
-ATTRIBUTE_IX_VALUE_STRING = 2
-ATTRIBUTE_IX_VALUE_TYPE = 3
-ATTRIBUTE_IX_VALUE_DATA = 4
-ATTRIBUTE_LENGHT = 5
-
-TYPE_NULL = 0
-TYPE_REFERENCE = 1
-TYPE_ATTRIBUTE = 2
-TYPE_STRING = 3
-TYPE_FLOAT = 4
-TYPE_DIMENSION = 5
-TYPE_FRACTION = 6
-TYPE_FIRST_INT = 16
-TYPE_INT_DEC = 16
-TYPE_INT_HEX = 17
-TYPE_INT_BOOLEAN = 18
-TYPE_FIRST_COLOR_INT = 28
-TYPE_INT_COLOR_ARGB8 = 28
-TYPE_INT_COLOR_RGB8 = 29
-TYPE_INT_COLOR_ARGB4 = 30
-TYPE_INT_COLOR_RGB4 = 31
-TYPE_LAST_COLOR_INT = 31
-TYPE_LAST_INT = 31
-
-RADIX_MULTS = [ 0.00390625, 3.051758E-005, 1.192093E-007, 4.656613E-010 ]
-DIMENSION_UNITS = [ "px", "dip", "sp", "pt", "in", "mm", "", "" ]
-FRACTION_UNITS = [ "%", "%p", "", "", "", "", "", "" ]
-COMPLEX_UNIT_MASK = 15
-
-
-CHUNK_AXML_FILE = 0x00080003
-CHUNK_RESOURCEIDS = 0x00080180
-CHUNK_XML_FIRST = 0x00100100
-CHUNK_XML_START_NAMESPACE = 0x00100100
-CHUNK_XML_END_NAMESPACE = 0x00100101
-CHUNK_XML_START_TAG = 0x00100102
-CHUNK_XML_END_TAG = 0x00100103
-CHUNK_XML_TEXT = 0x00100104
-CHUNK_XML_LAST = 0x00100104
-CHUNK_TYPE = 0x001C0001
-
-
-START_DOCUMENT = 0
-END_DOCUMENT = 1
-START_TAG = 2
-END_TAG = 3
-TEXT = 4
diff --git a/plugins/python/androperms/manifest.py b/plugins/python/androperms/manifest.py
deleted file mode 100644
index 63536b2..0000000
--- a/plugins/python/androperms/manifest.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-from defs import *
-from reader import AXMLReader
-from parser import AXMLParser
-
-
-class AndroidManifest():
-
-
- def __init__(self, data):
-
- self._buffer = ""
-
- reader = AXMLReader(data)
- parser = AXMLParser(reader)
-
- has_ns = False
- empty = False
-
- while 1 :
-
- tag = parser.next()
-
- if tag == START_DOCUMENT :
- self._buffer += '<?xml version="1.0" encoding="utf-8"?>\n'
-
- elif tag == START_TAG:
-
- if empty:
- self._buffer += '>\n'
-
- self._buffer += ' ' * (parser._namespaces.getDepth() - 2)
- self._buffer += "<%s%s" % (parser.getTagPrefix(), parser.getTagName())
-
- if not has_ns:
- self._buffer += ' xmlns:%s="%s"' % (parser.getNamespacePrefix(0), parser.getNamespaceUri(0))
- has_ns = True
-
- for i in range(0, parser.countAttributes()):
- self._buffer += ' %s%s="%s"' % (parser.getAttribPrefix(i), parser.getAttribName(i), parser.getAttribValue(i))
-
- empty = True
-
- elif tag == END_TAG:
-
- if empty:
- self._buffer += '/>\n'
- empty = False
-
- else:
- self._buffer += ' ' * (parser._namespaces.getDepth() - 2)
- self._buffer += "</%s%s>\n" % (parser.getTagPrefix(), parser.getTagName())
-
- elif tag == TEXT:
-
- if empty:
- self._buffer += '>\n'
- empty = False
-
- self._buffer += ' ' * (parser._namespaces.getDepth() - 1)
- self._buffer += "%s\n" % parser.getText()
-
- elif tag == END_DOCUMENT :
- break
-
- else:
- break
-
-
- def getXML(self):
- """Provide the XML content."""
-
- return self._buffer
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)))
diff --git a/plugins/python/androperms/parser.py b/plugins/python/androperms/parser.py
deleted file mode 100644
index 1939bbe..0000000
--- a/plugins/python/androperms/parser.py
+++ /dev/null
@@ -1,328 +0,0 @@
-#!/usr/bin/python -u
-# -*- coding: utf-8 -*-
-
-
-from defs import *
-from stack import NamespaceStack
-from string import StringBlock
-
-from struct import unpack
-
-
-class AXMLParser():
-
-
- def __init__(self, reader):
-
- self._reader = reader
-
- magic = reader.readInt()
- if magic != CHUNK_AXML_FILE:
- raise Exception('Bad Magic Number (0x%08lx)!' % magic)
-
- # chunkSize
- reader.skipInt()
-
- self._strings = StringBlock(reader)
- self._namespaces = NamespaceStack()
- self._operational = True
-
- self.resetEventInfo()
-
-
- def resetEventInfo(self):
-
- self._event = -1
- self._line_number = -1
- self._name = -1
- self._namespace_uri = -1
- self._attributes = None
- self._id_attrib = -1
- self._class_attrib = -1
- self._style_attrib = -1
-
- self._decreaseDepth = False
-
-
-
- def next(self):
-
- self.doNext()
- return self._event
-
-
- def doNext(self):
-
-
-
-
-
- event = self._event
-
-
- while True:
-
- if self._decreaseDepth:
- self._decreaseDepth = False
- self._namespaces.decDepth()
-
- # Fake END_DOCUMENT event.
- if event == END_TAG and self._namespaces.getDepth() == 1 and self._namespaces.count() == 0:
- self._event = END_DOCUMENT
- break
-
- if event == START_DOCUMENT:
- # Fake event, see CHUNK_XML_START_TAG handler.
- chunk = CHUNK_XML_START_TAG
-
- else:
- chunk = self._reader.readInt()
-
- if chunk == CHUNK_RESOURCEIDS:
-
- size = self._reader.readInt()
- if size < 8 or size % 4 != 0:
- raise Exception('Invalid resource ids size (%d).' % size)
-
- self._resource_ids = self._reader.readIntArray(size / 4 - 2)
-
- continue
-
- if chunk < CHUNK_XML_FIRST or chunk > CHUNK_XML_LAST:
- raise Exception('Invalid chunk type 0x%08lx.' % chunk)
-
- # Fake START_DOCUMENT event.
- if chunk == CHUNK_XML_START_TAG and event == -1:
- self._event = START_DOCUMENT
- break
-
- # Common header.
- self._reader.skipInt() # chunkSize
- self._line_number = self._reader.readInt()
- self._reader.skipInt() # 0xffffffff
-
- if chunk == CHUNK_XML_START_NAMESPACE or chunk == CHUNK_XML_END_NAMESPACE:
-
- if chunk == CHUNK_XML_START_NAMESPACE:
-
- prefix = self._reader.readInt()
- uri = self._reader.readInt()
- self._namespaces.push(prefix, uri)
-
- else:
-
- self._reader.skipInt() # prefix
- self._reader.skipInt() # uri
- self._namespaces.pop()
-
- continue
-
- elif chunk == CHUNK_XML_START_TAG:
-
- self._namespace_uri = self._reader.readInt()
- self._name = self._reader.readInt()
- self._reader.skipInt() # flags ?
-
- attribs_count = self._reader.readInt()
- self._id_attrib = (attribs_count >> 16) - 1
- attribs_count &= 0xffff
-
- self._class_attrib = self._reader.readInt()
- self._style_attrib = (self._class_attrib >> 16) - 1
- self._class_attrib = (self._class_attrib & 0xffff) - 1
-
- self._attributes = self._reader.readIntArray(attribs_count * ATTRIBUTE_LENGHT)
-
- for i in range(ATTRIBUTE_IX_VALUE_TYPE, len(self._attributes), ATTRIBUTE_LENGHT):
- self._attributes[i] >>= 24
-
- self._namespaces.incDepth()
- self._event = START_TAG
-
- break
-
- elif chunk == CHUNK_XML_END_TAG:
-
- self._namespaceUri = self._reader.readInt()
- self._name = self._reader.readInt()
-
- self._event = END_TAG
- self._decreaseDepth = True
-
- break
-
- elif chunk == CHUNK_XML_TEXT:
-
- self._name = self._reader.readInt()
- self._reader.skipInt() # ???
- self._reader.skipInt() # ???
-
- self._event=TEXT
-
- break
-
- else:
- raise Exception('Unknown chunck (0x%08lx)' % chunk)
-
-
- ### ESPACES ###
-
- def getNamespacePrefix(self, index):
-
- name = self._namespaces.getPrefix(index)
-
- if name == -1:
- return ''
-
- else:
- return self._strings.getRaw(name)
-
-
- def getNamespaceUri(self, index):
-
- name = self._namespaces.getUri(index)
-
- if name == -1:
- return ''
-
- else:
- return self._strings.getRaw(name)
-
-
- ### NAMES ###
-
- def getTagPrefix(self):
- """Provide the prefix linked to START_TAG or END_TAG."""
-
- name = self._namespaces.findPrefix(self._namespace_uri)
-
- if name == -1:
- return ''
-
- else:
- return self._strings.getRaw(name) + ':'
-
-
- def getTagName(self):
- """Provide the name linked to START_TAG or END_TAG."""
-
- if self._name == -1 or (self._event != START_TAG and self._event != END_TAG):
- raise Exception('Invalid tag name.')
-
- return self._strings.getRaw(self._name)
-
-
- def getText(self):
- """Provide the content linked to TEXT."""
-
- if self._name == -1 or self._event != START_TEXT:
- raise Exception('Invalid text content.')
-
- return self._strings.getRaw(self._name)
-
-
- ### ATRIBUTES ###
-
- def countAttributes(self):
- """Count the properties of the current tag."""
-
- if self._event != START_TAG:
- raise Exception('Invalid event.')
-
- return len(self._attributes) / ATTRIBUTE_LENGHT
-
-
- def getAttribPrefix(self, index):
- """Get the prefix of a given attribute."""
-
- index *= ATTRIBUTE_LENGHT
-
- if index >= len(self._attributes):
- raise Exception('Bad attribute index.')
-
- uri = self._attributes[index + ATTRIBUTE_IX_NAMESPACE_URI]
- name = self._namespaces.findPrefix(uri)
-
- if name == -1:
- return ''
-
- else:
- return self._strings.getRaw(name) + ':'
-
-
- def getAttribName(self, index):
- """Get the name of a given attribute."""
-
- index *= ATTRIBUTE_LENGHT
-
- if index >= len(self._attributes):
- raise Exception('Bad attribute index.')
-
- name = self._attributes[index + ATTRIBUTE_IX_NAME]
-
- if name == -1:
- return '???'
-
- else:
- return self._strings.getRaw(name)
-
-
- def getAttribValue(self, index):
- """Get the value of a given attribute."""
-
- index *= ATTRIBUTE_LENGHT
-
- if index >= len(self._attributes):
- raise Exception('Bad attribute index.')
-
- vtype = self._attributes[index + ATTRIBUTE_IX_VALUE_TYPE]
- vdata = self._attributes[index + ATTRIBUTE_IX_VALUE_DATA]
-
- if vtype == TYPE_NULL:
- return '???'
-
- elif vtype == TYPE_REFERENCE:
- return '@%s%08X' % (self.getPackage(vdata), vdata)
-
- elif vtype == TYPE_ATTRIBUTE:
- return '?%s%08X' % (self.getPackage(vdata), vdata)
-
- if vtype == TYPE_STRING:
- vdata = self._attributes[index + ATTRIBUTE_IX_VALUE_STRING]
- return self._strings.getRaw(vdata)
-
- elif vtype == TYPE_FLOAT:
- return '%f' % unpack('=f', pack('=L', vdata))[0]
-
- elif vtype == TYPE_DIMENSION:
- return '%f%s' % (self.complexToFloat(vdata), DIMENSION_UNITS[vdata & COMPLEX_UNIT_MASK])
-
- elif vtype == TYPE_FRACTION:
- return '%f%s' % (self.complexToFloat(vdata), FRACTION_UNITS[vdata & COMPLEX_UNIT_MASK])
-
- elif vtype == TYPE_INT_HEX:
- return '0x%08x' % vdata
-
- elif vtype == TYPE_INT_BOOLEAN:
- if vdata == 0:
- return 'false'
- else:
- return 'true'
-
- elif vtype >= TYPE_FIRST_COLOR_INT and vtype <= TYPE_LAST_COLOR_INT:
- return '#%08x' % vdata
-
- elif vtype >= TYPE_FIRST_INT and vtype <= TYPE_LAST_INT:
- return str(vdata)
-
- return "<0x%x, 0x%02x>" % (vdata, vtype)
-
-
- def complexToFloat(self, xcomplex):
- return (float)(xcomplex & 0xffffff00) * RADIX_MULTS[(xcomplex >> 4) & 3];
-
- def getPackage(self, id):
- if id >> 24 == 1:
- return "android:"
- else:
- return ""
diff --git a/plugins/python/androperms/reader.py b/plugins/python/androperms/reader.py
deleted file mode 100644
index f126850..0000000
--- a/plugins/python/androperms/reader.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python -u
-# -*- coding: utf-8 -*-
-
-
-from struct import unpack
-
-
-class AXMLReader():
- """Provide various read helpers."""
-
- def __init__(self, data):
-
- self._data = data
-
- self._position = 0
- self._length = len(self._data)
-
-
- def readInt(self):
- """Read a 4-bytes value."""
-
- self.skipInt()
-
- value = unpack('<L', self._data[self._position - 4 : self._position])[0]
-
- return value
-
-
- def skipInt(self):
- """Skip a 4-bytes value."""
-
- self._position += 4
-
- if self._position > self._length:
- raise Exception("Reader out of bound (%d > %d)!" % (self._position, self._length))
-
-
- def readIntArray(self, length):
- """Read an array composed of 4-bytes values."""
-
- return [ self.readInt() for i in range(0, length) ]
diff --git a/plugins/python/androperms/routine.png b/plugins/python/androperms/routine.png
deleted file mode 100644
index 2ddc67a..0000000
--- a/plugins/python/androperms/routine.png
+++ /dev/null
Binary files differ
diff --git a/plugins/python/androperms/stack.py b/plugins/python/androperms/stack.py
deleted file mode 100644
index 38431dc..0000000
--- a/plugins/python/androperms/stack.py
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/python -u
-# -*- coding: utf-8 -*-
-
-
-class NamespaceStack():
-
-
- def __init__(self):
-
- # self.increaseDepth()
-
-
- self._depth = 1
-
- self._prefix_2_uri = {}
- self._uri_2_prefix = {}
-
- self._pairs = []
-
- pass
-
-
-
- def getDepth(self):
-
- return self._depth
-
-
- def incDepth(self):
-
- self._depth += 1
-
-
- def decDepth(self):
-
- self._depth -= 1
-
-
-
-
-
- def count(self):
- """Provider the current number of active namespaces."""
-
- return len(self._pairs)
-
-
-
-
-
-
-
- def push(self, prefix, uri):
-
- self._prefix_2_uri[prefix] = uri
- self._uri_2_prefix[uri] = prefix
-
- self._pairs.append((prefix, uri))
-
- #print "PUSH", prefix, uri
-
-
-
-
- def pop(self):
-
- self._pairs.pop()
-
- #print "POP"
-
-
-
-
-
- def getPrefix(self, index):
-
- if index < len(self._pairs):
- return self._pairs[index][0]
-
- else:
- return -1
-
-
- def findPrefix(self, uri):
-
- if uri in self._uri_2_prefix:
- return self._uri_2_prefix[uri]
-
- else:
- return -1
-
-
- def getUri(self, index):
-
- if index < len(self._pairs):
- return self._pairs[index][1]
-
- else:
- return -1
-
-
- def findUri(self, prefix):
-
- if prefix in self._prefix_2_uri:
- return self._prefix_2_uri[prefix]
-
- else:
- return -1
diff --git a/plugins/python/androperms/string.py b/plugins/python/androperms/string.py
deleted file mode 100644
index 09a7b93..0000000
--- a/plugins/python/androperms/string.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python -u
-# -*- coding: utf-8 -*-
-
-
-from defs import CHUNK_TYPE
-
-
-class StringBlock():
-
-
- def __init__(self, reader):
-
- magic = reader.readInt()
- if magic != CHUNK_TYPE:
- raise Exception("Bad Magic Number (0x%08lx)!" % magic)
-
- chunk_size = reader.readInt()
- str_count = reader.readInt()
- style_offset_count = reader.readInt()
- reader.readInt() # ???
- str_offset = reader.readInt()
- styles_offset = reader.readInt()
-
- self._str_offsets = reader.readIntArray(str_count);
- self._style_offsets = reader.readIntArray(style_offset_count);
-
- if styles_offset == 0:
- size = chunk_size - str_offset
- else:
- size = styles_offset - str_offset
-
- if size % 4 != 0:
- raise Exception("String data size is not multiple of 4 (%d)!" % size)
-
- self._strings = reader.readIntArray(size / 4)
-
- if styles_offset > 0:
-
- size = chunk_size - styles_offset
-
- if size % 4 != 0:
- raise Exception("Style data size is not multiple of 4 (%d)!" % size)
-
- self._styles = reader.readIntArray(size / 4)
-
- self._str_data = [ self.getRaw(i) for i in range(self.count()) ]
-
-
- def count(self):
- """Count the number of strings in the current block."""
-
- return len(self._str_offsets)
-
-
- def getRaw(self, index):
- """Provide a raw string (without any styling information) at specified index."""
-
- if index < 0 or index >= len(self._str_offsets):
- raise Exception("Invalid Index (%d)!" % index)
-
- offset = self._str_offsets[index]
- length = self.getShort(self._strings, offset)
-
- data = ''
-
- for i in range(length):
- offset += 2
- data += unichr(self.getShort(self._strings, offset))
-
- return data
-
-
- def getShort(self, array, offset):
-
- value = array[offset / 4]
-
- if ((offset % 4) / 2) == 0:
- value &= 0xFFFF
- else:
- value >>= 16
-
- return value