Oleksandr S. Bauzha

16 papers A 2B 1Misc 2Unranked 11
YearRankTypeTitle / Venue / Authors
2023 conf
IntelITSIS
Taras Chaikivskyi, Bohdan Sus, Sergiy P. Zagorodnyuk, Oleksandr S. Bauzha
2023 conf
IT&I Workshops
Oleksandr S. Bauzha, Artem Kramov, Oleksandr Yavorskyi
2023 A conf
ICST
Bohdan Sus, Oleksandr S. Bauzha, Sergiy P. Zagorodnyuk, Valentyna Maliarenko
2023 conf
CS&SE@SW
Bogdan B. Sus, Oleksandr S. Bauzha, Sergiy P. Zagorodnyuk, Taras Chaikivskyi, Oleksandr V. Hryshchuk
2022 Misc conf
CSIT
Taras Chaikivskyi, Bogdan B. Sus, Sergiy P. Zagorodnyuk, Oleksandr S. Bauzha, Viktor Reutskyy
2022 conf
COLINS
Taras Chaikivskyi, Bohdan Sus, Sergey Zagorodnyuk, Oleksandr S. Bauzha
2022 conf
MoMLeT+DS
Oleksandr S. Bauzha, Taras Chaikivskyi, Valentyna Maliarenko, Bohdan Sus, Sergiy P. Zagorodnyuk
2021 conf
IT&I
Sergiy P. Zagorodnyuk, Bohdan Sus, Oleksandr S. Bauzha, Taras Chaikivskyi
2021 conf
CSIT (1)
Taras Chaikivskyi, Valentyna Maliarenko, Bogdan Sus, Oleksandr S. Bauzha, Sergiy P. Zagorodnyuk, Viktor Reutskyy
2020 A conf
ICST
Bohdan Sus, Nataliia Tmienova, Ilona Revenchuk, Oleksandr S. Bauzha, Sergii G. Stirenko
2020 Misc conf
CSIT
Taras Chaikivskyi, Bohdan Sus, Oleksandr S. Bauzha, Sergiy P. Zagorodnyuk
2020 conf
CMIS
Taras Chaikivskyi, Bogdan B. Sus, Oleksandr S. Bauzha, Sergiy P. Zagorodnyuk
2020 B conf
ITS
Sergiy P. Zagorodnyuk, Bohdan Sus, Oleksandr S. Bauzha
2020 conf
CSIT (1)
Bohdan Sus, Ilona Revenchuk, Nataliia Tmienova, Oleksandr S. Bauzha, Taras Chaikivskyi
2020 conf
IT&I
Ilona Revenchuk, Bohdan Sus, Oleksandr S. Bauzha, Sergiy P. Zagorodnyuk
2019 conf
DCSMart
Taras Chaikivskyi, Oleksandr S. Bauzha, Bogdan B. Sus, Nataliia Tmienova, Sergiy P. Zagorodnyuk
redb/extractors/apk_extractor.py
← Index redb/extractors/apk_extractor.py python
import logging
import zipfile
from abc import ABCMeta, abstractmethod

from redb.extractors.extractor import Extractor

logger = logging.getLogger(__name__)


@abstractmethod
class APKExtractor(Extractor, metaclass=ABCMeta):

    def __init__(
        self,
        filepath,
        log,
        exporters=None,
        index_prefix=None,
        known_benign=False,
        known_malicious=False,
        apk=None,
    ):
        # Read binary data before calling super().__init__ so that the
        # binary property override is available during hash computation.
        with open(filepath, "rb") as f:
            self._binary_data = f.read()

        self.apk = apk if apk else self._generate_apk_object(filepath)

        super().__init__(
            filepath,
            log,
            exporters,
            index_prefix,
            known_benign=known_benign,
            known_malicious=known_malicious,
        )

    @property
    def binary(self):
        """Override to use already-read binary data."""
        return self._binary_data

    def _generate_apk_object(self, filepath):
        """Parse APK using androguard."""
        apk = None
        try:
            # Suppress verbose androguard loguru DEBUG/INFO output
            from loguru import logger as loguru_logger
            loguru_logger.disable("androguard")
            from androguard.core.apk import APK
            apk = APK(filepath)
            if not apk.is_valid_APK():
                logger.warning(
                    f"APK validation warning for {filepath}"
                )
                # Still return the object — partial parsing may still work
        except Exception as e:
            logger.error(
                f"Format error parsing APK {filepath}: {e}"
            )
        return apk

    def _is_valid_apk(self):
        """Check if the APK object was parsed successfully."""
        return self.apk is not None

    def _get_zip_file(self):
        """Get a zipfile.ZipFile handle for direct archive inspection."""
        try:
            return zipfile.ZipFile(self.filepath, 'r')
        except (zipfile.BadZipFile, Exception) as e:
            self.log.error(f"Failed to open APK as ZIP: {e}")
            return None

    def _list_files(self):
        """List all files in the APK archive."""
        if not self._is_valid_apk():
            return []
        try:
            return self.apk.get_files()
        except Exception as e:
            self.log.error(f"Error listing APK files: {e}")
            return []