Irene Y. H. Gu

64 papers A* 1A 7B 15C 3Misc 10Journal 10Unranked 18
YearRankTypeTitle / Venue / Authors
2017 conf
ISGT Europe
Azam Bagheri, Math H. J. Bollen, Irene Y. H. Gu
2016 B conf
Intelligent Vehicles Symposium
Keren Fu, Irene Y. H. Gu, Anders C. E. Ödblom, Feng Liu
2016 Misc conf
ICASSP
Keren Fu, Irene Y. H. Gu, Jie Yang
2016 J jnl
Neurocomputing
Keren Fu, Irene Y. H. Gu, Chen Gong, Jie Yang
2016 Misc conf
ICASSP
Fanghui Liu, Tao Zhou, Keren Fu, Irene Y. H. Gu, Jie Yang
2015 conf
ISBI
Mohammad Alipoor, Irene Y. H. Gu
2015 conf
ISBI
Mohammad Alipoor, Irene Y. H. Gu
2015 B conf
ICIP
Keren Fu, Chen Gong, Irene Y. H. Gu, Jie Yang, Pengfei Shi
2015 B conf
Intelligent Vehicles Symposium
Keren Fu, Irene Y. H. Gu, Anders C. E. Ödblom
2015 conf
ICCV Workshops
Fanghui Liu, Tao Zhou, Jie Yang, Irene Y. H. Gu
2015 J jnl
CoRR
Fanghui Liu, Tao Zhou, Irene Y. H. Gu, Jie Yang
2014 conf
ICCVE
Keren Fu, Irene Y. H. Gu, Anders C. E. Ödblom
2014 Misc conf
ICASSP
Keren Fu, Kai Xie, Chen Gong, Irene Y. H. Gu, Jie Yang
2014 B conf
ICPR
Keren Fu, Irene Y. H. Gu, Yixiao Yun, Chen Gong, Jie Yang
2014 B conf
ICPR
Jonas Nilsson, Patrik Andersson, Irene Y. H. Gu, Jonas Fredriksson
2014 A conf
ICME
Keren Fu, Chen Gong, Irene Y. H. Gu, Jie Yang, Xiangjian He
2013 B conf
ICIP
Keren Fu, Chen Gong, Irene Y. H. Gu, Jie Yang
2013 conf
EMBC
Mohammad Alipoor, Irene Y. H. Gu, Andrew J. H. Mehnert, Ylva Lilja, Daniel Nilsson
2012 B conf
ICPR
Irene Y. H. Gu, Zulfiqar Hassan Khan
2012 B conf
ICPR
Mohamed H. Changrampadi, Yixiao Yun, Irene Y. H. Gu
2012 Misc conf
ICASSP
Yixiao Yun, Irene Y. H. Gu
2011 conf
ISGT Europe
Irene Y. H. Gu, Math H. J. Bollen, Cuong D. Le
2009 A conf
ICME
Tiesheng Wang, Irene Y. H. Gu, Zulfiqar Hassan Khan, Pengfei Shi
2009 J jnl
IEEE Signal Process. Mag.
Math H. J. Bollen, Irene Y. H. Gu, Surya Santoso, Mark F. McGranaghan, Peter A. Crossley, Moisés Vidal Ribeiro, Paulo Fernando Ribeiro
2009 C conf
CAIP
Irene Y. H. Gu, Unai Sistiaga, Sonja M. Berlijn, Anders Fahlström
2009 conf
SCIA
Petter Strandmark, Irene Y. H. Gu
2009 A conf
ICME
Zulfiqar Hassan Khan, Irene Y. H. Gu, Tiesheng Wang, Andrew G. Backhouse
2009 B conf
ICIP
Zulfiqar Hassan Khan, Irene Y. H. Gu, Andrew G. Backhouse
2009 B conf
ICIP
Irene Y. H. Gu, Unai Sistiaga, Sonja M. Berlijn, Anders Fahlström
2009 Misc conf
ICASSP
Irene Y. H. Gu, Martin Billeter, Mohammad Reza Sharafy, Vahid A. Sorkhabi, Jonas Fredriksson, Doroteya K. Staykova
2008 J jnl
IEEE Trans. Syst. Man Cybern. Part B
Liyuan Li, Weimin Huang, Irene Y. H. Gu, Ruijiang Luo, Qi Tian
2008 Misc conf
ICCVG
Irene Y. H. Gu, Henrik Andersson, Raúl Vicen
2008 Misc conf
ICCVG
Irene Y. H. Gu, Unai Sistiaga, Sonja M. Berlijn, Anders Fahlström
2008 B conf
ICIP
Tiesheng Wang, Irene Y. H. Gu, Andrew G. Backhouse, Pengfei Shi
2008 Misc conf
ICASSP
Tiesheng Wang, Andrew G. Backhouse, Irene Y. H. Gu
2007 J jnl
EURASIP J. Adv. Signal Process.
Math H. J. Bollen, Irene Y. H. Gu, Peter G. V. Axelberg, Emmanouil Styvaktakis
2007 conf
PCM
Ruijiang Luo, Liyuan Li, Irene Y. H. Gu
2007 J jnl
EURASIP J. Adv. Signal Process.
Moisés Vidal Ribeiro, Jacques Szczupak, M. Reza Iravani, Irene Y. H. Gu, Pradipta Kishore Dash, Alexander V. Mamishev
2007 conf
ICIP (4)
Andy Backhouse, Irene Y. H. Gu, Tiesheng Wang
2007 A conf
ICME
Tiesheng Wang, Irene Y. H. Gu, Andrew G. Backhouse, Pengfei Shi
2007 conf
ICASSP (1)
Tiesheng Wang, Irene Y. H. Gu, Pengfei Shi
2007 J jnl
EURASIP J. Adv. Signal Process.
Kyeon Hur, Surya Santoso, Irene Y. H. Gu
2007 conf
EUSIPCO
Tiesheng Wang, Irene Y. H. Gu, Mats Viberg, Zhongping Cao, Nuan Song
2006 conf
ICASSP (2)
Shuo Feng, Hamid Krim, Irene Y. H. Gu, Mats Viberg
2006 conf
PCM
Zhifei Xu, Pengfei Shi, Irene Y. H. Gu
2006 J jnl
Multim. Syst.
Andrew G. Backhouse, Irene Y. H. Gu
2006 conf
EUSIPCO
Nuan Song, Irene Y. H. Gu, Zhongping Cao, Mats Viberg
2006 A conf
ICME
Anders Gunnarsson, Irene Y. H. Gu
2006 B conf
ICIP
Kristof Op De Beeck, Irene Y. H. Gu, Liyuan Li, Mats Viberg, Bart De Moor
2006 conf
PCM
Irene Y. H. Gu, Vasile Gui, Zhifei Xu
2005 conf
ICIP (1)
Andrew G. Backhouse, Irene Y. H. Gu
2005 A conf
ICME
Andrew G. Backhouse, Irene Y. H. Gu
2004 conf
ISMSE
Andy Backhouse, Irene Y. H. Gu
2004 J jnl
IEEE Trans. Image Process.
Liyuan Li, Weimin Huang, Irene Y. H. Gu, Qi Tian
2003 B conf
SMC
Andreas Franzen, Irene Y. H. Gu
2003 B conf
SMC
Emmanouil Styvaktakis, Irene Y. H. Gu, Math H. J. Bollen
2003 A* conf
ACM Multimedia
Liyuan Li, Weimin Huang, Irene Y. H. Gu, Qi Tian
2003 C conf
VCIP
Andrew G. Backhouse, Irene Y. H. Gu, Sverrir Olafsson, Mike J. Smith
2003 C conf
VCIP
Tsan Po Siu, Tardi Tjahjadi, Irene Y. H. Gu
2003 B conf
SMC
Liyuan Li, Weimin Huang, Irene Y. H. Gu, Karianto Leman, Qi Tian
2002 A conf
WACV
Liyuan Li, Weimin Huang, Irene Y. H. Gu, Qi Tian
2002 J jnl
IEEE Trans. Syst. Man Cybern. Part B
Irene Y. H. Gu, Tardi Tjahjadi
2001 Misc conf
ICASSP
Irene Y. H. Gu, Vasile Gui
1989 Misc conf
ICASSP
Irene Y. H. Gu
redb/extractors/apk_extractors/apk_permissions.py
← Index redb/extractors/apk_extractors/apk_permissions.py python
import inspect
from datetime import datetime, timezone
from typing import Any

from redb.extractors.enum import Tag
from redb.extractors.apk_extractor import APKExtractor
from redb.models.dataclasses import APKPermissions, APKPermission

# Known dangerous permissions (Android runtime permissions)
DANGEROUS_PERMISSIONS = {
    "android.permission.READ_CALENDAR",
    "android.permission.WRITE_CALENDAR",
    "android.permission.CAMERA",
    "android.permission.READ_CONTACTS",
    "android.permission.WRITE_CONTACTS",
    "android.permission.GET_ACCOUNTS",
    "android.permission.ACCESS_FINE_LOCATION",
    "android.permission.ACCESS_COARSE_LOCATION",
    "android.permission.ACCESS_BACKGROUND_LOCATION",
    "android.permission.RECORD_AUDIO",
    "android.permission.READ_PHONE_STATE",
    "android.permission.READ_PHONE_NUMBERS",
    "android.permission.CALL_PHONE",
    "android.permission.ANSWER_PHONE_CALLS",
    "android.permission.ADD_VOICEMAIL",
    "android.permission.USE_SIP",
    "android.permission.BODY_SENSORS",
    "android.permission.SEND_SMS",
    "android.permission.RECEIVE_SMS",
    "android.permission.READ_SMS",
    "android.permission.RECEIVE_WAP_PUSH",
    "android.permission.RECEIVE_MMS",
    "android.permission.READ_EXTERNAL_STORAGE",
    "android.permission.WRITE_EXTERNAL_STORAGE",
    "android.permission.READ_MEDIA_IMAGES",
    "android.permission.READ_MEDIA_VIDEO",
    "android.permission.READ_MEDIA_AUDIO",
    "android.permission.POST_NOTIFICATIONS",
    "android.permission.NEARBY_WIFI_DEVICES",
    "android.permission.ACTIVITY_RECOGNITION",
    "android.permission.BLUETOOTH_SCAN",
    "android.permission.BLUETOOTH_ADVERTISE",
    "android.permission.BLUETOOTH_CONNECT",
}


class APKPermissionsExtractor(APKExtractor):

    def __init__(
        self, filepath, log, exporters=None, index_prefix=None,
        known_benign=False, known_malicious=False,
        apk=None,
    ):
        super().__init__(
            filepath, log, exporters, index_prefix,
            known_benign, known_malicious, apk,
        )
        self.permissions_data = None
        self.log.debug(inspect.currentframe().f_code.co_name)

    def tag(self):
        return Tag.APK_PERMISSIONS.value

    def _get_protection_level(self, perm_name):
        """Determine the protection level of a permission.

        Uses androguard's permission mappings first, falls back to the
        known dangerous list.
        """
        try:
            from androguard.core.api_specific_resources import load_permission_mappings
            target_sdk = self.apk.get_target_sdk_version()
            sdk = int(target_sdk) if target_sdk else 30
            permission_map = load_permission_mappings(sdk)
            if perm_name in permission_map:
                info = permission_map[perm_name]
                if isinstance(info, dict):
                    return info.get("protectionLevel", "unknown")
                return "unknown"
        except Exception:
            pass

        # Fallback to known dangerous set
        if perm_name in DANGEROUS_PERMISSIONS:
            return "dangerous"
        if perm_name.startswith("android.permission."):
            return "normal"
        return "unknown"

    def _compute_permhash(self):
        """Compute permhash using the permhash library."""
        try:
            from permhash.functions import permhash_apk
            return permhash_apk(self.filepath)
        except Exception as e:
            self.log.warning(f"Failed to compute permhash: {e}")
            return None

    def _safe_extract(self, field_name, func, default=None):
        """Extract a single field, logging and returning default on failure."""
        try:
            return func()
        except Exception as e:
            self.log.warning(
                f"Error extracting APK permissions field '{field_name}' for "
                f"{self.hash.sha256}: {e}"
            )
            return default

    def extract(self):
        if not self._is_valid_apk():
            self.log.error(f"Invalid APK for {self.hash.sha256}")
            return None

        requested_perms = self._safe_extract(
            "requested_permissions",
            lambda: list(self.apk.get_permissions() or []), []
        )
        custom_perms = self._safe_extract(
            "custom_permissions",
            lambda: list(self.apk.get_declared_permissions() or []), []
        )
        custom_perm_set = set(custom_perms)

        permission_details = []
        dangerous_permissions = []

        for perm in requested_perms:
            try:
                protection_level = self._get_protection_level(perm)
                is_custom = perm in custom_perm_set

                permission_details.append(APKPermission(
                    permission_name=perm,
                    protection_level=protection_level,
                    is_custom=is_custom,
                ))

                if protection_level == "dangerous":
                    dangerous_permissions.append(perm)
            except Exception as e:
                self.log.warning(
                    f"Error processing permission '{perm}' for "
                    f"{self.hash.sha256}: {e}"
                )
                permission_details.append(APKPermission(
                    permission_name=perm,
                    protection_level="unknown",
                    is_custom=perm in custom_perm_set,
                ))

        permhash_value = self._compute_permhash()

        self.permissions_data = APKPermissions(
            total_permission_count=len(requested_perms),
            dangerous_permission_count=len(dangerous_permissions),
            permissions=requested_perms,
            dangerous_permissions=dangerous_permissions,
            custom_permissions=custom_perms,
            permission_details=permission_details,
            permhash=permhash_value,
        )
        return self.permissions_data

    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type == "ClickHouseExporter":
            if not self.permissions_data:
                return None

            current_time = datetime.now(timezone.utc)

            # One row per permission
            data = []
            for detail in self.permissions_data.permission_details:
                data.append([
                    self.sha256,
                    detail.permission_name,
                    detail.protection_level,
                    int(detail.is_custom),
                    current_time,
                ])

            if not data:
                return None

            column_names = [
                'sha256', 'permission_name', 'protection_level',
                'is_custom', 'analysis_date',
            ]

            column_type_names = [
                'FixedString(64)', 'String', 'LowCardinality(String)',
                'UInt8', "DateTime64(3, 'UTC')",
            ]

            return (data, column_names, column_type_names)

    def get_clickhouse_table(self) -> str:
        return "redb_apk_permissions"