Rafael M. O. Cruz

113 papers A* 3A 1B 23Journal 77Unranked 9
YearRankTypeTitle / Venue / Authors
2026 A* conf
AAAI
Mahdi Alehdaghi, Rajarshi Bhattacharya, Pourya Shamsolmoali, Rafael M. O. Cruz, Eric Granger
2026 J jnl
CoRR
Eduardo V. L. Barboza, Jean Paul Barddal, Robert Sabourin, Rafael M. O. Cruz
2026 conf
EACL (Findings)
Lorenzo Puppi Vecchi, Alceu de Souza Britto Jr., Emerson Cabrera Paraiso, Rafael M. O. Cruz
2025 J jnl
IEEE Trans. Inf. Forensics Secur.
Mahdi Alehdaghi, Arthur Josi, Rafael M. O. Cruz, Pourya Shamsolmoali, Eric Granger
2025 J jnl
CoRR
Mahdi Alehdaghi, Rajarshi Bhattacharya, Pourya Shamsolmoali, Rafael M. O. Cruz, Maguelonne Heritier, Eric Granger
2025 A conf
WACV
Mahdi Alehdaghi, Pourya Shamsolmoali, Rafael M. O. Cruz, Eric Granger
2025 A* conf
EMNLP
Faramarz Farhangian, Leandro Augusto Ensina, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
Faramarz Farhangian, Leandro Augusto Ensina, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
Mahdi Alehdaghi, Rajarshi Bhattacharya, Pourya Shamsolmoali, Rafael M. O. Cruz, Eric Granger
2025 J jnl
Int. J. Comput. Vis.
Arthur Josi, Mahdi Alehdaghi, Rafael M. O. Cruz, Eric Granger
2025 B conf
SMC
Sara B. Coutinho, Rafael M. O. Cruz, Francimaria R. S. Nascimento, George D. C. Cavalcanti
2025 J jnl
CoRR
Sara B. Coutinho, Rafael M. O. Cruz, Francimaria R. S. Nascimento, George D. C. Cavalcanti
2025 J jnl
CoRR
Juscimara Gomes Avelino, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
J. V. S. Souza, Caio Barbosa Vieira da Silva, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
Mach. Learn.
Juscimara Gomes Avelino, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
Eduardo V. L. Barboza, Paulo R. Lisboa de Almeida, Alceu de Souza Britto Jr., Robert Sabourin, Rafael M. O. Cruz
2025 J jnl
Inf. Fusion
Eduardo V. L. Barboza, Paulo R. Lisboa de Almeida, Alceu de Souza Britto Junior, Robert Sabourin, Rafael M. O. Cruz
2025 J jnl
IEEE Trans. Neural Networks Learn. Syst.
Lucas B. V. de Amorim, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
Mach. Learn.
Cynthia Moreira Maia, Lucas B. V. de Amorim, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
Ingryd V. S. T. Pereira, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 B conf
IJCNN
Victor Castro Nacif De Faria, Rafael M. O. Cruz, Robert Sabourin, Ana Carolina Lorena
2025 B conf
IJCNN
Cynthia Moreira Maia, Lucas B. V. de Amorim, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
Cynthia Moreira Maia, Lucas B. V. de Amorim, George D. C. Cavalcanti, Rafael M. O. Cruz
2025 J jnl
CoRR
Juscimara Gomes Avelino, George D. C. Cavalcanti, Rafael M. O. Cruz
2024 J jnl
Inf. Fusion
Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti, Rafael M. O. Cruz
2024 J jnl
Inf. Fusion
Reza Davtalab, Rafael M. O. Cruz, Robert Sabourin
2024 J jnl
CoRR
Mahdi Alehdaghi, Pourya Shamsolmoali, Rafael M. O. Cruz, Eric Granger
2024 J jnl
Inf. Fusion
Faramarz Farhangian, Rafael M. O. Cruz, George D. C. Cavalcanti
2024 J jnl
Neural Comput. Appl.
Leandro Augusto Ensina, Luiz Eduardo Soares de Oliveira, Rafael M. O. Cruz, George D. C. Cavalcanti
2024 J jnl
CoRR
Madhu Kiran, Kartikey Vishnu, Rafael M. O. Cruz, Eric Granger
2024 B conf
IJCNN
Hesam Jalalian, Rafael M. O. Cruz
2024 J jnl
CoRR
Hesam Jalalian, Rafael M. O. Cruz
2024 A* conf
CVPR
Abdallah Dib, Luiz Gustavo Hafemann, Emeline Got, Trevor Anderson, Amin Fadaeinejad, Rafael M. O. Cruz, Marc-André Carbonneau
2024 J jnl
CoRR
Kecia Gomes de Moura, Rafael M. O. Cruz, Robert Sabourin
2024 J jnl
Artif. Intell. Rev.
Juscimara Gomes Avelino, George D. C. Cavalcanti, Rafael M. O. Cruz
2024 conf
ICDAR (2)
Talles Brito Viana, Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2024 J jnl
CoRR
Arthur Josi, Luiz Gustavo Hafemann, Abdallah Dib, Emeline Got, Rafael M. O. Cruz, Marc-Andre Carbonneau
2023 B conf
SMC
Paulo R. G. Cordeiro, George D. C. Cavalcanti, Rafael M. O. Cruz
2023 J jnl
Expert Syst. Appl.
Talles Brito Viana, Victor L. F. Souza, Adriano Lorena Inácio de Oliveira, Rafael M. O. Cruz, Robert Sabourin
2023 J jnl
CoRR
Paulo R. G. Cordeiro, George D. C. Cavalcanti, Rafael M. O. Cruz
2023 J jnl
CoRR
Mahdi Alehdaghi, Arthur Josi, Pourya Shamsolmoali, Rafael M. O. Cruz, Eric Granger
2023 B conf
IJCNN
Eduardo V. L. Barboza, Paulo R. Lisboa de Almeida, Alceu de Souza Britto Jr., Rafael M. O. Cruz
2023 J jnl
CoRR
Eduardo V. L. Barboza, Paulo R. Lisboa de Almeida, Alceu de Souza Britto Jr., Rafael M. O. Cruz
2023 J jnl
IEEE Access
Paulo R. G. Cordeiro, George D. C. Cavalcanti, Rafael M. O. Cruz
2023 J jnl
CoRR
Arthur Josi, Mahdi Alehdaghi, Rafael M. O. Cruz, Eric Granger
2023 J jnl
CoRR
Abdallah Dib, Luiz Gustavo Hafemann, Emeline Got, Trevor Anderson, Amin Fadaeinejad, Rafael M. O. Cruz, Marc-Andre Carbonneau
2023 conf
WACV (Workshops)
Arthur Josi, Mahdi Alehdaghi, Rafael M. O. Cruz, Eric Granger
2023 J jnl
Inf. Fusion
Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti, Rafael M. O. Cruz
2023 J jnl
IEEE Trans. Computers
Walber M. Rodrigues, Felipe N. Walmsley, George D. C. Cavalcanti, Rafael M. O. Cruz
2023 J jnl
Appl. Soft Comput.
Lucas B. V. de Amorim, George D. C. Cavalcanti, Rafael M. O. Cruz
2022 J jnl
Inf. Fusion
Felipe N. Walmsley, George D. C. Cavalcanti, Robert Sabourin, Rafael M. O. Cruz
2022 B conf
IJCNN
Talles Brito Viana, Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2022 B conf
IJCNN
Reza Davtalab, Rafael M. O. Cruz, Robert Sabourin
2022 J jnl
CoRR
Reza Davtalab, Rafael M. O. Cruz, Robert Sabourin
2022 B conf
ICIP
Félix Remigereau, Djebril Mekhazni, Sajjad Abdoli, Le Thanh Nguyen-Meidine, Rafael M. O. Cruz, Eric Granger
2022 J jnl
CoRR
Félix Remigereau, Djebril Mekhazni, Sajjad Abdoli, Le Thanh Nguyen-Meidine, Rafael M. O. Cruz, Eric Granger
2022 B conf
IJCNN
Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti, Rafael M. O. Cruz
2022 J jnl
CoRR
Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti, Rafael M. O. Cruz
2022 J jnl
CoRR
Arthur Josi, Mahdi Alehdaghi, Rafael M. O. Cruz, Eric Granger
2022 J jnl
CoRR
Rafael M. O. Cruz, Woshington V. de Sousa, George D. C. Cavalcanti
2022 J jnl
Online Soc. Networks Media
Rafael M. O. Cruz, Woshington V. de Sousa, George D. C. Cavalcanti
2022 conf
ECCV Workshops (8)
Matej Kristan, Ales Leonardis, Jirí Matas, Michael Felsberg, Roman P. Pflugfelder, Joni-Kristian Kämäräinen, Hyung Jin Chang, Martin Danelljan, Luka Cehovin Zajc, Alan Lukezic, Ondrej Drbohlav, Johanna Björklund, Yushan Zhang, Zhongqun Zhang, Song Yan, Wenyan Yang, Dingding Cai, Christoph Mayer, Gustavo Fernández, Kang Ben, Goutam Bhat, Hong Chang, Guangqi Chen, Jiaye Chen, Shengyong Chen, Xilin Chen, Xin Chen, Xiuyi Chen, Yiwei Chen, Yu-Hsi Chen, Zhixing Chen, Yangming Cheng, Angelo Ciaramella, Yutao Cui, Benjamin Dzubur, Mohana Murali Dasari, Qili Deng, Debajyoti Dhar, Shangzhe Di, Emanuel Di Nardo, Daniel K. Du, Matteo Dunnhofer, Heng Fan, Zhenhua Feng, Zhihong Fu, Shang Gao, Rama Krishna Sai S. Gorthi, Eric Granger, Q. H. Gu, Himanshu Gupta, Jianfeng He, Keji He, Yan Huang, Deepak Jangid, Rongrong Ji, Cheng Jiang, Yingjie Jiang, Felix Järemo Lawin, Ze Kang, Madhu Kiran, Josef Kittler, Simiao Lai, Xiangyuan Lan, Dongwook Lee, Hyunjeong Lee, Seohyung Lee, Hui Li, Ming Li, Wangkai Li, Xi Li, Xianxian Li, Xiao Li, Zhe Li, Liting Lin, Haibin Ling, Bo Liu, Chang Liu, Si Liu, Huchuan Lu, Rafael M. O. Cruz, Bingpeng Ma, Chao Ma, Jie Ma, Yinchao Ma, Niki Martinel, Alireza Memarmoghadam, Christian Micheloni, Payman Moallem, Le Thanh Nguyen-Meidine, Siyang Pan, Changbeom Park, Danda Pani Paudel, Matthieu Paul, Houwen Peng, Andreas Robinson, Litu Rout, Shiguang Shan, Kristian Simonato, Tianhui Song, Xiaoning Song, Chao Sun, Jingna Sun, Zhangyong Tang, Radu Timofte, Chi-Yi Tsai, Luc Van Gool, Om Prakash Verma, Dong Wang, Fei Wang, Liang Wang, Liangliang Wang, Lijun Wang, Limin Wang, Qiang Wang, Gangshan Wu, Jinlin Wu, Xiaojun Wu, Fei Xie, Tianyang Xu, Wei Xu, Yong Xu, Yuanyou Xu, Wanli Xue, Zizheng Xun, Bin Yan, Dawei Yang, Jinyu Yang, Wankou Yang, Xiaoyun Yang, Yi Yang, Yichun Yang, Zongxin Yang, Botao Ye, Fisher Yu, Hongyuan Yu, Jiaqian Yu, Qianjin Yu, Weichen Yu, Kang Ze, Jiang Zhai, Chengwei Zhang, Chunhu Zhang, Kaihua Zhang, Tianzhu Zhang, Wenkang Zhang, Zhibin Zhang, Zhipeng Zhang, Jie Zhao, Shao-Chuan Zhao, Feng Zheng, Haixia Zheng, Min Zheng, Bineng Zhong, Jiawen Zhu, Xuefeng Zhu, Yueting Zhuang
2022 J jnl
CoRR
Lucas B. V. de Amorim, George D. C. Cavalcanti, Rafael M. O. Cruz
2022 conf
ECCV Workshops (5)
Mahdi Alehdaghi, Arthur Josi, Rafael M. O. Cruz, Eric Granger
2022 J jnl
CoRR
Mahdi Alehdaghi, Arthur Josi, Rafael M. O. Cruz, Eric Granger
2020 J jnl
CoRR
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2020 J jnl
Expert Syst. Appl.
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2020 B conf
ICPR
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2020 J jnl
CoRR
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2020 J jnl
J. Mach. Learn. Res.
Rafael M. O. Cruz, Luiz G. Hafemann, Robert Sabourin, George D. C. Cavalcanti
2020 conf
GECCO Companion
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2020 J jnl
CoRR
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2020 B conf
IJCNN
Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti, Rafael M. O. Cruz
2020 J jnl
CoRR
Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti, Rafael M. O. Cruz
2019 conf
ICCS (3)
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2019 J jnl
Int. J. Pattern Recognit. Artif. Intell.
Rafael M. O. Cruz, Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti
2019 J jnl
Pattern Recognit.
Rafael M. O. Cruz, Dayvid V. R. Oliveira, George D. C. Cavalcanti, Robert Sabourin
2019 B conf
IJCNN
Victor L. F. Souza, Adriano L. I. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2019 B conf
IJCNN
Mariana de Araujo Souza, George D. C. Cavalcanti, Rafael M. O. Cruz, Robert Sabourin
2019 J jnl
Pattern Recognit.
Mariana de Araujo Souza, George D. C. Cavalcanti, Rafael M. O. Cruz, Robert Sabourin
2018 J jnl
CoRR
Rafael M. O. Cruz, George D. C. Cavalcanti, Tsang Ing Ren
2018 J jnl
Neurocomputing
Anandarup Roy, Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 B conf
IJCNN
Felipe N. Walmsley, George D. C. Cavalcanti, Dayvid V. R. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2018 J jnl
CoRR
Felipe N. Walmsley, George D. C. Cavalcanti, Dayvid V. R. Oliveira, Rafael M. O. Cruz, Robert Sabourin
2018 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Rafael M. O. Cruz, Luiz G. Hafemann, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Rafael M. O. Cruz, Hiba H. Zakane, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
Inf. Fusion
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Rafael M. O. Cruz, Dayvid V. R. Oliveira, George D. C. Cavalcanti, Robert Sabourin
2018 J jnl
CoRR
Rafael M. O. Cruz, Mariana de Araujo Souza, Robert Sabourin, George D. C. Cavalcanti
2018 B conf
IJCNN
Dayvid V. R. Oliveira, George D. C. Cavalcanti, Thyago N. Porpino, Rafael M. O. Cruz, Robert Sabourin
2018 J jnl
CoRR
Dayvid V. R. Oliveira, George D. C. Cavalcanti, Thyago N. Porpino, Rafael M. O. Cruz, Robert Sabourin
2018 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti, Tsang Ing Ren
2018 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2018 J jnl
CoRR
Mariana de Araujo Souza, George D. C. Cavalcanti, Rafael M. O. Cruz, Robert Sabourin
2018 J jnl
Neural Comput. Appl.
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2017 B conf
IJCNN
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2017 conf
IPTA
Rafael M. O. Cruz, Hiba H. Zakane, Robert Sabourin, George D. C. Cavalcanti
2017 J jnl
Inf. Fusion
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2017 B conf
IJCNN
Mariana de Araujo Souza, George D. C. Cavalcanti, Rafael M. O. Cruz, Robert Sabourin
2016 J jnl
Neurocomputing
Anandarup Roy, Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2016 B conf
ICPR
Anandarup Roy, Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2015 J jnl
CoRR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2015 B conf
IJCNN
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2015 J jnl
Pattern Recognit.
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti, Tsang Ing Ren
2014 conf
ANNPR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2014 B conf
ICPR
Rafael M. O. Cruz, Robert Sabourin, George D. C. Cavalcanti
2013 J jnl
Expert Syst. Appl.
Rafael M. O. Cruz, George D. C. Cavalcanti, Ing Ren Tsang, Robert Sabourin
2011 B conf
IJCNN
Rafael M. O. Cruz, George D. C. Cavalcanti, Ing Ren Tsang
2010 B conf
IJCNN
Rafael M. O. Cruz, George D. C. Cavalcanti, Ing Ren Tsang
tests/integration/test_pe_extractors.py
← Index tests/integration/test_pe_extractors.py python
"""
Integration tests for PE-specific extractors.
"""
import pytest
from unittest.mock import Mock, patch, MagicMock

pytestmark = [pytest.mark.integration, pytest.mark.pe]


# ============================================================================
# PEFeaturesExtractor Tests
# ============================================================================

class TestPEFeaturesExtractor:
    """Tests for PEFeaturesExtractor class."""

    def test_extract_valid_pe(self, pe_binary_path, mock_logger):
        """Test extracting features from valid PE file."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor
        from redb.models.dataclasses import PE

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result is not None
            assert isinstance(result, PE)

    def test_extract_pe_type(self, pe_binary_path, mock_logger):
        """Test PE type detection (DLL, EXE, DRIVER)."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result.type in ["DLL", "EXE", "DRIVER"]

    def test_extract_architecture(self, pe_binary_path, mock_logger):
        """Test architecture detection."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Architecture should be detected
            assert result.architecture is not None

    def test_extract_entry_point(self, pe_binary_path, mock_logger):
        """Test entry point extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Entry point should be a hex string
            assert result.entry_point.startswith("0x")

    def test_extract_compilation_time(self, pe_binary_path, mock_logger):
        """Test compilation time extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Compilation time should be an integer timestamp
            assert isinstance(result.compilation_time, int)
            assert result.compilation_time_utc is not None

    def test_extract_dotnet_detection(self, pe_binary_path, mock_logger):
        """Test .NET detection."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Should be True for the test .NET binary
            assert isinstance(result.is_dotnet, bool)
            assert result.is_dotnet is True  # Test file is .NET

    def test_extract_headers(self, pe_binary_path, mock_logger):
        """Test header extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result.dos_header is not None
            assert result.nt_header is not None
            assert result.file_header is not None
            assert result.optional_header is not None

    def test_extract_counts(self, pe_binary_path, mock_logger):
        """Test section/import/export counts."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert isinstance(result.number_of_sections, int)
            assert isinstance(result.number_of_imports, int)
            assert isinstance(result.number_of_exports, int)
            assert isinstance(result.number_of_resources, int)

    def test_extract_rich_header(self, pe_binary_path, mock_logger):
        """Test Rich header extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Rich header may or may not be present
            # If present, should be JSON string
            if result.rich_header_dump is not None:
                assert isinstance(result.rich_header_dump, str)

    def test_extract_version_info(self, pe_binary_path, mock_logger):
        """Test version info extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Version info may or may not be present
            if result.version_info is not None:
                assert isinstance(result.version_info, list)


# ============================================================================
# PEImportExtractor Tests
# ============================================================================

class TestPEImportExtractor:
    """Tests for PEImportExtractor class."""

    def test_extract_imports(self, pe_binary_path, mock_logger):
        """Test import extraction."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor
        from redb.models.dataclasses import PEImport

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None:
                assert isinstance(result, PEImport)
                assert isinstance(result.pe_imports_total, int)

    def test_extract_import_libraries(self, pe_binary_path, mock_logger):
        """Test import library extraction."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and result.pe_import_libraryName is not None:
                assert isinstance(result.pe_import_libraryName, list)

    def test_extract_import_functions(self, pe_binary_path, mock_logger):
        """Test import function extraction."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and result.pe_import_functions is not None:
                assert isinstance(result.pe_import_functions, list)

    def test_prepare_export_clickhouse(self, pe_binary_path, mock_logger):
        """Test ClickHouse export preparation."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.prepare_export_data("ClickHouseExporter")

            if result is not None:
                data, column_names, column_type_names = result
                assert 'library_name' in column_names
                assert 'function_name' in column_names


# ============================================================================
# PESectionExtractor Tests
# ============================================================================

class TestPESectionExtractor:
    """Tests for PESectionExtractor class."""

    def test_extract_sections(self, pe_binary_path, mock_logger):
        """Test section extraction."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor
        from redb.models.dataclasses import PESection

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result is not None
            assert isinstance(result, list)
            assert len(result) > 0
            assert isinstance(result[0], PESection)

    def test_section_properties(self, pe_binary_path, mock_logger):
        """Test section property extraction."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and len(result) > 0:
                section = result[0]
                assert section.section_name is not None
                assert section.section_entropy >= 0
                assert section.section_sha256 is not None
                assert section.section_md5 is not None
                assert section.section_size >= 0

    def test_section_entropy_range(self, pe_binary_path, mock_logger):
        """Test that section entropy is in valid range."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None:
                for section in result:
                    assert 0 <= section.section_entropy <= 8

    def test_prepare_export_clickhouse(self, pe_binary_path, mock_logger):
        """Test ClickHouse export preparation."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.prepare_export_data("ClickHouseExporter")

            if result is not None:
                data, column_names, column_type_names = result
                assert 'section_name' in column_names
                assert 'section_entropy' in column_names
                assert 'section_sha256' in column_names


# ============================================================================
# PEResourceExtractor Tests
# ============================================================================

class TestPEResourceExtractor:
    """Tests for PEResourceExtractor class."""

    def test_extract_resources(self, pe_binary_path, mock_logger):
        """Test resource extraction."""
        from redb.extractors.pe_extractors.pe_resources import PEResourceExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEResourceExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May be None if no resources
            if result is not None:
                assert isinstance(result, list)

    def test_resource_properties(self, pe_binary_path, mock_logger):
        """Test resource property extraction."""
        from redb.extractors.pe_extractors.pe_resources import PEResourceExtractor
        from redb.models.dataclasses import PEResource

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEResourceExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and len(result) > 0:
                resource = result[0]
                assert isinstance(resource, PEResource)
                assert resource.resource_type is not None


# ============================================================================
# PEOverlayExtractor Tests
# ============================================================================

class TestPEOverlayExtractor:
    """Tests for PEOverlayExtractor class."""

    def test_extract_overlay(self, pe_binary_path, mock_logger):
        """Test overlay extraction."""
        from redb.extractors.pe_extractors.pe_overlay import PEOverlayExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEOverlayExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May be None if no overlay
            # If present, should have overlay properties
            if result is not None:
                assert hasattr(result, 'overlay_size')

    def test_has_overlay_check(self, pe_binary_path, mock_logger):
        """Test overlay detection."""
        from redb.extractors.pe_extractors.pe_overlay import PEOverlayExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEOverlayExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            has_overlay = extractor._has_overlay()
            assert isinstance(has_overlay, bool)


# ============================================================================
# PESignatureExtractor Tests
# ============================================================================

class TestPESignatureExtractor:
    """Tests for PESignatureExtractor class."""

    def test_extract_signature(self, pe_binary_path, mock_logger):
        """Test signature extraction."""
        from redb.extractors.pe_extractors.pe_signature import PESignatureExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESignatureExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May be None if not signed
            # Result type depends on implementation

    def test_is_signed_check(self, pe_binary_path, mock_logger):
        """Test signature detection."""
        from redb.extractors.pe_extractors.pe_signature import PESignatureExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESignatureExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            is_signed = extractor._is_signed()
            assert isinstance(is_signed, bool)


# ============================================================================
# PEDotNetExtractor Tests
# ============================================================================

class TestPEDotNetExtractor:
    """Tests for PEDotNetExtractor class."""

    def test_extract_dotnet(self, pe_binary_path, mock_logger):
        """Test .NET metadata extraction."""
        from redb.extractors.pe_extractors.pe_dotnet import PEDotNetExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEDotNetExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # The test file is a .NET binary
            if extractor._check_dotnet():
                assert result is not None

    def test_check_dotnet(self, pe_binary_path, mock_logger):
        """Test .NET detection."""
        from redb.extractors.pe_extractors.pe_dotnet import PEDotNetExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEDotNetExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            is_dotnet = extractor._check_dotnet()
            assert isinstance(is_dotnet, bool)
            # Test file should be .NET
            assert is_dotnet is True


# ============================================================================
# PEInconsistencyTestsExtractor Tests
# ============================================================================

class TestPEInconsistencyTestsExtractor:
    """Tests for PEInconsistencyTestsExtractor class."""

    def test_extract_inconsistency_tests(self, pe_binary_path, mock_logger):
        """Test inconsistency tests extraction."""
        from redb.extractors.pe_extractors.pe_inconsistency_tests import PEInconstistencyTestsExtractor as PEInconsistencyTestsExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEInconsistencyTestsExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # extract() returns True if tests were performed, False otherwise
            # The actual test results are stored in extractor.pe_inconsistency_tests
            # and extractor.dotnet_inconsistency_tests
            assert result in (True, False)

            if result:
                # Check that test results were stored
                assert extractor.pe_inconsistency_tests is not None or extractor.dotnet_inconsistency_tests is not None


# ============================================================================
# PEExtraFindings Tests
# ============================================================================

class TestPEExtraFindings:
    """Tests for PEExtraFindings class."""

    def test_extract_extra_findings(self, pe_binary_path, mock_logger):
        """Test extra findings extraction."""
        from redb.extractors.pe_extractors.pe_extra_findings import PEExtraFindings

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEExtraFindings(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May return None or list of findings
            if result is not None:
                assert isinstance(result, list)


# ============================================================================
# Integration Tests
# ============================================================================

class TestPEExtractorIntegration:
    """Integration tests for PE extractors."""

    def test_all_extractors_same_pe_object(self, pe_binary_path, mock_logger, pe_object):
        """Test that extractors can share the same PE object."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            # Create extractors sharing the same PE object
            features_ext = PEFeaturesExtractor(pe_binary_path, mock_logger, pe=pe_object)
            imports_ext = PEImportExtractor(pe_binary_path, mock_logger, pe=pe_object)
            sections_ext = PESectionExtractor(pe_binary_path, mock_logger, pe=pe_object)

            # All should use the same PE object
            assert features_ext.pe is pe_object
            assert imports_ext.pe is pe_object
            assert sections_ext.pe is pe_object

            # All should extract successfully
            features_result = features_ext.extract()
            imports_result = imports_ext.extract()
            sections_result = sections_ext.extract()

            assert features_result is not None
            # imports and sections may be None if not present

    def test_hash_consistency_across_extractors(self, pe_binary_path, mock_logger):
        """Test that hashes are consistent across all extractors."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            features_ext = PEFeaturesExtractor(pe_binary_path, mock_logger)
            imports_ext = PEImportExtractor(pe_binary_path, mock_logger)

            # Hashes should be the same
            assert features_ext.sha256 == imports_ext.sha256
            assert features_ext.md5 == imports_ext.md5
            assert features_ext.sha1 == imports_ext.sha1