J. Christopher Beck

192 papers A* 42A 29B 26C 1Misc 1Journal 71Unranked 20
YearRankTypeTitle / Venue / Authors
2026 J jnl
CoRR
Imko Marijnissen, J. Christopher Beck, Emir Demirovic, Ryo Kuroiwa
2026 J jnl
Artif. Intell.
Ryo Kuroiwa, J. Christopher Beck
2025 J jnl
INFORMS J. Comput.
Jiachen Zhang, J. Christopher Beck
2025 A conf
CP
Daniel Pekar, J. Christopher Beck
2025 A conf
CP
Ryo Kuroiwa, J. Christopher Beck
2025 conf
CPAIOR (2)
Minori Narita, Ryo Kuroiwa, J. Christopher Beck
2025 J jnl
CoRR
Minori Narita, Ryo Kuroiwa, J. Christopher Beck
2025 J jnl
Constraints An Int. J.
Jiachen Zhang, J. Christopher Beck
2025 A conf
CP
J. Christopher Beck, Ryo Kuroiwa, Jimmy H. M. Lee, Peter J. Stuckey, Allen Z. Zhong
2024 J jnl
INFORMS J. Comput.
Jiachen Zhang, Youcef Magnouche, Pierre Bauguion, Sébastien Martin, J. Christopher Beck
2024 J jnl
Health Informatics J.
Litong Zheng, J. Christopher Beck, Sebastian Mafeld, Matteo Parotto, Amanda Matthews, Sheryl Alexandre, Aaron Conway
2024 J jnl
CoRR
Ryo Kuroiwa, J. Christopher Beck
2024 A* conf
AAAI
Christian Muise, Sheila A. McIlraith, J. Christopher Beck
2024 A* conf
AAAI
Ryo Kuroiwa, J. Christopher Beck
2024 A conf
CP
Jiachen Zhang, J. Christopher Beck
2024 A conf
CP
Adam Francis Green, J. Christopher Beck, Amanda Jane Coles
2023 A* conf
ICAPS
Ryo Kuroiwa, J. Christopher Beck
2023 A conf
ECAI
Ryo Kuroiwa, Alexander Shleyfman, J. Christopher Beck
2023 A conf
CP
Ryo Kuroiwa, J. Christopher Beck
2023 B conf
CPAIOR
Anton Korikov, J. Christopher Beck
2023 A conf
CP
Arnoosh Golestanian, Giovanni Lo Bianco, Chengyu Tao, J. Christopher Beck
2023 J jnl
CoRR
Christian Muise, Sheila A. McIlraith, J. Christopher Beck
2023 A* conf
AAAI
Stephan A. Fahrenkrog-Petersen, Arik Senderovich, Alexandra Tichauer, Ali Kaan Tutak, J. Christopher Beck, Matthias Weidlich
2023 A* conf
ICAPS
Ryo Kuroiwa, J. Christopher Beck
2023 A* conf
ICAPS
Alexander Shleyfman, Ryo Kuroiwa, J. Christopher Beck
2023 C conf
CoDIT
Jiachen Zhang, Youcef Magnouche, Sébastien Martin, Antoine Fressancourt, J. Christopher Beck
2022 J jnl
Math. Program.
Margarita P. Castro, André Augusto Ciré, J. Christopher Beck
2022 A* conf
ICAPS
Ryo Kuroiwa, J. Christopher Beck
2022 J jnl
INFORMS J. Comput.
Margarita P. Castro, André Augusto Ciré, J. Christopher Beck
2022 J jnl
CoRR
Ryo Kuroiwa, J. Christopher Beck
2022 J jnl
IEEE Access
Arik Senderovich, Jiachen Zhang, Eldan Cohen, J. Christopher Beck
2022 A* conf
ICAPS
Ryo Kuroiwa, Alexander Shleyfman, J. Christopher Beck
2022 B conf
CPAIOR
Jiachen Zhang, Giovanni Lo Bianco, J. Christopher Beck
2022 B conf
CPAIOR
Yiqing L. Luo, J. Christopher Beck
2022 A* conf
ICAPS
Jiachen Zhang, Giovanni Lo Bianco, J. Christopher Beck
2022 J jnl
J. Artif. Intell. Res.
Ryo Kuroiwa, Alexander Shleyfman, Chiara Piacentini, Margarita P. Castro, J. Christopher Beck
2021 A* conf
IJCAI
Anton Korikov, Alexander Shleyfman, J. Christopher Beck
2021 A conf
CP
Anton Korikov, J. Christopher Beck
2021 A* conf
SOSP
Shane Bergsma, Timothy Zeyl, Arik Senderovich, J. Christopher Beck
2021 B conf
CPAIOR
Eldan Cohen, J. Christopher Beck
2021 A* conf
ICAPS
Ryo Kuroiwa, Alexander Shleyfman, Chiara Piacentini, Margarita P. Castro, J. Christopher Beck
2020 B conf
CPAIOR
Eldan Cohen, Arik Senderovich, J. Christopher Beck
2020 J jnl
INFORMS J. Comput.
Margarita P. Castro, André Augusto Ciré, J. Christopher Beck
2020 B conf
CPAIOR
Tanya Y. Tang, J. Christopher Beck
2020 A* ed.
ICAPS
J. Christopher Beck, Olivier Buffet, Jörg Hoffmann, Erez Karpas, Shirin Sohrabi
2020 J jnl
J. Artif. Intell. Res.
Margarita P. Castro, Chiara Piacentini, André Augusto Ciré, J. Christopher Beck
2020 J jnl
IEEE Robotics Autom. Lett.
Kyle E. C. Booth, Chiara Piacentini, Sara Bernardini, J. Christopher Beck
2019 B conf
CPAIOR
Kyle E. C. Booth, J. Christopher Beck
2019 J jnl
J. Artif. Intell. Res.
Chiara Piacentini, Sara Bernardini, J. Christopher Beck
2019 A* conf
AAAI
Arik Senderovich, J. Christopher Beck, Avigdor Gal, Matthias Weidlich
2019 A* conf
AAAI
Amanda Jane Coles, Andrew Coles, J. Christopher Beck
2019 A* conf
ICML
Eldan Cohen, J. Christopher Beck
2019 A* conf
ICAPS
Arik Senderovich, Kyle E. C. Booth, J. Christopher Beck
2019 A* conf
ICAPS
Margarita P. Castro, Chiara Piacentini, André A. Ciré, J. Christopher Beck
2019 J jnl
Appl. Ontology
Bahar Aameri, Hyunmin Cheong, J. Christopher Beck
2019 A conf
CP
Rodrigo Toro Icarte, León Illanes, Margarita P. Castro, André A. Ciré, Sheila A. McIlraith, J. Christopher Beck
2018 A* conf
ICAPS
Kyle E. C. Booth, Minh Do, J. Christopher Beck, Eleanor Gilbert Rieffel, Davide Venturelli, Jeremy Frank
2018 J jnl
CoRR
Kyle E. C. Booth, Minh Do, J. Christopher Beck, Eleanor Gilbert Rieffel, Davide Venturelli, Jeremy Frank
2018 A* conf
ICAPS
Chiara Piacentini, Margarita P. Castro, André Augusto Ciré, J. Christopher Beck
2018 A* conf
AAAI
Eldan Cohen, J. Christopher Beck
2018 J jnl
Constraints An Int. J.
Michael Morin, Margarita P. Castro, Kyle E. C. Booth, Tony T. Tran, Chang Liu, J. Christopher Beck
2018 A* conf
AAAI
Chiara Piacentini, Margarita P. Castro, André Augusto Ciré, J. Christopher Beck
2018 A* conf
IJCAI
Eldan Cohen, J. Christopher Beck
2018 B conf
CPAIOR
Chang Liu, Dionne M. Aleman, J. Christopher Beck
2018 J jnl
J. Sched.
Tony T. Tran, Meghana Padmanabhan, Peter Yun Zhang, Heyse Li, Douglas G. Down, J. Christopher Beck
2018 J jnl
Dagstuhl Reports
J. Christopher Beck, Daniele Magazzeni, Gabriele Röger, Willem-Jan van Hoeve
2017 A conf
SAT
Eldan Cohen, Guoyu Huang, J. Christopher Beck
2017 conf
IHTC
Daniela Rosu, Dionne M. Aleman, J. Christopher Beck, Mark H. Chignell, Mariano P. Consens, Mark S. Fox, Michael Gruninger, Chang Liu, Yi Ru, Scott Sanner
2017 B conf
SOCS
Eldan Cohen, J. Christopher Beck
2017 conf
AAAI Workshops
Daniela Rosu, Dionne M. Aleman, J. Christopher Beck, Mark H. Chignell, Mariano P. Consens, Mark S. Fox, Michael Gruninger, Chang Liu, Yi Ru, Scott Sanner
2017 conf
AAAI Spring Symposia
Daniela Rosu, Dionne M. Aleman, J. Christopher Beck, Mark H. Chignell, Mariano P. Consens, Mark S. Fox, Michael Gruninger, Chang Liu, Yi Ru, Scott Sanner
2017 A ed.
CP
J. Christopher Beck
2017 A* conf
AAAI
Eldan Cohen, J. Christopher Beck
2017 A* conf
IJCAI
Tony T. Tran, Tiago Stegun Vaquero, Goldie Nejat, J. Christopher Beck
2017 J jnl
J. Artif. Intell. Res.
Tony T. Tran, Tiago Stegun Vaquero, Goldie Nejat, J. Christopher Beck
2017 J jnl
IEEE Intell. Syst.
Kyle E. C. Booth, Sharaf Christopher Mohamed, Sanjif Rajaratnam, Goldie Nejat, J. Christopher Beck
2016 A conf
CP
Kyle E. C. Booth, Goldie Nejat, J. Christopher Beck
2016 B conf
SOCS
Tony T. Tran, Minh Do, Eleanor Gilbert Rieffel, Jeremy Frank, Zhihui Wang, Bryan O'Gorman, Davide Venturelli, J. Christopher Beck
2016 A conf
CP
Wen-Yang Ku, J. Christopher Beck
2016 J jnl
INFORMS J. Comput.
Tony T. Tran, Arthur Araujo, J. Christopher Beck
2016 Misc conf
ISAIM
Kyle E. C. Booth, Tony T. Tran, J. Christopher Beck
2016 conf
AAAI Workshop: Planning for Hybrid Systems
Tony T. Tran, Zhihui Wang, Minh Do, Eleanor Gilbert Rieffel, Jeremy Frank, Bryan O'Gorman, Davide Venturelli, J. Christopher Beck
2016 B conf
CPAIOR
Kyle E. C. Booth, Tony T. Tran, J. Christopher Beck
2016 A conf
ECAI
Buser Say, André A. Ciré, J. Christopher Beck
2016 J jnl
Comput. Oper. Res.
Wen-Yang Ku, J. Christopher Beck
2016 J jnl
IEEE Robotics Autom. Lett.
Kyle E. C. Booth, Tony T. Tran, Goldie Nejat, J. Christopher Beck
2016 J jnl
J. Artif. Intell. Res.
Christian J. Muise, J. Christopher Beck, Sheila A. McIlraith
2016 A* conf
KR
Roy Luo, Richard Anthony Valenzano, Yi Li, J. Christopher Beck, Sheila A. McIlraith
2016 J jnl
Constraints An Int. J.
Chee Loong Soon, Wen-Yang Ku, J. Christopher Beck
2015 J jnl
J. Sched.
Maliheh Aramon Bajestani, J. Christopher Beck
2015 B conf
CPAIOR
Wen-Yang Ku, J. Christopher Beck
2015 J jnl
AI Mag.
Stefano V. Albrecht, J. Christopher Beck, David L. Buckeridge, Adi Botea, Cornelia Caragea, Chi-Hung Chi, Theodoros Damoulas, Bistra Dilkina, Eric Eaton, Pooyan Fazli, Sam Ganzfried, Marius Lindauer, Marlos C. Machado, Yuri Malitsky, Gary Marcus, Sebastiaan A. Meijer, Francesca Rossi, Arash Shaban-Nejad, Sylvie Thiébaux, Manuela M. Veloso, Toby Walsh, Can Wang, Jie Zhang, Yu Zheng
2015 conf
AAAI Workshop: Artificial Intelligence Applied to Assistive Technologies and Smart Environments
Tiago Stegun Vaquero, Sharaf Christopher Mohamed, Goldie Nejat, J. Christopher Beck
2014 B conf
CPAIOR
Sebastian Kosch, J. Christopher Beck
2014 A* conf
ICRA
Wing-Yue Geoffrey Louie, Tiago Stegun Vaquero, Goldie Nejat, J. Christopher Beck
2014 A conf
CP
Wen-Yang Ku, Thiago Pinheiro, J. Christopher Beck
2014 B conf
CPAIOR
Wen-Yang Ku, J. Christopher Beck
2014 J jnl
J. Artif. Intell. Res.
Daria Terekhov, Tony T. Tran, Douglas G. Down, J. Christopher Beck
2014 J jnl
CoRR
Maliheh Aramon Bajestani, J. Christopher Beck
2014 J jnl
EURO J. Comput. Optim.
Peter Y. Zhang, David A. Romero, J. Christopher Beck, Cristina H. Amon
2013 A* conf
IJCAI
Christian J. Muise, J. Christopher Beck, Sheila A. McIlraith
2013 A* conf
ICAPS
Tony T. Tran, Daria Terekhov, Douglas G. Down, J. Christopher Beck
2013 conf
SARA
Maher A. Alhossaini, J. Christopher Beck
2013 J jnl
Constraints An Int. J.
Andrea Rendl, J. Christopher Beck
2013 B conf
SOCS
J. Christopher Beck, Gene Cooperman
2013 conf
SARA
J. Christopher Beck
2013 J jnl
Eng. Appl. Artif. Intell.
Tiago Stegun Vaquero, José Reinaldo Silva, J. Christopher Beck
2013 B conf
CPAIOR
Stefan Heinz, Wen-Yang Ku, J. Christopher Beck
2013 J jnl
J. Artif. Intell. Res.
Maliheh Aramon Bajestani, J. Christopher Beck
2013 B conf
CPAIOR
Peter Y. Zhang, David A. Romero, J. Christopher Beck, Cristina H. Amon
2013 J jnl
Constraints An Int. J.
Stefan Heinz, Jens Schulz, J. Christopher Beck
2013 J jnl
Knowl. Eng. Rev.
Tiago Stegun Vaquero, José Reinaldo Silva, Flavio Tonidandel, J. Christopher Beck
2012 J jnl
Auton. Agents Multi Agent Syst.
Lei Duan, Mustafa K. Dogru, Ulas Özen, J. Christopher Beck
2012 conf
Canadian AI
Christian J. Muise, Sheila A. McIlraith, J. Christopher Beck, Eric I. Hsu
2012 A* conf
ICAPS
Christian J. Muise, Sheila A. McIlraith, J. Christopher Beck
2012 A conf
ECAI
Tony T. Tran, J. Christopher Beck
2012 A* conf
ICAPS
Daria Terekhov, Tony T. Tran, Douglas G. Down, J. Christopher Beck
2012 conf
Canadian AI
Maher A. Alhossaini, J. Christopher Beck
2012 A* conf
ICAPS
Christian J. Muise, Sheila A. McIlraith, J. Christopher Beck
2012 A* conf
ICAPS
Peter Gregory, Derek Long, Maria Fox, J. Christopher Beck
2012 J jnl
INFORMS Trans. Educ.
Jill R. Hardin, Allen Holder, J. Christopher Beck, Kevin C. Furman, Arthur Hanna, David J. Rader Jr., César Rego
2012 B conf
CPAIOR
Stefan Heinz, J. Christopher Beck
2012 J jnl
Comput. Ind. Eng.
Daria Terekhov, Mustafa K. Dogru, Ulas Özen, J. Christopher Beck
2012 J jnl
INFORMS J. Comput.
Mohammad M. Fazel-Zarandi, J. Christopher Beck
2011 J jnl
CoRR
Daria Terekhov, J. Christopher Beck
2011 J jnl
Constraints An Int. J.
András Kovács, J. Christopher Beck
2011 J jnl
INFORMS J. Comput.
J. Christopher Beck, T. K. Feng, Jean-Paul Watson
2011 B ed.
CPAIOR
Tobias Achterberg, J. Christopher Beck
2011 A* conf
IJCAI
Christian J. Muise, Sheila A. McIlraith, J. Christopher Beck
2011 J jnl
CoRR
J. Christopher Beck, Nic Wilson
2011 A* conf
ICAPS
Maliheh Aramon Bajestani, J. Christopher Beck
2011 J jnl
CoRR
J. Christopher Beck
2011 J jnl
J. Sched.
Ivan Heckman, J. Christopher Beck
2010 A conf
CP
J. Christopher Beck
2010 conf
Abstraction, Reformulation, and Approximation
Christian J. Muise, Sheila A. McIlraith, J. Christopher Beck, Eric I. Hsu
2010 J jnl
AI Mag.
Vadim Bulitko, J. Christopher Beck
2009 J jnl
INFORMS J. Comput.
Daria Terekhov, J. Christopher Beck, Kenneth N. Brown
2009 J jnl
J. Sched.
Julien Bidot, Thierry Vidal, Philippe Laborie, J. Christopher Beck
2009 J jnl
Eur. J. Oper. Res.
Daria Terekhov, J. Christopher Beck
2009 ed.
SARA
Vadim Bulitko, J. Christopher Beck
2009 J jnl
Ann. Oper. Res.
J. Christopher Beck, Barbara M. Smith
2009 J jnl
J. Math. Model. Algorithms
Tom Carchrae, J. Christopher Beck
2009 J jnl
Comput. Oper. Res.
Christine Wei Wu, Kenneth N. Brown, J. Christopher Beck
2009 A conf
CP
Mohammad M. Fazel-Zarandi, J. Christopher Beck
2008 J jnl
J. Artif. Intell. Res.
Daria Terekhov, J. Christopher Beck
2008 B conf
CPAIOR
Jean-Paul Watson, J. Christopher Beck
2008 J jnl
Int. J. Artif. Intell. Tools
J. Christopher Beck, Tom Carchrae, Eugene C. Freuder, Georg Ringwelski
2008 J jnl
Eng. Appl. Artif. Intell.
András Kovács, J. Christopher Beck
2008 B conf
CPAIOR
Ivan Heckman, J. Christopher Beck
2008 A conf
CP
Eric I. Hsu, Christian J. Muise, J. Christopher Beck, Sheila A. McIlraith
2008 A* ed.
ICAPS
Jussi Rintanen, Bernhard Nebel, J. Christopher Beck, Eric A. Hansen
2007 A* conf
IJCAI
Julien Bidot, Thierry Vidal, Philippe Laborie, J. Christopher Beck
2007 B conf
CPAIOR
András Kovács, J. Christopher Beck
2007 J jnl
Knowl. Based Syst.
Alfio Vidotto, Kenneth N. Brown, J. Christopher Beck
2007 J jnl
J. Artif. Intell. Res.
J. Christopher Beck, Nic Wilson
2007 J jnl
J. Artif. Intell. Res.
J. Christopher Beck
2007 B conf
CPAIOR
Daria Terekhov, J. Christopher Beck
2007 A* conf
AAAI
Daria Terekhov, J. Christopher Beck, Kenneth N. Brown
2007 conf
SARA
J. Christopher Beck, Michael Grüninger
2006 J jnl
J. Sched.
J. Christopher Beck, Patrick Prosser, Evgeny Selensky
2006 A* conf
ICAPS
J. Christopher Beck
2006 B ed.
CPAIOR
J. Christopher Beck, Barbara M. Smith
2006 conf
SGAI Conf. (Applications)
Alfio Vidotto, Kenneth N. Brown, J. Christopher Beck
2005 J jnl
Comput. Intell.
Tom Carchrae, J. Christopher Beck
2005 conf
SARA
Tom Carchrae, J. Christopher Beck
2005 A conf
CP
Tom Carchrae, J. Christopher Beck, Eugene C. Freuder
2005 A conf
CP
J. Christopher Beck
2005 A* conf
IJCAI
J. Christopher Beck, Nic Wilson
2005 A conf
CP
Alfio Vidotto, Kenneth N. Brown, J. Christopher Beck
2005 A conf
CP
Christine Wei Wu, Kenneth N. Brown, J. Christopher Beck
2004 A conf
CP
J. Christopher Beck, Tom Carchrae, Eugene C. Freuder, Georg Ringwelski
2004 A conf
ECAI
J. Christopher Beck, Patrick Prosser, Richard J. Wallace
2004 A conf
ECAI
J. Christopher Beck, Nic Wilson
2004 A* conf
AAAI
Tom Carchrae, J. Christopher Beck
2004 B conf
CPAIOR
J. Christopher Beck, Eugene C. Freuder
2004 conf
CSCLP
J. Christopher Beck, Patrick Prosser, Richard J. Wallace
2004 A conf
CP
J. Christopher Beck, Patrick Prosser, Richard J. Wallace
2003 J jnl
Ann. Oper. Res.
J. Christopher Beck, Philippe Refalo
2003 J jnl
Artif. Intell.
Jean-Paul Watson, J. Christopher Beck, Adele E. Howe, L. Darrell Whitley
2003 A* conf
ICAPS
J. Christopher Beck, Patrick Prosser, Evgeny Selensky
2002 B conf
ICGT
J. Christopher Beck, Patrick Prosser, Evgeny Selensky
2002 conf
SARA
J. Christopher Beck, Patrick Prosser, Evgeny Selensky
2000 J jnl
Artif. Intell.
J. Christopher Beck, Mark S. Fox
2000 J jnl
Artif. Intell.
J. Christopher Beck, Mark S. Fox
2000 conf
AIPS
J. Christopher Beck
2000 J jnl
Constraints An Int. J.
J. Christopher Beck, Andrew J. Davenport, Claude Le Pape
1999 conf
AAAI/IAAI
J. Christopher Beck, Mark S. Fox
1999
J. Christopher Beck
1998 J jnl
AI Mag.
J. Christopher Beck, Mark S. Fox
1997 conf
AAAI/IAAI
J. Christopher Beck, Andrew J. Davenport, Edward M. Sitarski, Mark S. Fox
1997 A conf
CP
J. Christopher Beck, Andrew J. Davenport, Mark S. Fox
1997 conf
AAAI/IAAI
J. Christopher Beck, Andrew J. Davenport, Edward M. Sitarski, Mark S. Fox
redb/extractors/elf_extractors/elf_segments.py
← Index redb/extractors/elf_extractors/elf_segments.py python
import inspect
import hashlib
import math
from collections import Counter
from datetime import datetime, timezone
from typing import Any, List, Dict

from elftools.elf.elffile import ELFFile
from elftools.common.exceptions import ELFError

from redb.extractors.enum import Tag
from redb.extractors.elf_extractor import ELFExtractor
from redb.models.dataclasses import ELFSegment


class ELFSegmentExtractor(ELFExtractor):

    def __init__(
        self,
        filepath,
        log,
        exporters=None,
        index_prefix=None,
        elastic_index=None,
        known_benign=False,
        known_malicious=False,
        elf=None,
    ):
        super().__init__(
            filepath,
            log,
            exporters,
            index_prefix,
            elastic_index,
            known_benign,
            known_malicious,
            elf,
        )
        self.elf_segments = []
        self.elastic_index = self.index_prefix + "-elf_segments"
        self.log.debug(inspect.currentframe().f_code.co_name)

    def _is_empty_result(self, extracted_data) -> bool:
        """
        Override: Empty segments is an ERROR, not a valid empty case.
        A valid ELF file must have segments (program headers).
        """
        # Always return False - empty segments should be treated as an error
        return False

    def _calculate_entropy(self, data: bytes) -> float:
        """Calculate Shannon entropy of data."""
        if not data:
            return 0.0

        try:
            # Count frequency of each byte
            byte_counts = Counter(data)
            data_len = len(data)

            # Calculate entropy
            entropy = 0.0
            for count in byte_counts.values():
                if count > 0:
                    frequency = count / data_len
                    entropy -= frequency * math.log2(frequency)

            return entropy
        except Exception as e:
            self.log.error(f"Error calculating entropy: {e}")
            return 0.0

    def _map_segment_type(self, p_type_str: str) -> int:
        """Map segment type string to enum value."""
        type_map = {
            'PT_NULL': 0,
            'PT_LOAD': 1,
            'PT_DYNAMIC': 2,
            'PT_INTERP': 3,
            'PT_NOTE': 4,
            'PT_SHLIB': 5,
            'PT_PHDR': 6,
            'PT_TLS': 7
        }
        return type_map.get(p_type_str, 0)

    def _decode_segment_flags(self, flags: int) -> List[str]:
        """Decode segment flags to human-readable strings."""
        flag_strings = []

        if flags & 0x1:  # PF_X
            flag_strings.append('EXECUTE')
        if flags & 0x2:  # PF_W
            flag_strings.append('WRITE')
        if flags & 0x4:  # PF_R
            flag_strings.append('READ')

        return flag_strings if flag_strings else ['NONE']

    def _extract_segment_data(self, segment) -> ELFSegment:
        """Extract data from a single segment with granular error handling."""
        # Initialize with safe defaults
        segment_type = 0
        segment_type_str = 'unknown'
        segment_flags = 0
        segment_flags_str = ['NONE']
        segment_offset = 0
        segment_vaddr = 0
        segment_paddr = 0
        segment_filesz = 0
        segment_memsz = 0
        segment_align = 0
        segment_entropy = 0.0
        segment_sha256 = ""
        segment_md5 = ""

        # Try to get segment header
        header = None
        try:
            header = segment.header
        except Exception as e:
            self.log.warning(f"Could not access segment header: {e}")
            return ELFSegment(
                segment_type=segment_type, segment_type_str=segment_type_str,
                segment_flags=segment_flags, segment_flags_str=segment_flags_str,
                segment_offset=segment_offset, segment_vaddr=segment_vaddr,
                segment_paddr=segment_paddr, segment_filesz=segment_filesz,
                segment_memsz=segment_memsz, segment_align=segment_align,
                segment_entropy=segment_entropy, segment_sha256=segment_sha256,
                segment_md5=segment_md5
            )

        # Extract segment type
        try:
            p_type_str = header.get('p_type', 'PT_NULL')
            segment_type = self._map_segment_type(p_type_str)
            segment_type_str = p_type_str.replace('PT_', '') if p_type_str.startswith('PT_') else p_type_str
        except Exception as e:
            self.log.warning(f"Could not extract segment type: {e}")

        # Extract segment flags
        try:
            segment_flags = header.get('p_flags', 0)
            segment_flags_str = self._decode_segment_flags(segment_flags)
        except Exception as e:
            self.log.warning(f"Could not extract segment flags: {e}")

        # Extract segment addresses and sizes
        try:
            segment_offset = header.get('p_offset', 0)
        except Exception as e:
            self.log.warning(f"Could not extract segment offset: {e}")

        try:
            segment_vaddr = header.get('p_vaddr', 0)
        except Exception as e:
            self.log.warning(f"Could not extract segment vaddr: {e}")

        try:
            segment_paddr = header.get('p_paddr', 0)
        except Exception as e:
            self.log.warning(f"Could not extract segment paddr: {e}")

        try:
            segment_filesz = header.get('p_filesz', 0)
        except Exception as e:
            self.log.warning(f"Could not extract segment filesz: {e}")

        try:
            segment_memsz = header.get('p_memsz', 0)
        except Exception as e:
            self.log.warning(f"Could not extract segment memsz: {e}")

        try:
            segment_align = header.get('p_align', 0)
        except Exception as e:
            self.log.warning(f"Could not extract segment align: {e}")

        # Calculate entropy and hashes for segment data (most likely to fail)
        try:
            if segment_filesz > 0:
                segment_data = segment.data()
                if segment_data:
                    # Calculate entropy
                    segment_entropy = self._calculate_entropy(segment_data)

                    # Calculate hashes
                    segment_sha256 = hashlib.sha256(segment_data).hexdigest()
                    segment_md5 = hashlib.md5(segment_data).hexdigest()
        except Exception as e:
            self.log.warning(f"Could not read segment data for hashing: {e}")
            # Keep defaults (0.0, "", "")

        return ELFSegment(
            segment_type=segment_type,
            segment_type_str=segment_type_str,
            segment_flags=segment_flags,
            segment_flags_str=segment_flags_str,
            segment_offset=segment_offset,
            segment_vaddr=segment_vaddr,
            segment_paddr=segment_paddr,
            segment_filesz=segment_filesz,
            segment_memsz=segment_memsz,
            segment_align=segment_align,
            segment_entropy=segment_entropy,
            segment_sha256=segment_sha256,
            segment_md5=segment_md5
        )

    def tag(self):
        return Tag.ELF_SEGMENTS.value if hasattr(Tag, 'ELF_SEGMENTS') else "elf_segments"

    def extract(self):
        try:
            self.log.debug(inspect.currentframe().f_code.co_name)

            def extract_segments(elf):
                segments_data = []

                # Iterate through all segments with per-segment error handling
                for segment_index, segment in enumerate(elf.iter_segments()):
                    try:
                        segment_data = self._extract_segment_data(segment)
                        if segment_data:
                            segments_data.append(segment_data)
                        else:
                            self.log.warning(f"Failed to extract data for segment {segment_index}")
                    except Exception as e:
                        self.log.warning(f"Error processing segment {segment_index}: {e}")
                        # Continue processing other segments

                return segments_data

            # Check if file is valid ELF
            if not self._is_elf_file():
                self.log.error(f"No valid ELF file for {self.hash.sha256}")
                return None

            segments_data = self._with_elf_file(extract_segments)
            if segments_data is None:
                return None

            self.elf_segments = segments_data
            return self.elf_segments

        except Exception as e:
            self.log.error(f"Error extracting ELF segments {self.hash.sha256}: {e}")
            return None

    def prepare_export_data(self, exporter_type: str) -> Any:
        self.log.debug(inspect.currentframe().f_code.co_name)

        if exporter_type == "ElasticsearchExporter":
            return self.elf_segments
        elif exporter_type == "ClickHouseExporter":
            try:
                if not self.elf_segments:
                    return None

                # Prepare data arrays for all segments
                data = []
                current_time = datetime.now(timezone.utc)
                for segment in self.elf_segments:
                    row = [
                        self.sha256,
                        self.md5,
                        self.sha1,
                        segment.segment_type,
                        segment.segment_type_str,
                        segment.segment_flags,
                        segment.segment_flags_str,
                        segment.segment_offset,
                        segment.segment_vaddr,
                        segment.segment_paddr,
                        segment.segment_filesz,
                        segment.segment_memsz,
                        segment.segment_align,
                        segment.segment_entropy,
                        segment.segment_sha256,
                        segment.segment_md5,
                        current_time
                    ]
                    data.append(row)

                column_names = [
                    'sha256', 'md5', 'sha1',
                    'segment_type', 'segment_type_str', 'segment_flags', 'segment_flags_str',
                    'segment_offset', 'segment_vaddr', 'segment_paddr',
                    'segment_filesz', 'segment_memsz', 'segment_align',
                    'segment_entropy', 'segment_sha256', 'segment_md5',
                    'analysis_date'
                ]

                column_type_names = [
                    'FixedString(64)', 'FixedString(32)', 'FixedString(40)',
                    "Enum8('NULL'=0, 'LOAD'=1, 'DYNAMIC'=2, 'INTERP'=3, 'NOTE'=4, 'SHLIB'=5, 'PHDR'=6, 'TLS'=7)",
                    'LowCardinality(String)',
                    'UInt32',
                    'Array(LowCardinality(String))',
                    'UInt64', 'UInt64', 'UInt64', 'UInt64', 'UInt64', 'UInt64',
                    'Float64',
                    'FixedString(64)', 'FixedString(32)',
                    'DateTime64(3, \'UTC\')'
                ]

                if not data:
                    return None

                return (data, column_names, column_type_names)

            except Exception as e:
                self.log.error(f"Error preparing export data: {e}")
                raise

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