WithSecureLabs/drozer

Unbreak `PackageManagerProxy.installedPackages()`

cyberMilosz opened this issue · 1 comments

At some point, installedPackages() got modified from

def installedPackages(self, flags=0):
"""
Get all installed packages, as a Java List<>.
"""
return self.__package_manager.getInstalledPackages(flags)

to

def installedPackages(self, flags=0):
"""
Get all installed packages, as a Java List<>.
"""
return self.__package_manager.getInstalledPackages(self.__package_manager.GET_META_DATA)

This means that every time we call getPackages() with flags other than GET_META_DATA, those flags get ignored. This is very bad, because a fair few modules request these flags. This immediately breaks at least 2 modules:

  • app.provider.info (when run without specifying a single package - either on all packages or with a filter)
  • auxiliary.webcontentresolver (when trying to generate a list of providers)

It is highly likely that it also broke other modules, and that workarounds may have been implemented to work around it.

What needs to happen:

  • Undo that change so we start using flags again
  • All modules using getPackages() need to get tested for regression
    • Chances are that the ones which specified flags will still be fine (or happier than they were before), but we should review them
    • There are only 3 places that don't specify flags
    • Probably worth diffing these against drozer 2 to pick up any unnecessary workarounds

Fixed in linked branch - pending regression testing