Rachid Fahmi

19 papers A 1B 4Misc 1Journal 1Unranked 12
YearRankTypeTitle / Venue / Authors
2016 B conf
Image Processing
Jacob Levi, Rachid Fahmi, Brendan L. Eck, Anas Fares, Hao Wu, Mani Vembar, Amar Dhanantwari, Hiram G. Bezerra, David L. Wilson
2016 conf
Biomedical Applications in Molecular, Structural, and Functional Imaging
Brendan L. Eck, Rachid Fahmi, Jacob Levi, Anas Fares, Hao Wu, Yuemeng Li, Mani Vembar, Amar Dhanantwari, Hiram G. Bezerra, David L. Wilson
2016 conf
Biomedical Applications in Molecular, Structural, and Functional Imaging
Rachid Fahmi, Brendan L. Eck, Jacob Levi, Anas Fares, Hao Wu, Mani Vembar, Amar Dhanantwari, Hiram G. Bezerra, David L. Wilson
2015 conf
Biomedical Applications in Molecular, Structural, and Functional Imaging
Rachid Fahmi, Brendan L. Eck, Anas Fares, Jacob Levi, Hao Wu, Mani Vembar, Amar Dhanantwari, Hiram G. Bezerra, David L. Wilson
2015 conf
Biomedical Applications in Molecular, Structural, and Functional Imaging
Brendan L. Eck, Rachid Fahmi, Christopher Fuqua, Mani Vembar, Amar Dhanantwari, Hiram G. Bezerra, David L. Wilson
2010 Misc conf
ICASSP
Melih S. Aslan, Asem M. Ali, Ham M. Rara, Ben Arnold, Rachid Fahmi, Aly A. Farag, Ping Xiang
2009 conf
ISVC (2)
Melih S. Aslan, Asem M. Ali, Ham M. Rara, Ben Arnold, Aly A. Farag, Rachid Fahmi, Ping Xiang
2009 conf
ISBI
Dongqing Chen, Rachid Fahmi, Aly A. Farag, Robert Falk, Gerald W. Dryden
2009 B conf
ICIP
Melih S. Aslan, Asem M. Ali, Ben Arnold, Rachid Fahmi, Aly A. Farag, Ping Xiang
2008 conf
ISVC (2)
Rachid Fahmi, Aly A. Farag
2008 B conf
ICIP
Rachid Fahmi, Aly A. Farag
2008 B conf
Image Processing
Rachid Fahmi, Anna K. Jerebko, Matthias Wolf, Aly A. Farag
2008 J jnl
IEEE Trans. Biomed. Eng.
Hongjian Shi, Aly A. Farag, Rachid Fahmi, Dongqing Chen
2007 conf
ICIP (6)
Rachid Fahmi, Aly A. Farag
2007 conf
ISBI
Rachid Fahmi, Ayman El-Baz, Hossam El Din Hassan Abd El Munim, Aly A. Farag, Manuel Casanova
2006 conf
MICCAI (2)
Ayman El-Baz, Rachid Fahmi, Seniha Esen Yüksel, Aly A. Farag, William Miller, Mohamed Abou El-Ghar, Tarek Eldiasty
2006 conf
ICPR (3)
Ayman El-Baz, Aly A. Farag, Rachid Fahmi, Seniha Esen Yüksel, Mohamed Abou El-Ghar, Tarek Eldiasty
2006 conf
EMBC
Rachid Fahmi, Aly A. Farag, Ayman El-Baz
2005 A conf
MICCAI
Hongjian Shi, Rachid Fahmi, Aly A. Farag
redb/extractors/decompiler/apk/library_filter.py
← Index redb/extractors/decompiler/apk/library_filter.py python
"""Package-based library filtering for APK DEX code analysis.

Determines whether a method belongs to a known library/framework package
and should be filtered out of content tables. This is the Android equivalent
of is_lib_or_thunk() in the Binary Ninja pipeline.
"""

import os
from typing import Dict, List


DEFAULT_LIBRARY_PREFIXES = [
    "android.",
    "androidx.",
    "com.google.android.",
    "com.google.firebase.",
    "com.google.gson.",
    "com.google.protobuf.",
    "kotlin.",
    "kotlinx.",
    "org.apache.",
    "com.squareup.",
    "io.reactivex.",
    "org.reactivestreams.",
    "com.facebook.",
    "com.crashlytics.",
    "io.fabric.",
    "org.junit.",
    "org.mockito.",
]


class LibraryFilter:
    """Filters library/framework classes from APK analysis."""

    def __init__(self, prefixes: List[str] = None):
        env_prefixes = os.getenv("APK_LIBRARY_PREFIXES")
        if env_prefixes:
            self._prefixes = [p.strip() for p in env_prefixes.split(",") if p.strip()]
        elif prefixes is not None:
            self._prefixes = prefixes
        else:
            self._prefixes = DEFAULT_LIBRARY_PREFIXES

        # Convert Dalvik-style prefixes to both formats for matching
        self._dot_prefixes = tuple(self._prefixes)

        self._stats = {"library": 0, "user": 0}

    def is_library(self, class_name: str) -> bool:
        """Check if a class belongs to a known library/framework package.

        Accepts both Java dot notation (com.example.Foo) and Dalvik
        descriptor notation (Lcom/example/Foo;).
        """
        # Normalize Dalvik descriptor to dot notation
        normalized = self._normalize_class_name(class_name)

        is_lib = normalized.startswith(self._dot_prefixes)
        if is_lib:
            self._stats["library"] += 1
        else:
            self._stats["user"] += 1
        return is_lib

    def get_filter_stats(self) -> Dict[str, int]:
        """Return counts of filtered vs. retained classes."""
        return dict(self._stats)

    @staticmethod
    def _normalize_class_name(class_name: str) -> str:
        """Convert Dalvik descriptor to dot notation.

        Lcom/example/Foo; -> com.example.Foo
        com.example.Foo -> com.example.Foo
        """
        if class_name.startswith("L") and class_name.endswith(";"):
            return class_name[1:-1].replace("/", ".")
        return class_name.replace("/", ".")