Exemplo n.º 1
0
    def update_manifest(cls, path_to_manifest):
        """Users of this class should call this method instead of changing class attributes directly"""
        cls.manifest_path = path_to_manifest
        try:
            cls.manifest_xml = minidom.parse(path_to_manifest)
        except Exception:
            # path_to_manifest is None or has bad XML
            cls.manifest_xml = None
            log.debug("Failed to update manifest for file %s", path_to_manifest)
            return

        try:
            cls.min_sdk = get_min_sdk(cls.manifest_path)
            cls.target_sdk = get_target_sdk(cls.manifest_path)
        except AttributeError:
            # manifest path is not set, assume min_sdk and target_sdk
            cls.min_sdk = cls.target_sdk = 1

        try:
            cls.package_name = get_package_from_manifest(cls.manifest_path)
        except IOError:
            cls.package_name = "PACKAGE_NOT_FOUND"
Exemplo n.º 2
0
def test_get_target_sdk(vulnerable_manifest_path):
    assert 15 == get_target_sdk(minidom.parse(vulnerable_manifest_path))