Enumerating services

You may also want to know about the services that are installed on your device. drozer has a module called app.service.info that extracts some useful information about services.

How to do it...

Execute the following command from your drozer console:

dz> run app.service.info –-package [package name]

Running this command with no arguments lists all the services installed on the target device. It will look something like the following screenshot when run:

How to do it...

You can also use the following filters to narrow down your search:

  • Search based on permissions:
    dz> run app.service.info –p [permission label]
    dz> run app.service.info –-permission [permission label]
    
  • Search based on service names:
    dz> run app.service.info –f [Filter string]
    dz> run app.service.info. –filter [filter string]
    
  • You can also choose to list unexported services, such as the following:
    dz> run app.service.info –u
    dz> run app.service.info –-unexported
    
  • And lastly, if you'd like information about the other switches and options, you can always run the –help option as follows:
    dz> run app.service.info –-help
    

    The previous command should produce the output as shown in the following screenshot:

    How to do it...

How it works…

The app.service.info module works like most of the other .info and .list type drozer modules by making calls to the package manager through the API. Here's the call to the package manager from drozer/master/src/drozer/modules/service.py:

def execute(self,arguments):
  if arguments.package == None:
    for package in self.packageManager().getPackageInfo      (common.PackageManager.GET_SERVICES |         common.PackageManager.GET_PERMISSIONS):
      self.__get_servcies(arguments, package)
  else:
    package = self.packageManager().getPackageInfo(arguments.package, common.PackageManager.GET_SERVICES | common.PackageManager.GET_PERMISSIONS)
    self.__get_services(arguments,package)

The script does a check to see whether a specific package was passed as an argument, which is the first piece of code in the execute method:

if arguments.package == None:

If no argument or package name was defined, the script grabs a list of packages and iterates through them by calling the self.__get_services() method, which determines some package properties through string-matching the data returned from the self.packageManager().getPackageInfo(arguments.package,common.PackageManager.GET_SERVICES | common.PackageManager.GET_PERMISSIONS) call; for example, when looking for services with a specified permission, it does the following:

services = self.match_filter(services, "permission", arguments.permission)

This is to extract a list of services with the required permission.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.9.179