diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-08-03 13:03:26 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-08-03 13:03:26 (GMT) |
commit | b7c83221f2a60be8ee5d44a7599dbe6869af005f (patch) | |
tree | 814e294533920d18f8734baa9aaef47c676e520a /plugins/python/androperms/stack.py | |
parent | 7d2b7ca95966c2d687526cd75a96d1ea67d3f503 (diff) |
Loaded the permissions used by an APK file.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@255 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/python/androperms/stack.py')
-rw-r--r-- | plugins/python/androperms/stack.py | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/plugins/python/androperms/stack.py b/plugins/python/androperms/stack.py new file mode 100644 index 0000000..38431dc --- /dev/null +++ b/plugins/python/androperms/stack.py @@ -0,0 +1,108 @@ +#!/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 |