Hamid Behroozi

113 papers B 16C 1Misc 4Journal 66Unranked 26
YearRankTypeTitle / Venue / Authors
2025 J jnl
IEEE Internet Things J.
Sima Sobhi-Givi, Mahdi Nouri, Mahrokh G. Shayesteh, Hamid Behroozi, Hyun-Han Kwon, Md. Jalil Piran
2025 conf
NAACL (Findings)
Mahshid Dehghani, Amirahmad Shafiee, Ali Shafiei, Neda Fallah, Farahmand Alizadeh, Mohammad Mehdi Gholinejad, Hamid Behroozi, Jafar Habibi, Ehsaneddin Asgari
2025 J jnl
CoRR
Rahman Saadat Yeganeh, Hamid Behroozi
2025 J jnl
CoRR
Rahman Saadat Yeganeh, Hamid Behroozi, Mohammad Javad Omidi, Mohammad Robat Mili, Eduard A. Jorswieck, Symeon Chatzinotas
2025 J jnl
IEEE Trans. Netw. Serv. Manag.
Mahdi Nouri, Sima Sobhi-Givi, Hamid Behroozi, Mahrokh G. Shayesteh, Md. Jalil Piran, Zhiguo Ding
2024 J jnl
CoRR
Mehdi Letafati, Seyyed AmirHossein Ameli Kalkhoran, Ecenaz Erdemir, Babak Hossein Khalaj, Hamid Behroozi, Deniz Gündüz
2024 J jnl
IEEE Open J. Commun. Soc.
Vahid Shahiri, Moslem Forouzesh, Hamid Behroozi, Ali Kuhestani, Kai-Kit Wong
2024 J jnl
IEEE Trans. Veh. Technol.
Mahdi Nouri, Mahrokh G. Shayesteh, Hamid Behroozi, Zhiguo Ding
2024 J jnl
CoRR
Mahshid Dehghani, Amirahmad Shafiee, Ali Shafiei, Neda Fallah, Farahmand Alizadeh, Mohammad Mehdi Gholinejad, Hamid Behroozi, Jafar Habibi, Ehsaneddin Asgari
2024 J jnl
Signal Process.
Mohammad Bokaei, Saeed Razavikia, Stefano Rini, Arash Amini, Hamid Behroozi
2024 J jnl
IEEE Wirel. Commun. Lett.
Vahid Shahiri, Hamid Behroozi
2024 J jnl
IEEE Internet Things J.
Vahid Shahiri, Hamid Behroozi, Ali Kuhestani, Kai-Kit Wong
2024 J jnl
IEEE Trans. Veh. Technol.
Hamid Reza Hashempour, Hamed Bastami, Majid Moradikia, Seyed A. Zekavat, Hamid Behroozi, Gilberto Berardinelli, A. Lee Swindlehurst
2023 J jnl
IEEE Access
Mahdi Nouri, Alireza Jafarieh, Hamid Behroozi, Nazih Khaddaj Mallat, Amjad Iqbal, Md. Jalil Piran, Duehee Lee
2023 J jnl
IEEE Trans. Veh. Technol.
Mahdi Nouri, Hamid Behroozi, Alireza Jafarieh, Sajjad Abazari Aghdam, Md. Jalil Piran, Nazih Khaddaj Mallat
2023 J jnl
CoRR
Mohammad Bokaei, Saeed Razavikia, Stefano Rini, Arash Amini, Hamid Behroozi
2023 J jnl
IEEE Trans. Commun.
Mahdi Nouri, Hamid Behroozi, Hamed Bastami, Majid Moradikia, Alireza Jafarieh, Ahmed Abdelhadi, Zhu Han
2023 J jnl
IEEE Trans. Veh. Technol.
Hamed Bastami, Hamid Behroozi, Majid Moradikia, Ahmed Abdelhadi, Derrick Wing Kwan Ng, Lajos Hanzo
2023 B conf
GLOBECOM
Seyyed AmirHossein Ameli Kalkhoran, Mehdi Letafati, Ecenaz Erdemir, Babak Hossein Khalaj, Hamid Behroozi, Deniz Gündüz
2023 J jnl
CoRR
Seyyed AmirHossein Ameli Kalkhoran, Mehdi Letafati, Ecenaz Erdemir, Babak Hossein Khalaj, Hamid Behroozi, Deniz Gündüz
2023 J jnl
Vis. Comput.
Hassan Keshvari Khojasteh, Hoda Mohammadzade, Hamid Behroozi
2022 conf
ICCSPA
Alireza Jafarieh, Mahdi Nouri, Hamid Behroozi, Nazih Khaddaj Mallat
2022 conf
ICCSPA
Nazih Khaddaj Mallat, Alireza Jafarieh, Mahdi Nouri, Hamid Behroozi
2022 J jnl
IET Image Process.
Hatef Otroshi-Shahreza, Arash Amini, Hamid Behroozi
2022 J jnl
IEEE Wirel. Commun. Lett.
Mehdi Letafati, Hamid Behroozi, Babak Hossein Khalaj, Eduard A. Jorswieck
2022 J jnl
CoRR
Hamed Bastami, Hamid Behroozi, Majid Moradikia, Ahmed Abdelhadi, Derrick Wing Kwan Ng, Lajos Hanzo
2022 J jnl
IEEE Trans. Veh. Technol.
Hamed Bastami, Majid Moradikia, Ahmed Abdelhadi, Hamid Behroozi, Bruno Clerckx, Lajos Hanzo
2022 J jnl
IEEE Trans. Commun.
Mehdi Letafati, Hamid Behroozi, Babak Hossein Khalaj, Eduard A. Jorswieck
2022 J jnl
CoRR
Hamed Bastami, Majid Moradikia, Hamid Behroozi, Lajos Hanzo
2022 J jnl
CoRR
Hamidreza Hashempour, Hamed Bastami, Majid Moradikia, Seyed A. Zekavat, Hamid Behroozi, A. Lee Swindlehurst
2022 conf
VTC Spring
Mehdi Letafati, Hamid Behroozi, Babak Hossein Khalaj, Eduard A. Jorswieck
2021 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Mahdi Nouri, Hamid Behroozi, Nazih Khaddaj Mallat, Sajjad Abazari Aghdam
2021 J jnl
Wirel. Networks
Milad Tatar Mamaghani, Ali Kuhestani, Hamid Behroozi
2021 conf
ICC Workshops
Mehdi Letafati, Hamid Behroozi, Babak Hossein Khalaj, Eduard A. Jorswieck
2021 J jnl
CoRR
Mohammad Akyash, Hoda Mohammadzade, Hamid Behroozi
2021 B conf
GLOBECOM
Mehdi Letafati, Hamid Behroozi, Babak Hossein Khalaj, Eduard A. Jorswieck
2021 J jnl
IEEE Trans. Medical Imaging
Ruchika Verma, Neeraj Kumar, Abhijeet Patil, Nikhil Cherian Kurian, Swapnil Rane, Simon Graham, Quoc Dang Vu, Mieke Zwager, Shan-E-Ahmed Raza, Nasir M. Rajpoot, Xiyi Wu, Huai Chen, Yijie Huang, Lisheng Wang, Hyun Jung, G. Thomas Brown, Yanling Liu, Shuolin Liu, Seyed Alireza Fatemi Jahromi, Ali Asghar Khani, Ehsan Montahaei, Mahdieh Soleymani Baghshah, Hamid Behroozi, Pavel Semkin, Alexandr Rassadin, Prasad Dutande, Romil Lodaya, Ujjwal Baid, Bhakti Baheti, Sanjay N. Talbar, Amirreza Mahbod, Rupert Ecker, Isabella Ellinger, Zhipeng Luo, Bin Dong, Zhengyu Xu, Yuehan Yao, Shuai Lv, Ming Feng, Kele Xu, Hasib Zunair, Abdessamad Ben Hamza, Steven M. Smiley, Tang-Kai Yin, Qi-Rui Fang, Shikhar Srivastava, Dwarikanath Mahapatra, Lubomira Trnavska, Hanyun Zhang, Priya Lakshmi Narayanan, Justin Law, Yinyin Yuan, Abhiroop Tejomay, Aditya Mitkari, Dinesh Koka, Vikas Ramachandra, Lata Kini, Amit Sethi
2021 J jnl
CoRR
Mehdi Letafati, Hamid Behroozi, Babak Hossein Khalaj, Eduard A. Jorswieck
2021 J jnl
IEEE Trans. Inf. Forensics Secur.
Hamed Bastami, Mehdi Letafati, Majid Moradikia, Ahmed Abdelhadi, Hamid Behroozi, Lajos Hanzo
2021 conf
ICC Workshops
Hamed Bastami, Majid Moradikia, Mehdi Letafati, Ahmed Abdelhadi, Hamid Behroozi
2021 J jnl
Phys. Commun.
Hamed Bastami, Majid Moradikia, Hamid Behroozi, Rodrigo C. de Lamare, Ahmed Abdelhadi, Zhiguo Ding
2021 J jnl
CoRR
Hassan Keshvari Khojasteh, Hoda Mohammadzade, Hamid Behroozi
2020 conf
ICC Workshops
Mehdi Letafati, Ali Kuhestani, Derrick Wing Kwan Ng, Hamid Behroozi
2020 J jnl
IEEE Trans. Aerosp. Electron. Syst.
Ehsan Tohidi, Alireza Hariri, Hamid Behroozi, Mohammad Mahdi Nayebi, Geert Leus, Athina P. Petropulu
2020 J jnl
Neurocomputing
Mohammad Mahdi Johari, Hamid Behroozi
2020 J jnl
CoRR
Ehsan Sadeghi, Hamid Behroozi, Stefano Rini
2020 Misc conf
ICASSP
Mohammad Mahdi Johari, Hamid Behroozi
2020 J jnl
IEEE Trans. Wirel. Commun.
Mehdi Letafati, Ali Kuhestani, Hamid Behroozi, Derrick Wing Kwan Ng
2020 conf
IST
Mahdi Cherakhloo, Hatef Otroshi-Shahreza, Mohammad Soltanian, Sina Ranjkeshzadeh, Hamid Azadegan, Alireza Shirkhodaee, Arash Amini, Hamid Behroozi
2020 J jnl
IEEE Trans. Inf. Forensics Secur.
Mehdi Letafati, Ali Kuhestani, Hamid Behroozi
2019 J jnl
CoRR
Ali Kuhestani, Milad Tatar Mamaghani, Hamid Behroozi
2019 J jnl
IEEE Access
Majid Moradikia, Hamed Bastami, Ali Kuhestani, Hamid Behroozi, Lajos Hanzo
2019 J jnl
IEEE Trans. Signal Process.
Ehsan Tohidi, Mario Coutino, Sundeep Prabhakar Chepuri, Hamid Behroozi, Mohammad Mahdi Nayebi, Geert Leus
2018 J jnl
IET Signal Process.
Ehsan Tohidi, Mojtaba Radmard, Mohammad Nazari Majd, Hamid Behroozi, Mohammad Mahdi Nayebi
2018 conf
IST
Hatef Otroshi-Shahreza, Arash Amini, Hamid Behroozi
2017 J jnl
IEEE Commun. Lett.
Mehdi Setayesh, Hamid Behroozi, Babak H. Khalaj
2017 J jnl
Wirel. Pers. Commun.
Niloofar Okati, Mohammad Reza Mosavi, Hamid Behroozi
2017 Misc conf
ACSSC
Ehsan Tohidi, Hamid Behroozi, Geert Leus
2016 J jnl
IEEE Wirel. Commun. Lett.
Shahab Ghasemi-Goojani, Shokoufeh Mardani, Hamid Behroozi
2016 conf
IST
Niloofar Okati, Mohammad Reza Mosavi, Hamid Behroozi
2016 J jnl
IEEE Commun. Lett.
Shahab Ghasemi-Goojani, Hamid Behroozi
2016 conf
IST
Mehdi Setayesh, Hamid Behroozi, Babak H. Khalaj
2016 J jnl
IEEE Trans. Commun.
Shahab Ghasemi-Goojani, Saeed Karimi-Bidhendi, Hamid Behroozi
2016 J jnl
EURASIP J. Wirel. Commun. Netw.
Shima Haddadi, Ashkan Oliaiee, Hamid Behroozi, Babak Hossein Khalaj
2015 J jnl
IET Commun.
Mahdi Baianifar, Hamid Behroozi
2015 J jnl
EURASIP J. Wirel. Commun. Netw.
Shahab Ghasemi-Goojani, Hamid Behroozi
2014 J jnl
IEEE Commun. Lett.
Shahab Ghasemi-Goojani, Hamid Behroozi
2014 conf
IWCIT
Shahab Ghasemi-Goojani, Hamid Behroozi
2014 J jnl
CoRR
Shahab Ghasemi-Goojani, Hamid Behroozi
2014 B conf
ITW
Shahab Ghasemi-Goojani, Hamid Behroozi
2014 J jnl
EURASIP J. Wirel. Commun. Netw.
Shahab Ghasemi-Goojani, Hamid Behroozi
2014 J jnl
IEEE Trans. Commun.
Fariba Abbasi, Ali Aghagolzadeh, Hamid Behroozi
2014 C conf
ISITA
Shahab Ghasemi-Goojani, Hamid Behroozi
2013 conf
IWCIT
Farzin Haddadpour, Ehsan Gholami, Seyed Hamed Rastegar, Hamid Behroozi
2013 B conf
ITW
Shahab Ghasemi-Goojani, Hamid Behroozi
2013 J jnl
CoRR
Shahab Ghasemi-Goojani, Hamid Behroozi
2013 J jnl
CoRR
Shahab Ghasemi-Goojani, Hamid Behroozi
2013 conf
ISWCS
Shahab Ghasemi-Goojani, Hamid Behroozi
2013 conf
IWCIT
Sajjad Eghbalian-Arani, Hamid Behroozi
2013 conf
ISWCS
Sajjad Eghbalian-Arani, Hamid Behroozi
2012 conf
ICC
Morteza Varasteh, Hamid Behroozi
2012 B conf
PIMRC
Shahab Ghasemi-Goojani, Hamid Behroozi
2012 conf
IST
Fariba Abbasi, Ali Aghagolzadeh, Hamid Behroozi
2012 J jnl
IEEE Trans. Signal Process.
Morteza Varasteh, Hamid Behroozi
2012 conf
IST
Shima Haddadi, Hamid Behroozi, Babak Hossein Khalaj
2012 Misc conf
CISS
Shahab Ghasemi-Goojani, Hamid Behroozi
2012 Misc conf
CISS
Shahab Ghasemi-Goojani, Hamid Behroozi
2011 J jnl
IEEE Trans. Commun.
Hamid Behroozi, Fady Alajaji, Tamás Linder
2011 B conf
ITW
Morteza Varasteh, Hamid Behroozi
2010 J jnl
IEEE Trans. Signal Process.
Hamid Behroozi, Fady Alajaji, Tamás Linder
2009 conf
VTC Spring
Javad Haghighat, Hamid Behroozi, David V. Plant
2009 B conf
ISIT
Hamid Behroozi, Fady Alajaji, Tamás Linder
2009 J jnl
Wirel. Commun. Mob. Comput.
Hamid Behroozi, M. Reza Soleymani
2009 J jnl
IEEE Trans. Commun.
Hamid Behroozi, M. Reza Soleymani
2009 J jnl
IEEE Trans. Wirel. Commun.
Hamid Behroozi, M. Reza Soleymani
2009 J jnl
Wirel. Pers. Commun.
Hamid Behroozi, M. Reza Soleymani
2008 conf
VTC Fall
Hamid Behroozi, M. Reza Soleymani
2008 B conf
PIMRC
Javad Haghighat, Hamid Behroozi, David V. Plant
2008 J jnl
CoRR
Saeed Akhavan-Astaneh, Saeed Gazor, Hamid Behroozi
2008 B conf
PIMRC
Saeed Akhavan-Astaneh, Saeed Gazor, Hamid Behroozi
2008 B conf
ISIT
Hamid Behroozi, Fady Alajaji, Tamás Linder
2007 J jnl
IEEE Trans. Wirel. Commun.
Hamid Behroozi, M. Reza Soleymani
2007 conf
ICC
Hamid Behroozi, M. Reza Soleymani
2006 conf
VTC Fall
Hamid Behroozi, M. Reza Soleymani
2006 conf
ICASSP (4)
Hamid Behroozi, M. Reza Soleymani
2006 B conf
DCC
Hamid Behroozi, M. Reza Soleymani
2006 conf
VTC Fall
Hamid Behroozi, M. Reza Soleymani
2006 B conf
ISIT
Hamid Behroozi, M. Reza Soleymani
2006 B conf
GLOBECOM
Hamid Behroozi, M. Reza Soleymani
2005 B conf
MASS
Hamid Behroozi, M. Reza Soleymani
2005 B conf
GLOBECOM
Hamid Behroozi, M. Reza Soleymani
2003 B conf
PIMRC
Hamid Behroozi, Javad Haghighat, Masoumeh Nasiri-Kenari, Seyed Hamaidreza Jamali
2002 conf
MWCN
Javad Haghighat, Seyed Hamaidreza Jamali, Hamid Behroozi, Masoumeh Nasiri-Kenari
tests/integration/test_base_extractor.py
← Index tests/integration/test_base_extractor.py python
"""
Integration tests for the base Extractor class.
"""
import pytest
import hashlib
import math
from unittest.mock import Mock, patch, MagicMock
from collections import Counter

pytestmark = [pytest.mark.integration]


class TestExtractorStaticMethods:
    """Tests for static methods in Extractor class."""

    def test_process_binary_string_printable(self):
        """Test processing a printable binary string."""
        from redb.extractors.extractor import Extractor

        # Test with printable ASCII characters
        input_bytes = b"Hello World\x00\x00\x00"
        result = Extractor.process_binary_string(input_bytes)
        assert result == "Hello World"

    def test_process_binary_string_non_printable(self):
        """Test processing a string with non-printable characters."""
        from redb.extractors.extractor import Extractor

        # Test with non-printable characters
        input_bytes = b"\x01\x02Hello\x00"
        result = Extractor.process_binary_string(input_bytes)
        assert "\\x01" in result
        assert "\\x02" in result
        assert "Hello" in result

    def test_process_binary_string_empty(self):
        """Test processing an empty binary string."""
        from redb.extractors.extractor import Extractor

        input_bytes = b"\x00\x00\x00"
        result = Extractor.process_binary_string(input_bytes)
        assert result == ""

    def test_process_binary_string_all_printable(self):
        """Test processing a fully printable string."""
        from redb.extractors.extractor import Extractor

        input_bytes = b"TestString123"
        result = Extractor.process_binary_string(input_bytes)
        assert result == "TestString123"

    def test_remove_non_utf8_valid(self):
        """Test removing non-UTF8 characters from valid UTF8 string."""
        from redb.extractors.extractor import Extractor

        input_bytes = b"Hello World"
        result = Extractor.remove_non_utf8(input_bytes)
        assert result == b"Hello World"

    def test_remove_non_utf8_with_invalid(self):
        """Test removing non-UTF8 characters from mixed string."""
        from redb.extractors.extractor import Extractor

        # Mix of valid UTF8 and invalid bytes
        input_bytes = b"Hello\xff\xfeWorld"
        result = Extractor.remove_non_utf8(input_bytes)
        # Should remove the invalid bytes
        assert b"\xff" not in result
        assert b"\xfe" not in result
        assert b"Hello" in result
        assert b"World" in result

    def test_remove_non_utf8_empty(self):
        """Test removing non-UTF8 from empty string."""
        from redb.extractors.extractor import Extractor

        result = Extractor.remove_non_utf8(b"")
        assert result == b""


class TestExtractorEntropyCalculation:
    """Tests for entropy calculation in Extractor class."""

    def test_calculate_entropy_empty_data(self, elf_binary_path, mock_logger):
        """Test entropy calculation with empty data."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)
            result = extractor.calculate_entropy(b"")
            assert result == 0.0

    def test_calculate_entropy_uniform_data(self, elf_binary_path, mock_logger):
        """Test entropy calculation with uniform (low entropy) data."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)
            # All same bytes = 0 entropy
            uniform_data = b"\x00" * 256
            result = extractor.calculate_entropy(uniform_data)
            assert result == 0.0

    def test_calculate_entropy_random_data(self, elf_binary_path, mock_logger, high_entropy_data):
        """Test entropy calculation with random (high entropy) data."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)
            result = extractor.calculate_entropy(high_entropy_data)
            # Random data should have entropy close to 8 (max for bytes)
            assert result > 7.0

    def test_calculate_entropy_binary_data(self, elf_binary_path, mock_logger):
        """Test entropy calculation with binary data."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)
            # Two equally distributed values = 1 bit entropy
            binary_data = b"\x00\x01" * 128
            result = extractor.calculate_entropy(binary_data)
            assert abs(result - 1.0) < 0.01

    def test_calculate_entropy_string_data(self, elf_binary_path, mock_logger):
        """Test entropy calculation with string data."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)
            # String with two equally distributed characters
            string_data = "ab" * 100
            result = extractor.calculate_entropy(string_data)
            assert abs(result - 1.0) < 0.01


class TestExtractorInitialization:
    """Tests for Extractor initialization."""

    def test_extractor_hashes_computed_on_init(self, elf_binary_path, mock_logger, known_hashes):
        """Test that hashes are computed during initialization."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)

            assert extractor.md5 == known_hashes['md5']
            assert extractor.sha1 == known_hashes['sha1']
            assert extractor.sha256 == known_hashes['sha256']

    def test_extractor_hash_dataclass_created(self, elf_binary_path, mock_logger, known_hashes):
        """Test that Hash dataclass is created during initialization."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)

            assert extractor.hash.md5 == known_hashes['md5']
            assert extractor.hash.sha1 == known_hashes['sha1']
            assert extractor.hash.sha256 == known_hashes['sha256']

    def test_extractor_binary_cached_property(self, elf_binary_path, mock_logger, elf_binary_content):
        """Test that binary content is loaded as cached property."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)

            # Access binary property
            binary = extractor.binary
            assert binary == elf_binary_content

            # Second access should return cached value (same id)
            assert extractor.binary is binary

    def test_extractor_with_exporters(self, elf_binary_path, mock_logger, mock_print_exporter):
        """Test extractor initialization with exporters."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(
                elf_binary_path,
                mock_logger,
                exporters=[mock_print_exporter]
            )

            assert len(extractor.exporters) == 1
            assert extractor.exporters[0] is mock_print_exporter

    def test_extractor_with_index_prefix(self, elf_binary_path, mock_logger):
        """Test extractor initialization with custom index prefix."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(
                elf_binary_path,
                mock_logger,
                index_prefix="custom_prefix"
            )

            assert "custom_prefix" in extractor.elastic_index

    def test_extractor_known_benign_flag(self, elf_binary_path, mock_logger):
        """Test extractor with known_benign flag."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(
                elf_binary_path,
                mock_logger,
                known_benign=True
            )

            assert extractor.known_benign is True
            assert extractor.known_malicious is False

    def test_extractor_known_malicious_flag(self, elf_binary_path, mock_logger):
        """Test extractor with known_malicious flag."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(
                elf_binary_path,
                mock_logger,
                known_malicious=True
            )

            assert extractor.known_benign is False
            assert extractor.known_malicious is True


class TestExtractorExportData:
    """Tests for export_data method."""

    def test_export_data_with_print_exporter(self, elf_binary_path, mock_logger, mock_print_exporter, capsys):
        """Test export_data with PrintExporter."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(
                elf_binary_path,
                mock_logger,
                exporters=[mock_print_exporter]
            )

            result = extractor.export_data()
            # Should succeed with PrintExporter
            assert result is True

    def test_export_data_no_exporters(self, elf_binary_path, mock_logger):
        """Test export_data with no exporters configured."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(
                elf_binary_path,
                mock_logger,
                exporters=[]
            )

            result = extractor.export_data()
            # Should succeed with no exporters (nothing to export)
            assert result is True


class TestExtractorEdgeCases:
    """Tests for edge cases in Extractor class."""

    def test_extractor_with_nonexistent_file(self, mock_logger):
        """Test extractor with non-existent file."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            with pytest.raises(FileNotFoundError):
                BasicPropertiesExtractor("/nonexistent/file.bin", mock_logger)

    def test_entropy_none_data(self, elf_binary_path, mock_logger):
        """Test entropy calculation with None returns 0."""
        from redb.extractors.basicproperties import BasicPropertiesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = BasicPropertiesExtractor(elf_binary_path, mock_logger)
            result = extractor.calculate_entropy(None)
            assert result == 0.0

    def test_process_binary_string_high_bytes(self):
        """Test processing binary string with high byte values."""
        from redb.extractors.extractor import Extractor

        # Characters above 126 are non-printable
        input_bytes = b"\x7f\x80\x81\xff"
        result = Extractor.process_binary_string(input_bytes)
        assert "\\x7f" in result
        assert "\\x80" in result
        assert "\\xff" in result