Merge branch 'master' into doc

This commit is contained in:
reox 2018-02-16 17:52:44 +01:00 committed by GitHub
commit f81bef8ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 62364 additions and 162209 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "libraries/axplorer"]
path = libraries/axplorer
url = https://github.com/reddr/axplorer.git

View File

@ -26,6 +26,7 @@ Find the documentation for master on [ReadTheDocs](http://androguard.readthedocs
There are some (probably broken/outdated) examples and demos in the folders [demos](https://github.com/androguard/androguard/tree/master/demos) and [examples](https://github.com/androguard/androguard/tree/master/examples).
## Licenses
### Androguard

View File

@ -574,6 +574,10 @@ class MethodClassAnalysis(object):
return self.xrefto
def get_method(self):
"""
Return the `EncodedMethod` object that relates to this object
:return: `dvm.EncodedMethod`
"""
return self.method
def __str__(self):

View File

@ -4,6 +4,7 @@ import logging
import tempfile
from androguard import __version__
from androguard.core.api_specific_resources import load_permission_mappings, load_permissions
ANDROGUARD_VERSION = __version__
log = logging.getLogger("androguard.default")
@ -91,20 +92,10 @@ CONF = {
"PRINT_FCT": sys.stdout.write,
"LAZY_ANALYSIS": False,
"MAGIC_PATH_FILE": None,
"DEFAULT_API": 19,
"DEFAULT_API": 16, # this is the minimal API version we have
"SESSION": None,
}
if os.path.exists(os.path.join(os.path.dirname(__file__), '..', '..', 'androgui.py')):
CONF['data_prefix'] = os.path.join(os.path.dirname(__file__), '..', 'gui')
# workaround issue on OSX, where sys.prefix is not an installable location
elif sys.platform == 'darwin' and sys.prefix.startswith('/System'):
CONF['data_prefix'] = os.path.join('.', 'share', 'androguard')
elif sys.platform == 'win32':
CONF['data_prefix'] = os.path.join(sys.prefix, 'Scripts', 'androguard')
else:
CONF['data_prefix'] = os.path.join(sys.prefix, 'share', 'androguard')
def default_colors(obj):
CONF["COLORS"]["OFFSET"] = obj.Yellow
@ -312,22 +303,25 @@ def color_range(startcolor, goalcolor, steps):
return interpolate_tuple(start_tuple, goal_tuple, steps)
def load_api_specific_resource_module(resource_name, api):
# Those two imports are quite slow.
# Therefor we put them directly into this method
from androguard.core.api_specific_resources.aosp_permissions.aosp_permissions import AOSP_PERMISSIONS
from androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings import AOSP_PERMISSIONS_MAPPINGS
def load_api_specific_resource_module(resource_name, api=None):
"""
Load the module from the JSON files and return a dict, which might be empty
if the resource could not be loaded.
if resource_name == "aosp_permissions":
mod = AOSP_PERMISSIONS
elif resource_name == "api_permission_mappings":
mod = AOSP_PERMISSIONS_MAPPINGS
else:
raise InvalidResourceError("Invalid Resource {}".format(resource_name))
If no api version is given, the default one from the CONF dict is used.
:param resource_name: Name of the resource to load
:param api: API version
:return: dict
"""
loader = dict(aosp_permissions=load_permissions,
api_permission_mappings=load_permission_mappings)
if resource_name not in loader:
raise InvalidResourceError("Invalid Resource '{}', not in [{}]".format(resource_name, ", ".join(loader.keys())))
if not api:
api = CONF["DEFAULT_API"]
value = mod.get(api)
if value:
return value
return mod.get('9')
return loader[resource_name](api)

View File

@ -1 +1,41 @@
import json
import os
class APILevelNotFoundError(Exception):
pass
def load_permissions(apilevel):
"""
Load the Permissions for the given apilevel
:param apilevel: integer value of the API level
:return: a dictionary of {Permission Name: {Permission info}
"""
root = os.path.dirname(os.path.realpath(__file__))
permissions_file = os.path.join(root, "aosp_permissions", "permissions_{}.json".format(apilevel))
if not os.path.isfile(permissions_file):
return {}
with open(permissions_file, "r") as fp:
return json.load(fp)
def load_permission_mappings(apilevel):
"""
Load the API/Permission mapping for the requested API level.
If the requetsed level was not found, None is returned.
:param apilevel: integer value of the API level, i.e. 24 for Android 7.0
:return: a dictionary of {MethodSignature: [List of Permissions]}
"""
root = os.path.dirname(os.path.realpath(__file__))
permissions_file = os.path.join(root, "api_permission_mappings", "permissions_{}.json".format(apilevel))
if not os.path.isfile(permissions_file):
return {}
with open(permissions_file, "r") as fp:
return json.load(fp)

View File

@ -1,53 +0,0 @@
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api9 as api9
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api10 as api10
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api14 as api14
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api15 as api15
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api16 as api16
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api17 as api17
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api18 as api18
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api19 as api19
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api21 as api21
import androguard.core.api_specific_resources.aosp_permissions.aosp_permissions_api22 as api22
AOSP_PERMISSIONS = {
"9": {
"AOSP_PERMISSIONS": api9.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api9.AOSP_PERMISSION_GROUPS
},
"10": {
"AOSP_PERMISSIONS": api10.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api10.AOSP_PERMISSION_GROUPS
},
"14": {
"AOSP_PERMISSIONS": api14.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api14.AOSP_PERMISSION_GROUPS
},
"15": {
"AOSP_PERMISSIONS": api15.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api15.AOSP_PERMISSION_GROUPS
},
"16": {
"AOSP_PERMISSIONS": api16.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api16.AOSP_PERMISSION_GROUPS
},
"17": {
"AOSP_PERMISSIONS": api17.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api17.AOSP_PERMISSION_GROUPS
},
"18": {
"AOSP_PERMISSIONS": api18.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api18.AOSP_PERMISSION_GROUPS
},
"19": {
"AOSP_PERMISSIONS": api19.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api19.AOSP_PERMISSION_GROUPS
},
"21": {
"AOSP_PERMISSIONS": api21.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api21.AOSP_PERMISSION_GROUPS
},
"22": {
"AOSP_PERMISSIONS": api22.AOSP_PERMISSIONS,
"AOSP_PERMISSIONS_GROUPS": api22.AOSP_PERMISSION_GROUPS
},
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +0,0 @@
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api9 as api9
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api10 as api10
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api14 as api14
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api15 as api15
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api16 as api16
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api17 as api17
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api18 as api18
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api19 as api19
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api21 as api21
import androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings_api22 as api22
AOSP_PERMISSIONS_MAPPINGS = {
"9": {
"AOSP_PERMISSIONS_BY_METHODS": api9.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api9.AOSP_PERMISSIONS_BY_FIELDS
},
"10": {
"AOSP_PERMISSIONS_BY_METHODS": api10.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api10.AOSP_PERMISSIONS_BY_FIELDS
},
"14": {
"AOSP_PERMISSIONS_BY_METHODS": api14.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api14.AOSP_PERMISSIONS_BY_FIELDS
},
"15": {
"AOSP_PERMISSIONS_BY_METHODS": api15.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api15.AOSP_PERMISSIONS_BY_FIELDS
},
"16": {
"AOSP_PERMISSIONS_BY_METHODS": api16.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api16.AOSP_PERMISSIONS_BY_FIELDS
},
"17": {
"AOSP_PERMISSIONS_BY_METHODS": api17.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api17.AOSP_PERMISSIONS_BY_FIELDS
},
"18": {
"AOSP_PERMISSIONS_BY_METHODS": api18.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api18.AOSP_PERMISSIONS_BY_FIELDS
},
"19": {
"AOSP_PERMISSIONS_BY_METHODS": api19.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api19.AOSP_PERMISSIONS_BY_FIELDS
},
"21": {
"AOSP_PERMISSIONS_BY_METHODS": api21.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api21.AOSP_PERMISSIONS_BY_FIELDS
},
"22": {
"AOSP_PERMISSIONS_BY_METHODS": api22.AOSP_PERMISSIONS_BY_METHODS,
"AOSP_PERMISSIONS_BY_FIELDS": api22.AOSP_PERMISSIONS_BY_FIELDS
},
}

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,6 @@ standard_library.install_aliases()
from builtins import str
from builtins import object
from androguard.core import androconf
from androguard.core.bytecodes.dvm_permissions import DVM_PERMISSIONS
from androguard.util import read, get_certificate_name_string
from androguard.core.bytecodes.axml import ARSCParser, AXMLPrinter, ARSCResTableConfig
@ -92,7 +91,7 @@ class APK(object):
self.declared_permissions = {}
self.valid_apk = False
self.files = {}
self._files = {}
self.files_crc32 = {}
self.magic_file = magic_file
@ -407,22 +406,31 @@ class APK(object):
else:
return self._patch_magic(buffer, ftype)
@property
def files(self):
"""
Wrapper for the files object
:return: dictionary of files and their mime type
"""
return self.get_files_types()
def get_files_types(self):
"""
Return the files inside the APK with their associated types (by using python-magic)
:rtype: a dictionnary
"""
if self.files == {}:
if self._files == {}:
# Generate File Types / CRC List
for i in self.get_files():
buffer = self.zip.read(i)
self.files_crc32[i] = crc32(buffer)
# FIXME why not use the crc from the zipfile?
#crc = self.zip.getinfo(i).CRC
self.files[i] = self._get_file_magic_name(buffer)
self._files[i] = self._get_file_magic_name(buffer)
return self.files
return self._files
def _patch_magic(self, buffer, orig):
if ("Zip" in orig) or ("DBase" in orig):
@ -690,23 +698,18 @@ class APK(object):
"""
Return permissions with details
:rtype: list of string
:rtype: dict of {permission: [protectionLevel, label, description]}
"""
l = {}
for i in self.permissions:
perm = i
pos = i.rfind(".")
if pos != -1:
perm = i[pos + 1:]
try:
l[i] = DVM_PERMISSIONS["MANIFEST_PERMISSION"][perm]
except KeyError:
if i in self.permission_module:
x = self.permission_module[i]
l[i] = [x["protectionLevel"], x["label"], x["description"]]
else:
# FIXME: the permission might be signature, if it is defined by the app itself!
l[i] = ["normal", "Unknown permission from android reference",
"Unknown permission from android reference"]
return l
@DeprecationWarning
@ -979,7 +982,7 @@ class APK(object):
print("FILES: ")
for i in self.get_files():
try:
print("\t", i, self.files[i], "%x" % self.files_crc32[i])
print("\t", i, self._files[i], "%x" % self.files_crc32[i])
except KeyError:
print("\t", i, "%x" % self.files_crc32[i])

View File

@ -1,494 +0,0 @@
########################################## PERMISSIONS ########################################################
DVM_PERMISSIONS = {
"MANIFEST_PERMISSION": {
# MESSAGES
"SEND_SMS": ["dangerous", "send SMS messages",
"Allows application to send SMS messages. Malicious applications may cost you money by sending messages without your confirmation."],
"SEND_SMS_NO_CONFIRMATION": ["signatureOrSystem", "send SMS messages",
"send SMS messages via the Messaging app with no user input or confirmation"],
"RECEIVE_SMS": ["dangerous", "receive SMS",
"Allows application to receive and process SMS messages. Malicious applications may monitor your messages or delete them without showing them to you."],
"RECEIVE_MMS": ["dangerous", "receive MMS",
"Allows application to receive and process MMS messages. Malicious applications may monitor your messages or delete them without showing them to you."],
"RECEIVE_EMERGENCY_BROADCAST": ["signatureOrSystem", "",
"Allows an application to receive emergency cell broadcast messages, to record or display them to the user. Reserved for system apps."],
"READ_CELL_BROADCASTS": ["dangerous", "received cell broadcast messages",
"Allows an application to read previously received cell broadcast " \
"messages and to register a content observer to get notifications when " \
"a cell broadcast has been received and added to the database. For " \
"emergency alerts, the database is updated immediately after the " \
"alert dialog and notification sound/vibration/speech are presented." \
"The \"read\" column is then updated after the user dismisses the alert." \
"This enables supplementary emergency assistance apps to start loading " \
"additional emergency information (if Internet access is available) " \
"when the alert is first received, and to delay presenting the info " \
"to the user until after the initial alert dialog is dismissed."],
"READ_SMS": ["dangerous", "read SMS or MMS",
"Allows application to read SMS messages stored on your phone or SIM card. Malicious applications may read your confidential messages."],
"WRITE_SMS": ["dangerous", "edit SMS or MMS",
"Allows application to write to SMS messages stored on your phone or SIM card. Malicious applications may delete your messages."],
"RECEIVE_WAP_PUSH": ["dangerous", "receive WAP",
"Allows application to receive and process WAP messages. Malicious applications may monitor your messages or delete them without showing them to you."],
"BROADCAST_SMS": ["signature", "send SMS-received broadcast",
"Allows an application to broadcast a notification that an SMS message has been received. Malicious applications may use this to forge incoming SMS messages."],
"BROADCAST_WAP_PUSH": ["signature", "send WAP-PUSH-received broadcast",
"Allows an application to broadcast a notification that a WAP-PUSH message has been received. Malicious applications may use this to forge MMS message receipt or to replace the content of any web page silently with malicious variants."],
# SOCIAL_INFO
"READ_CONTACTS": ["dangerous", "read contact data",
"Allows an application to read all of the contact (address) data stored on your phone. Malicious applications can use this to send your data to other people."],
"WRITE_CONTACTS": ["dangerous", "write contact data",
"Allows an application to modify the contact (address) data stored on your phone. Malicious applications can use this to erase or modify your contact data."],
"BIND_DIRECTORY_SEARCH": ["signatureOrSystem", "execute contacts directory search",
"Allows an application to execute contacts directory search. This should only be used by ContactsProvider."],
"READ_CALL_LOG": ["dangerous", "read the user's call log.",
"Allows an application to read the user's call log."],
"WRITE_CALL_LOG": ["dangerous", "write (but not read) the user's contacts data.",
"Allows an application to write (but not read) the user's contacts data."],
"READ_SOCIAL_STREAM": ["dangerous", "read from the user's social stream",
"Allows an application to read from the user's social stream."],
"WRITE_SOCIAL_STREAM": ["dangerous", "write the user's social stream",
"Allows an application to write (but not read) the user's social stream data."],
# PERSONAL_INFO
"READ_PROFILE": ["dangerous", "read the user's personal profile data",
"Allows an application to read the user's personal profile data."],
"WRITE_PROFILE": ["dangerous", "write the user's personal profile data",
"Allows an application to write (but not read) the user's personal profile data."],
"RETRIEVE_WINDOW_CONTENT": ["signatureOrSystem", "",
"Allows an application to retrieve the content of the active window An active window is the window that has fired an accessibility event. "],
"BIND_APPWIDGET": ["signatureOrSystem", "choose widgets",
"Allows the application to tell the system which widgets can be used by which application. With this permission, applications can give access to personal data to other applications. Not for use by normal applications."],
"BIND_KEYGUARD_APPWIDGET": ["signatureOrSystem", "",
"Private permission, to restrict who can bring up a dialog to add a new keyguard widget"],
# CALENDAR
"READ_CALENDAR": ["dangerous", "read calendar events",
"Allows an application to read all of the calendar events stored on your phone. Malicious applications can use this to send your calendar events to other people."],
"WRITE_CALENDAR": ["dangerous", "add or modify calendar events and send emails to guests",
"Allows an application to add or change the events on your calendar, which may send emails to guests. Malicious applications can use this to erase or modify your calendar events or to send emails to guests."],
# USER_DICTIONARY
"READ_USER_DICTIONARY": ["dangerous", "read user-defined dictionary",
"Allows an application to read any private words, names and phrases that the user may have stored in the user dictionary."],
# WRITE_USER_DICTIONARY
"WRITE_USER_DICTIONARY": ["normal", "write to user-defined dictionary",
"Allows an application to write new words into the user dictionary."],
# BOOKMARKS
"READ_HISTORY_BOOKMARKS": ["dangerous", "read Browser\'s history and bookmarks",
"Allows the application to read all the URLs that the browser has visited and all of the browser\'s bookmarks."],
"WRITE_HISTORY_BOOKMARKS": ["dangerous", "write Browser\'s history and bookmarks",
"Allows an application to modify the browser\'s history or bookmarks stored on your phone. Malicious applications can use this to erase or modify your browser\'s data."],
# DEVICE_ALARMS
"SET_ALARM": ["normal", "set alarm in alarm clock",
"Allows the application to set an alarm in an installed alarm clock application. Some alarm clock applications may not implement this feature."],
# VOICEMAIL
"ADD_VOICEMAIL": ["dangerous", "add voicemails into the system",
"Allows an application to add voicemails into the system."],
# LOCATION
"ACCESS_FINE_LOCATION": ["dangerous", "fine (GPS) location",
"Access fine location sources, such as the Global Positioning System on the phone, where available. Malicious applications can use this to determine where you are and may consume additional battery power."],
"ACCESS_COARSE_LOCATION": ["dangerous", "coarse (network-based) location",
"Access coarse location sources, such as the mobile network database, to determine an approximate phone location, where available. Malicious applications can use this to determine approximately where you are."],
"ACCESS_MOCK_LOCATION": ["dangerous", "mock location sources for testing",
"Create mock location sources for testing. Malicious applications can use this to override the location and/or status returned by real-location sources such as GPS or Network providers."],
"ACCESS_LOCATION_EXTRA_COMMANDS": ["normal", "access extra location provider commands",
"Access extra location provider commands. Malicious applications could use this to interfere with the operation of the GPS or other location sources."],
"INSTALL_LOCATION_PROVIDER": ["signatureOrSystem", "permission to install a location provider",
"Create mock location sources for testing. Malicious applications can use this to override the location and/or status returned by real-location sources such as GPS or Network providers, or monitor and report your location to an external source."],
# NETWORK
"INTERNET": ["dangerous", "full Internet access", "Allows an application to create network sockets."],
"ACCESS_NETWORK_STATE": ["normal", "view network status",
"Allows an application to view the status of all networks."],
"ACCESS_WIFI_STATE": ["normal", "view Wi-Fi status",
"Allows an application to view the information about the status of Wi-Fi."],
"CHANGE_WIFI_STATE": ["dangerous", "change Wi-Fi status",
"Allows an application to connect to and disconnect from Wi-Fi access points and to make changes to configured Wi-Fi networks."],
"CHANGE_NETWORK_STATE": ["normal", "change network connectivity",
"Allows an application to change the state of network connectivity."],
"ACCESS_WIMAX_STATE": ["normal", "", ""],
"CHANGE_WIMAX_STATE": ["dangerous", "", ""],
"NFC": ["dangerous", "control Near-Field Communication",
"Allows an application to communicate with Near-Field Communication (NFC) tags, cards and readers."],
"CONNECTIVITY_INTERNAL": ["signatureOrSystem", "use privileged ConnectivityManager API",
"Allows an internal user to use privileged ConnectivityManager API"],
"RECEIVE_DATA_ACTIVITY_CHANGE": ["signatureOrSystem", "", ""],
# BLUETOOTH_NETWORK
"BLUETOOTH": ["dangerous", "create Bluetooth connections",
"Allows an application to view configuration of the local Bluetooth phone and to make and accept connections with paired devices."],
"BLUETOOTH_ADMIN": ["dangerous", "bluetooth administration",
"Allows an application to configure the local Bluetooth phone and to discover and pair with remote devices."],
# SYSTEM TOOLS
"BLUETOOTH_STACK": ["signature", "", ""],
"NET_ADMIN": ["signature", "configure network interfaces, configure/use IPSec, etc",
"Allows access to configure network interfaces, configure/use IPSec, etc."],
"REMOTE_AUDIO_PLAYBACK": ["signature", "remote audio playback",
"Allows registration for remote audio playback"],
"READ_EXTERNAL_STORAGE": ["normal", "read from external storage",
"Allows an application to read from external storage"],
"INTERACT_ACROSS_USERS": ["signatureOrSystemOrDevelopment", "",
"Allows an application to call APIs that allow it to do interactions across the users on the device, using singleton services and user-targeted broadcasts. This permission is not available to third party applications."],
"INTERACT_ACROSS_USERS_FULL": ["signature", "",
"Fuller form of INTERACT_ACROSS_USERS that removes restrictions on where broadcasts can be sent and allows other types of interactions."],
"MANAGE_USERS": ["signatureOrSystem", "",
"Allows an application to call APIs that allow it to query and manage users on the device. This permission is not available to third party applications."],
"GET_DETAILED_TASKS": ["signature", "",
"Allows an application to get full detailed information about recently running tasks, with full fidelity to the real state."],
"START_ANY_ACTIVITY": ["signature", "",
"Allows an application to start any activity, regardless of permission protection or exported state."],
"SET_SCREEN_COMPATIBILITY": ["signature", "", "Change the screen compatibility mode of applications"],
"CHANGE_CONFIGURATION": ["signatureOrSystemOrDevelopment", "change your UI settings",
"Allows an application to change the current configuration, such as the locale or overall font size."],
"FORCE_STOP_PACKAGES": ["signature", "force-stop other applications",
"Allows an application to stop other applications forcibly."],
"SET_ANIMATION_SCALE": ["signatureOrSystemOrDevelopment", "modify global animation speed",
"Allows an application to change the global animation speed (faster or slower animations) at any time."],
"GET_PACKAGE_SIZE": ["normal", "measure application storage space",
"Allows an application to retrieve its code, data and cache sizes"],
"SET_PREFERRED_APPLICATIONS": ["signature", "set preferred applications",
"Allows an application to modify your preferred applications. This can allow malicious applications to silently change the applications that are run, spoofing your existing applications to collect private data from you."],
"BROADCAST_STICKY": ["normal", "send sticky broadcast",
"Allows an application to send sticky broadcasts, which remain after the broadcast ends. Malicious applications can make the phone slow or unstable by causing it to use too much memory."],
"MOUNT_UNMOUNT_FILESYSTEMS": ["signatureOrSystem", "mount and unmount file systems",
"Allows the application to mount and unmount file systems for removable storage."],
"MOUNT_FORMAT_FILESYSTEMS": ["signatureOrSystem", "format external storage",
"Allows the application to format removable storage."],
"ASEC_ACCESS": ["signature", "get information on internal storage",
"Allows the application to get information on internal storage."],
"ASEC_CREATE": ["signature", "create internal storage", "Allows the application to create internal storage."],
"ASEC_DESTROY": ["signature", "destroy internal storage",
"Allows the application to destroy internal storage."],
"ASEC_MOUNT_UNMOUNT": ["signature", "mount/unmount internal storage",
"Allows the application to mount/unmount internal storage."],
"ASEC_RENAME": ["signature", "rename internal storage", "Allows the application to rename internal storage."],
"WRITE_APN_SETTINGS": ["signatureOrSystem", "write Access Point Name settings",
"Allows an application to modify the APN settings, such as Proxy and Port of any APN."],
"SUBSCRIBED_FEEDS_READ": ["normal", "read subscribed feeds",
"Allows an application to receive details about the currently synced feeds."],
"SUBSCRIBED_FEEDS_WRITE": ["dangerous", "write subscribed feeds",
"Allows an application to modify your currently synced feeds. This could allow a malicious application to change your synced feeds."],
"CLEAR_APP_CACHE": ["dangerous", "delete all application cache data",
"Allows an application to free phone storage by deleting files in application cache directory. Access is usually very restricted to system process."],
"DIAGNOSTIC": ["signature", "read/write to resources owned by diag",
"Allows an application to read and write to any resource owned by the diag group; for example, files in /dev. This could potentially affect system stability and security. This should ONLY be used for hardware-specific diagnostics by the manufacturer or operator."],
"BROADCAST_PACKAGE_REMOVED": ["signature", "send package removed broadcast",
"Allows an application to broadcast a notification that an application package has been removed. Malicious applications may use this to kill any other application running."],
"BATTERY_STATS": ["dangerous", "modify battery statistics",
"Allows the modification of collected battery statistics. Not for use by normal applications."],
"MODIFY_APPWIDGET_BIND_PERMISSIONS": ["signatureOrSystem", "query/set which applications can bind AppWidgets.",
"Internal permission allowing an application to query/set which applications can bind AppWidgets."],
"CHANGE_BACKGROUND_DATA_SETTING": ["signature", "change background data usage setting",
"Allows an application to change the background data usage setting."],
"GLOBAL_SEARCH": ["signatureOrSystem", "",
"This permission can be used on content providers to allow the global search " \
"system to access their data. Typically it used when the provider has some " \
"permissions protecting it (which global search would not be expected to hold)," \
"and added as a read-only permission to the path in the provider where global " \
"search queries are performed. This permission can not be held by regular applications; " \
"it is used by applications to protect themselves from everyone else besides global search"],
"GLOBAL_SEARCH_CONTROL": ["signature", "", "Internal permission protecting access to the global search " \
"system: ensures that only the system can access the provider " \
"to perform queries (since this otherwise provides unrestricted " \
"access to a variety of content providers), and to write the " \
"search statistics (to keep applications from gaming the source " \
"ranking)."],
"SET_WALLPAPER_COMPONENT": ["signatureOrSystem", "set a live wallpaper",
"Allows applications to set a live wallpaper."],
"READ_DREAM_STATE": ["signature", "", "Allows applications to read dream settings and dream state."],
"WRITE_DREAM_STATE": ["signature", "",
"Allows applications to write dream settings, and start or stop dreaming."],
"WRITE_SETTINGS": ["normal", "modify global system settings",
"Allows an application to modify the system\'s settings data. Malicious applications can corrupt your system\'s configuration."],
# ACCOUNTS
"GET_ACCOUNTS": ["normal", "discover known accounts",
"Allows an application to access the list of accounts known by the phone."],
"AUTHENTICATE_ACCOUNTS": ["dangerous", "act as an account authenticator",
"Allows an application to use the account authenticator capabilities of the Account Manager, including creating accounts as well as obtaining and setting their passwords."],
"USE_CREDENTIALS": ["dangerous", "use the authentication credentials of an account",
"Allows an application to request authentication tokens."],
"MANAGE_ACCOUNTS": ["dangerous", "manage the accounts list",
"Allows an application to perform operations like adding and removing accounts and deleting their password."],
"ACCOUNT_MANAGER": ["signature", "act as the Account Manager Service",
"Allows an application to make calls to Account Authenticators"],
# AFFECTS_BATTERY
"CHANGE_WIFI_MULTICAST_STATE": ["dangerous", "allow Wi-Fi Multicast reception",
"Allows an application to receive packets not directly addressed to your device. This can be useful when discovering services offered nearby. It uses more power than the non-multicast mode."],
"VIBRATE": ["normal", "control vibrator", "Allows the application to control the vibrator."],
"FLASHLIGHT": ["normal", "control flashlight", "Allows the application to control the flashlight."],
"WAKE_LOCK": ["normal", "prevent phone from sleeping",
"Allows an application to prevent the phone from going to sleep."],
# AUDIO_SETTINGS
"MODIFY_AUDIO_SETTINGS": ["normal", "change your audio settings",
"Allows application to modify global audio settings, such as volume and routing."],
# HARDWARE_CONTROLS
"MANAGE_USB": ["signatureOrSystem", "manage preferences and permissions for USB devices",
"Allows an application to manage preferences and permissions for USB devices"],
"ACCESS_MTP": ["signatureOrSystem", "access the MTP USB kernel driver",
"Allows an application to access the MTP USB kernel driver. For use only by the device side MTP implementation."],
"HARDWARE_TEST": ["signature", "test hardware",
"Allows the application to control various peripherals for the purpose of hardware testing."],
# MICROPHONE
"RECORD_AUDIO": ["dangerous", "record audio", "Allows application to access the audio record path."],
# CAMERA
"CAMERA": ["dangerous", "take pictures and videos",
"Allows application to take pictures and videos with the camera. This allows the application to collect images that the camera is seeing at any time."],
# PHONE_CALLS
"PROCESS_OUTGOING_CALLS": ["dangerous", "intercept outgoing calls",
"Allows application to process outgoing calls and change the number to be dialled. Malicious applications may monitor, redirect or prevent outgoing calls."],
"MODIFY_PHONE_STATE": ["signatureOrSystem", "modify phone status",
"Allows modification of the telephony state - power on, mmi, etc. Does not include placing calls."],
"READ_PHONE_STATE": ["dangerous", "read phone state and identity",
"Allows the application to access the phone features of the device. An application with this permission can determine the phone number and serial number of this phone, whether a call is active, the number that call is connected to and so on."],
"READ_PRIVILEGED_PHONE_STATE": ["signatureOrSystem", "read access to privileged phone state",
"Allows read access to privileged phone state."],
"CALL_PHONE": ["dangerous", "directly call phone numbers",
"Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed. "],
"USE_SIP": ["dangerous", "make/receive Internet calls",
"Allows an application to use the SIP service to make/receive Internet calls."],
# STORAGE
"WRITE_EXTERNAL_STORAGE": ["dangerous", "modify/delete SD card contents",
"Allows an application to write to the SD card."],
"WRITE_MEDIA_STORAGE": ["signatureOrSystem", "write to internal media storage",
"Allows an application to write to internal media storage"],
# SCREENLOCK
"DISABLE_KEYGUARD": ["dangerous", "disable key lock",
"Allows an application to disable the key lock and any associated password security. A legitimate example of this is the phone disabling the key lock when receiving an incoming phone call, then re-enabling the key lock when the call is finished."],
# APP_INFO
"GET_TASKS": ["dangerous", "retrieve running applications",
"Allows application to retrieve information about currently and recently running tasks. May allow malicious applications to discover private information about other applications."],
"REORDER_TASKS": ["normal", "reorder applications running",
"Allows an application to move tasks to the foreground and background. Malicious applications can force themselves to the front without your control."],
"REMOVE_TASKS": ["signature", "", "Allows an application to change to remove/kill tasks"],
"RESTART_PACKAGES": ["normal", "kill background processes",
"Allows an application to kill background processes of other applications, even if memory is not low."],
"KILL_BACKGROUND_PROCESSES": ["normal", "kill background processes",
"Allows an application to kill background processes of other applications, even if memory is not low."],
"PERSISTENT_ACTIVITY": ["normal", "make application always run",
"Allows an application to make parts of itself persistent, so that the system can\'t use it for other applications."],
"RECEIVE_BOOT_COMPLETED": ["normal", "automatically start at boot",
"Allows an application to start itself as soon as the system has finished booting. This can make it take longer to start the phone and allow the application to slow down the overall phone by always running."],
# DISPLAY
"SYSTEM_ALERT_WINDOW": ["dangerous", "display system-level alerts",
"Allows an application to show system-alert windows. Malicious applications can take over the entire screen of the phone."],
# WALLPAPER
"SET_WALLPAPER": ["normal", "set wallpaper", "Allows the application to set the system wallpaper."],
"SET_WALLPAPER_HINTS": ["normal", "set wallpaper size hints",
"Allows the application to set the system wallpaper size hints."],
# SYSTEM_CLOCK
"SET_TIME_ZONE": ["normal", "set time zone", "Allows an application to change the phone\'s time zone."],
# STATUS_BAR
"EXPAND_STATUS_BAR": ["normal", "expand/collapse status bar",
"Allows application to expand or collapse the status bar."],
# SYNC_SETTINGS
"READ_SYNC_SETTINGS": ["normal", "read sync settings",
"Allows an application to read the sync settings, such as whether sync is enabled for Contacts."],
"WRITE_SYNC_SETTINGS": ["normal", "write sync settings",
"Allows an application to modify the sync settings, such as whether sync is enabled for Contacts."],
"READ_SYNC_STATS": ["normal", "read sync statistics",
"Allows an application to read the sync stats; e.g. the history of syncs that have occurred."],
# DEVELOPMENT_TOOLS
"WRITE_SECURE_SETTINGS": ["signatureOrSystemOrDevelopment", "modify secure system settings",
"Allows an application to modify the system\'s secure settings data. Not for use by normal applications."],
"DUMP": ["signatureOrSystemOrDevelopment", "retrieve system internal status",
"Allows application to retrieve internal status of the system. Malicious applications may retrieve a wide variety of private and secure information that they should never normally need."],
"READ_LOGS": ["signatureOrSystemOrDevelopment", "read sensitive log data",
"Allows an application to read from the system\'s various log files. This allows it to discover general information about what you are doing with the phone, potentially including personal or private information."],
"SET_DEBUG_APP": ["signatureOrSystemOrDevelopment", "enable application debugging",
"Allows an application to turn on debugging for another application. Malicious applications can use this to kill other applications."],
"SET_PROCESS_LIMIT": ["signatureOrSystemOrDevelopment", "limit number of running processes",
"Allows an application to control the maximum number of processes that will run. Never needed for normal applications."],
"SET_ALWAYS_FINISH": ["signatureOrSystemOrDevelopment", "make all background applications close",
"Allows an application to control whether activities are always finished as soon as they go to the background. Never needed for normal applications."],
"SIGNAL_PERSISTENT_PROCESSES": ["signatureOrSystemOrDevelopment", "send Linux signals to applications",
"Allows application to request that the supplied signal be sent to all persistent processes."],
"ACCESS_ALL_EXTERNAL_STORAGE": ["signature", "",
"Allows an application to access all multi-user external storage"],
# No groups ...
"SET_TIME": ["signatureOrSystem", "set time", "Allows an application to change the phone\'s clock time."],
"ALLOW_ANY_CODEC_FOR_PLAYBACK": ["signatureOrSystem", "",
"Allows an application to use any media decoder when decoding for playback."],
"STATUS_BAR": ["signatureOrSystem", "disable or modify status bar",
"Allows application to disable the status bar or add and remove system icons."],
"STATUS_BAR_SERVICE": ["signature", "status bar", "Allows the application to be the status bar."],
"FORCE_BACK": ["signature", "force application to close",
"Allows an application to force any activity that is in the foreground to close and go back. Should never be needed for normal applications."],
"UPDATE_DEVICE_STATS": ["signatureOrSystem", "modify battery statistics",
"Allows the modification of collected battery statistics. Not for use by normal applications."],
"INTERNAL_SYSTEM_WINDOW": ["signature", "display unauthorised windows",
"Allows the creation of windows that are intended to be used by the internal system user interface. Not for use by normal applications."],
"MANAGE_APP_TOKENS": ["signature", "manage application tokens",
"Allows applications to create and manage their own tokens, bypassing their normal Z-ordering. Should never be needed for normal applications."],
"FREEZE_SCREEN": ["signature", "",
"Allows the application to temporarily freeze the screen for a full-screen transition."],
"INJECT_EVENTS": ["signature", "inject user events",
"Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window. Without this permission, you can only deliver events to windows in your own process. Very few applications should need to use this permission"],
"FILTER_EVENTS": ["signature", "",
"Allows an application to register an input filter which filters the stream of user events (keys, touch, trackball) before they are dispatched to any window"],
"RETRIEVE_WINDOW_INFO": ["signature", "",
"Allows an application to retrieve info for a window from the window manager."],
"TEMPORARY_ENABLE_ACCESSIBILITY": ["signature", "",
"Allows an application to temporary enable accessibility on the device."],
"MAGNIFY_DISPLAY": ["signature", "", "Allows an application to magnify the content of a display."],
"SET_ACTIVITY_WATCHER": ["signature", "monitor and control all application launching",
"Allows an application to monitor and control how the system launches activities. Malicious applications may compromise the system completely. This permission is needed only for development, never for normal phone usage."],
"SHUTDOWN": ["signatureOrSystem", "partial shutdown",
"Puts the activity manager into a shut-down state. Does not perform a complete shut down."],
"STOP_APP_SWITCHES": ["signatureOrSystem", "prevent app switches",
"Prevents the user from switching to another application."],
"READ_INPUT_STATE": ["signature", "record what you type and actions that you take",
"Allows applications to watch the keys that you press even when interacting with another application (such as entering a password). Should never be needed for normal applications."],
"BIND_INPUT_METHOD": ["signature", "bind to an input method",
"Allows the holder to bind to the top-level interface of an input method. Should never be needed for normal applications."],
"BIND_ACCESSIBILITY_SERVICE": ["signature", "",
"Must be required by an android.accessibilityservice.AccessibilityService to ensure that only the system can bind to it. "],
"BIND_TEXT_SERVICE": ["signature", "",
"Must be required by a TextService (e.g. SpellCheckerService) to ensure that only the system can bind to it."],
"BIND_VPN_SERVICE": ["signature", "",
"Must be required by an {@link android.net.VpnService}, to ensure that only the system can bind to it."],
"BIND_WALLPAPER": ["signatureOrSystem", "bind to wallpaper",
"Allows the holder to bind to the top-level interface of wallpaper. Should never be needed for normal applications."],
"BIND_DEVICE_ADMIN": ["signature", "interact with device admin",
"Allows the holder to send intents to a device administrator. Should never be needed for normal applications."],
"SET_ORIENTATION": ["signature", "change screen orientation",
"Allows an application to change the rotation of the screen at any time. Should never be needed for normal applications."],
"SET_POINTER_SPEED": ["signature", "",
"Allows low-level access to setting the pointer speed. Not for use by normal applications. "],
"SET_KEYBOARD_LAYOUT": ["signature", "",
"Allows low-level access to setting the keyboard layout. Not for use by normal applications."],
"INSTALL_PACKAGES": ["signatureOrSystem", "directly install applications",
"Allows an application to install new or updated Android packages. Malicious applications can use this to add new applications with arbitrarily powerful permissions."],
"CLEAR_APP_USER_DATA": ["signature", "delete other applications\' data",
"Allows an application to clear user data."],
"DELETE_CACHE_FILES": ["signatureOrSystem", "delete other applications\' caches",
"Allows an application to delete cache files."],
"DELETE_PACKAGES": ["signatureOrSystem", "delete applications",
"Allows an application to delete Android packages. Malicious applications can use this to delete important applications."],
"MOVE_PACKAGE": ["signatureOrSystem", "Move application resources",
"Allows an application to move application resources from internal to external media and vice versa."],
"CHANGE_COMPONENT_ENABLED_STATE": ["signatureOrSystem", "enable or disable application components",
"Allows an application to change whether or not a component of another application is enabled. Malicious applications can use this to disable important phone capabilities. It is important to be careful with permission, as it is possible to bring application components into an unusable, inconsistent or unstable state."],
"GRANT_REVOKE_PERMISSIONS": ["signature", "", "Allows an application to grant or revoke specific permissions."],
"ACCESS_SURFACE_FLINGER": ["signature", "access SurfaceFlinger",
"Allows application to use SurfaceFlinger low-level features."],
"READ_FRAME_BUFFER": ["signatureOrSystem", "read frame buffer",
"Allows application to read the content of the frame buffer."],
"CONFIGURE_WIFI_DISPLAY": ["signature", "", "Allows an application to configure and connect to Wifi displays"],
"CONTROL_WIFI_DISPLAY": ["signature", "",
"Allows an application to control low-level features of Wifi displays such as opening an RTSP socket. This permission should only be used by the display manager."],
"BRICK": ["signature", "permanently disable phone",
"Allows the application to disable the entire phone permanently. This is very dangerous."],
"REBOOT": ["signatureOrSystem", "force phone reboot", "Allows the application to force the phone to reboot."],
"DEVICE_POWER": ["signature", "turn phone on or off", "Allows the application to turn the phone on or off."],
"NET_TUNNELING": ["signature", "", "Allows low-level access to tun tap driver "],
"FACTORY_TEST": ["signature", "run in factory test mode",
"Run as a low-level manufacturer test, allowing complete access to the phone hardware. Only available when a phone is running in manufacturer test mode."],
"MASTER_CLEAR": ["signatureOrSystem", "reset system to factory defaults",
"Allows an application to completely reset the system to its factory settings, erasing all data, configuration and installed applications."],
"CALL_PRIVILEGED": ["signatureOrSystem", "directly call any phone numbers",
"Allows the application to call any phone number, including emergency numbers, without your intervention. Malicious applications may place unnecessary and illegal calls to emergency services."],
"PERFORM_CDMA_PROVISIONING": ["signatureOrSystem", "directly start CDMA phone setup",
"Allows the application to start CDMA provisioning. Malicious applications may start CDMA provisioning unnecessarily"],
"CONTROL_LOCATION_UPDATES": ["signatureOrSystem", "control location update notifications",
"Allows enabling/disabling location update notifications from the radio. Not for use by normal applications."],
"ACCESS_CHECKIN_PROPERTIES": ["signatureOrSystem", "access check-in properties",
"Allows read/write access to properties uploaded by the check-in service. Not for use by normal applications."],
"PACKAGE_USAGE_STATS": ["signatureOrSystem", "update component usage statistics",
"Allows the modification of collected component usage statistics. Not for use by normal applications."],
"BACKUP": ["signatureOrSystem", "control system back up and restore",
"Allows the application to control the system\'s back-up and restore mechanism. Not for use by normal applications."],
"CONFIRM_FULL_BACKUP": ["signature", "",
"Allows a package to launch the secure full-backup confirmation UI. ONLY the system process may hold this permission."],
"BIND_REMOTEVIEWS": ["signatureOrSystem", "",
"Must be required by a {@link android.widget.RemoteViewsService}, to ensure that only the system can bind to it."],
"ACCESS_CACHE_FILESYSTEM": ["signatureOrSystem", "access the cache file system",
"Allows an application to read and write the cache file system."],
"COPY_PROTECTED_DATA": ["signature",
"Allows to invoke default container service to copy content. Not for use by normal applications.",
"Allows to invoke default container service to copy content. Not for use by normal applications."],
"CRYPT_KEEPER": ["signatureOrSystem", "access to the encryption methods",
"Internal permission protecting access to the encryption methods"],
"READ_NETWORK_USAGE_HISTORY": ["signatureOrSystem",
"read historical network usage for specific networks and applications.",
"Allows an application to read historical network usage for specific networks and applications."],
"MANAGE_NETWORK_POLICY": ["signature", "manage network policies and to define application-specific rules.",
"Allows an application to manage network policies and to define application-specific rules."],
"MODIFY_NETWORK_ACCOUNTING": ["signatureOrSystem", "account its network traffic against other UIDs.",
"Allows an application to account its network traffic against other UIDs."],
"C2D_MESSAGE": ["signature", "C2DM permission.", "C2DM permission."],
"PACKAGE_VERIFICATION_AGENT": ["signatureOrSystem",
"Package verifier needs to have this permission before the PackageManager will trust it to verify packages.",
"Package verifier needs to have this permission before the PackageManager will trust it to verify packages."],
"BIND_PACKAGE_VERIFIER": ["signature", "",
"Must be required by package verifier receiver, to ensure that only the system can interact with it.."],
"SERIAL_PORT": ["signature", "", "Allows applications to access serial ports via the SerialManager."],
"ACCESS_CONTENT_PROVIDERS_EXTERNALLY": ["signature", "",
"Allows the holder to access content providers from outside an ApplicationThread. This permission is enforced by the ActivityManagerService on the corresponding APIs,in particular ActivityManagerService#getContentProviderExternal(String) and ActivityManagerService#removeContentProviderExternal(String)."],
"UPDATE_LOCK": ["signatureOrSystem", "",
"Allows an application to hold an UpdateLock, recommending that a headless OTA reboot " \
"*not* occur while the lock is held"],
"WRITE_GSERVICES": ["signatureOrSystem", "modify the Google services map",
"Allows an application to modify the Google services map. Not for use by normal applications."],
"ACCESS_USB": ["signatureOrSystem", "access USB devices", "Allows the application to access USB devices."],
},
"MANIFEST_PERMISSION_GROUP":
{
"ACCOUNTS": "Permissions for direct access to the accounts managed by the Account Manager.",
"AFFECTS_BATTERY": "Used for permissions that provide direct access to the hardware on the device that has an effect on battery life. This includes vibrator, flashlight, etc.",
"APP_INFO": "Group of permissions that are related to the other applications installed on the system.",
"AUDIO_SETTINGS": "Used for permissions that provide direct access to speaker settings the device.",
"BLUETOOTH_NETWORK": "Used for permissions that provide access to other devices through Bluetooth.",
"BOOKMARKS": "Used for permissions that provide access to the user bookmarks and browser history.",
"CALENDAR": "Used for permissions that provide access to the device calendar to create / view events",
"CAMERA": "Used for permissions that are associated with accessing camera or capturing images/video from the device.",
"COST_MONEY": "Used for permissions that can be used to make the user spend money without their direct involvement.",
"DEVICE_ALARMS": "Used for permissions that provide access to the user voicemail box.",
"DEVELOPMENT_TOOLS": "Group of permissions that are related to development features.",
"DISPLAY": "Group of permissions that allow manipulation of how another application displays UI to the user.",
"HARDWARE_CONTROLS": "Used for permissions that provide direct access to the hardware on the device.",
"LOCATION": "Used for permissions that allow access to the user's current location.",
"MESSAGES": "Used for permissions that allow an application to send messages on behalf of the user or intercept messages being received by the user.",
"MICROPHONE": "Used for permissions that are associated with accessing microphone audio from the device. Note that phone calls also capture audio but are in a separate (more visible) permission group.",
"NETWORK": "Used for permissions that provide access to networking services.",
"PERSONAL_INFO": "Used for permissions that provide access to the user's private data, such as contacts, calendar events, e-mail messages, etc.",
"PHONE_CALLS": "Used for permissions that are associated with accessing and modifyign telephony state: intercepting outgoing calls, reading and modifying the phone state.",
"STORAGE": "Group of permissions that are related to SD card access.",
"SOCIAL_INFO": "Used for permissions that provide access to the user's social connections, such as contacts, call logs, social stream, etc. This includes both reading and writing of this data (which should generally be expressed as two distinct permissions)",
"SCREENLOCK": "Group of permissions that are related to the screenlock.",
"STATUS_BAR": "Used for permissions that change the status bar.",
"SYSTEM_CLOCK": "Group of permissions that are related to system clock.",
"SYSTEM_TOOLS": "Group of permissions that are related to system APIs.",
"SYNC_SETTINGS": "Used for permissions that access the sync settings or sync related information.",
"USER_DICTIONARY": "Used for permissions that provide access to the user calendar to create / view events.",
"VOICEMAIL": "Used for permissions that provide access to the user voicemail box.",
"WALLPAPER": "Group of permissions that allow manipulation of how another application displays UI to the user.",
"WRITE_USER_DICTIONARY": "Used for permissions that provide access to the user calendar to create / view events.",
},
}

View File

@ -14,6 +14,7 @@ from .TextDecorators import *
from .ViewMode import *
from .cemu import *
from . import TextSelection
import os
class HexViewMode(ViewMode):
def __init__(self, themes, width, height, data, cursor, widget=None):
@ -998,9 +999,8 @@ class Annotation(QtWidgets.QDialog):
self.view = view
self.oshow = super(Annotation, self).show
import os
root = os.path.dirname(sys.argv[0])
self.ui = loadUi(os.path.join(CONF['data_prefix'], 'annotation.ui'), baseinstance=self)
root = os.path.dirname(os.path.realpath(__file__))
self.ui = loadUi(os.path.join(root, 'annotation.ui'), baseinstance=self)
# self.ei = ImportsEventFilter(plugin, self.ui.treeWidgetImports)

View File

@ -16,9 +16,8 @@ class SearchWindow(QtWidgets.QDialog):
self.plugin = plugin
self.oshow = super(SearchWindow, self).show
root = os.path.dirname(sys.argv[0])
self.ui = loadUi(os.path.join(CONF['data_prefix'], 'search.ui'), baseinstance=self)
root = os.path.dirname(os.path.realpath(__file__))
self.ui = loadUi(os.path.join(root, 'search.ui'), baseinstance=self)
self.ui.setWindowTitle('Search')
self._lastText = ''

View File

@ -13,6 +13,7 @@ from androguard.gui.resourceswindow import ResourcesWindow
from androguard.gui.sourcewindow import SourceWindow
from androguard.gui.stringswindow import StringsWindow
from androguard.gui.treewindow import TreeWindow
import os
import logging
log = logging.getLogger("androguard.gui")
@ -121,6 +122,9 @@ class MainWindow(QtWidgets.QMainWindow):
if input_file:
self._openFile(input_file)
root = os.path.dirname(os.path.realpath(__file__))
self.setWindowIcon(QtGui.QIcon(os.path.join(root, "androguard.ico")))
def eventFilter(self, watched, event):
for bin_window in list(self.bin_windows.values()):
bin_window.eventFilter(watched, event)

View File

@ -34,7 +34,6 @@ if __name__ == '__main__':
sys.setrecursionlimit(50000)
app = QtWidgets.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon(os.path.join(androconf.CONF['data_prefix'], "androguard.ico")))
window = MainWindow(input_file=args.input_file,
input_plugin=args.input_plugin)

160
axplorer_to_androguard.py Normal file
View File

@ -0,0 +1,160 @@
# Convert the Mappings from axplorer to JSON and convert to the format androguard uses.
# FIXME, we need to remove that from here, so we can generate them on install time
from androguard.core.bytecodes.dvm import TYPE_DESCRIPTOR
import os
import sys
import re
from collections import defaultdict
from pprint import pprint
import json
import datetime
from lxml import etree
import time
# Create a reverse mapping of the TYPE_DESCRIPTORS
R_TYPE_DESCRIPTOR = {v: k for k, v in TYPE_DESCRIPTOR.items()}
def name_to_androguard(n):
"""
Convert a object or primitive name into androguard syntax
For example:
byte --> B
foo.bar.bla --> Lfoo/bar/bla;
[int --> [I
There is also a special case, where some arrays are specified differently:
B[] --> [B
foo.bar.bla[] --> [Lfoo/bar/bla;
:param n:
:return:
"""
if n == "":
return ""
is_array = ""
# FIXME what about n-dimensional arrays?
if n.startswith("["):
is_array = "["
n = n[1:]
elif n.endswith("[]"):
# Another special array type...
# Probably a bug? See
if n[:-2] in TYPE_DESCRIPTOR:
return "[{}".format(n[0])
else:
n = n[:-2]
is_array = "["
if n in R_TYPE_DESCRIPTOR:
return "{}{}".format(is_array, R_TYPE_DESCRIPTOR[n])
else:
# assume class
return "{}L{};".format(is_array, n.replace(".", "/"))
def convert_name(s):
"""
Converts a line of axplorer format into androguard method signature + permission
:param s:
:return:
"""
m = re.compile(r"^(.*)\.(.*)\((.*)\)(.*) :: (.*)$")
res = m.search(s)
if res:
clname, methodname, all_args, ret, perm = res.groups()
args = " ".join(map(name_to_androguard, all_args.split(",")))
clname = name_to_androguard(clname)
ret = name_to_androguard(ret)
# perm is actually a comma separated list of permissions
return "{}-{}-({}){}".format(clname, methodname, args, ret), perm.split(", ")
else:
raise ValueError("what?")
def generate_mappings(axplorerdir="libraries/axplorer", outfolder="androguard/core/api_specific_resources"):
"""
Generate the permission mappings from a axplorer root dir into a given folder.
For each API Level, separate json file will be created.
:param axplorerdir: path to the axplorer dir
:param outfolder: path to the folder where the resulting json files are put
"""
res = dict()
for root, dirs, files in os.walk(os.path.join(axplorerdir, "permissions")):
for fi in files:
if fi.startswith("cp-map-"):
# We currently do not parse those files
print("ignored {}".format(fi))
continue
elif fi.startswith("framework-map-") or fi.startswith("sdk-map-"):
sdk_version = fi.rsplit("-", 1)[1][:-4]
print("Found file:", fi, "for API level:", sdk_version)
if sdk_version not in res:
res[sdk_version] = defaultdict(list)
with open(os.path.join(root, fi), "r") as f:
for line in f.read().splitlines():
meth, perm = convert_name(line)
for p in perm:
res[sdk_version][meth].append(p)
for api, v in res.items():
with open(os.path.join(outfolder, "api_permission_mappings", "permissions_{}.json".format(api)), "w") as fp:
json.dump(v, fp, indent=" ")
# Next, we generate the permission lists, based on the AndroidManifest.xml files.
# Thise files typically reside in the platform_framework_base repository
# in the folder "master/core/res/". This AndroidManifest.xml file contains
# all the permissions that are defined by the android system.
# Of course, there are even more files (platform packages)
# but the question is always, if these should be put into this list as well...
# In this case, we collect all permissions that are extracted by axplorer as well.
res = defaultdict(dict)
XMLNS = '{http://schemas.android.com/apk/res/android}'
re_api = re.compile(r".*manifests[\\/]api-([0-9]+)")
for root, dirs, files in os.walk(os.path.join(axplorerdir, "manifests")):
for fi in files:
reres = re_api.match(root)
if not reres:
continue
api = int(reres[1])
p = os.path.join(root, fi)
with open(p, "rb") as f:
tree = etree.XML(f.read())
matches = tree.xpath('permission')
def _get_attrib(elem, attr):
if XMLNS + attr in elem.attrib:
return elem.attrib[XMLNS + attr]
else:
return ""
for match in matches:
name = match.attrib[XMLNS + "name"]
d = dict(permissionGroup=_get_attrib(match, "permissionGroup"),
description=_get_attrib(match, "description"),
protectionLevel=_get_attrib(match, "protectionLevel"),
label=_get_attrib(match, "label"))
if name in res[api]:
print("Potential collision of permission in api {}: {}".format(api, name))
res[api][name] = d
for api, v in res.items():
print("Permissions for API: {}, found {} permissions".format(api, len(v)))
with open(os.path.join(outfolder, "aosp_permissions", "permissions_{}.json".format(api)), "w") as fp:
json.dump(v, fp, indent=" ")
if __name__ == "__main__":
if not os.path.isfile(os.path.join("libraries/axplorer", "README.md")):
print("It does not look like the axplorer repo is checked out!", file=sys.stderr)
sys.exit(1)
generate_mappings()

1
libraries/README.md Normal file
View File

@ -0,0 +1 @@
This folder contains external libraries used within Androguard.

1
libraries/axplorer Submodule

@ -0,0 +1 @@
Subproject commit e36ce54d6f9cd3604306f55e8d0d91e0c419ca2f

View File

@ -6,6 +6,7 @@ from androguard import __version__
from setuptools import setup, find_packages
# We do not support python versions <2.7 and python <3.3
if (sys.version_info.major == 3 and sys.version_info.minor < 3) or (sys.version_info.major == 2 and sys.version_info.minor < 7):
print("Unfortunatly, your python version is not supported!\n"
@ -16,14 +17,6 @@ if (sys.version_info.major == 3 and sys.version_info.minor < 3) or (sys.version_
if sys.version_info <= (3, 4) or sys.version_info >= (3, 7):
print("PyQT5 is probably not available for your system, the GUI might not work!", file=sys.stderr)
# workaround issue on OSX, where sys.prefix is not an installable location
if sys.platform == 'darwin' and sys.prefix.startswith('/System'):
data_prefix = os.path.join('.', 'share', 'androguard')
elif sys.platform == 'win32':
data_prefix = os.path.join(sys.prefix, 'Scripts', 'androguard')
else:
data_prefix = os.path.join(sys.prefix, 'share', 'androguard')
# There is a bug in pyasn1 0.3.1, 0.3.2 and 0.3.3, so do not use them!
install_requires = ['pyasn1!=0.3.1,!=0.3.2,!=0.3.3,!=0.4.1',
'future',
@ -52,22 +45,30 @@ else:
install_requires.append('cryptography>=1.0')
sphinxprogram = "sphinxcontrib-programoutput>0.8"
# TODO add the permission mapping generation at a better place!
# from axplorer_to_androguard import generate_mappings
# generate_mappings()
setup(
name='androguard',
description='Androguard is a full python tool to play with Android files.',
version=__version__,
packages=find_packages(),
data_files=[(data_prefix,
['androguard/gui/annotation.ui',
'androguard/gui/search.ui',
'androguard/gui/androguard.ico'])],
package_data={
# add the json files, residing in the api_specific_resources package
"androguard.core.api_specific_resources": ["aosp_permissions/*.json",
"api_permission_mappings/*.json"],
# Collect also the GUI files this way
"androguard.gui": ["annotation.ui", "search.ui", "androguard.ico"],
},
scripts=['androaxml.py',
'androarsc.py',
'androauto.py',
'androdis.py',
'androlyze.py',
'androdd.py',
'androgui.py',],
'androgui.py',
],
install_requires=install_requires,
extras_require={
'GUI': ["pyperclip", "PyQt5"],