Olivier Laligant

33 papers A 2B 5Misc 3Journal 12Unranked 11
YearRankTypeTitle / Venue / Authors
2025 A conf
ICCAD
Ahmad Ali Haidar, Amine Abadi, Eric Fauvet, Aurore Maillard Gabon, Olivier Laligant
2023 Misc conf
MVA
Théo Petitjean, Zongwei Wu, Olivier Laligant, Cédric Demonceaux
2017 J jnl
J. Electronic Imaging
Fatima Zahra Benamar, Eric Fauvet, Antony Hostein, Olivier Laligant, Frédéric Truchetet
2016 conf
BIOSIGNALS
Ouadi Beya, Mohamad Mazen Hittawe, Nacira Zegadi, Eric Fauvet, Olivier Laligant
2015 conf
Three-Dimensional Image Processing, Measurement (3DIPM), and Applications
Florian Jampy, Antony Hostein, Eric Fauvet, Olivier Laligant, Frédéric Truchetet
2015 conf
SITIS
Ouadi Beya, Mohamad Mazen Hittawe, Taleb Alashkar, Eric Fauvet, Olivier Laligant
2015 A conf
BMVC
Qinglin Lu, Olivier Laligant, Eric Fauvet, Anastasia Zakharova
2015 J jnl
Pattern Recognit. Lett.
Qinglin Lu, Eric Fauvet, Anastasia Zakharova, Olivier Laligant
2015 conf
ICDIP
Qinglin Lu, Olivier Laligant, Eric Fauvet, Anastasia Zakharova
2015 Misc conf
MVA
Qinglin Lu, Olivier Laligant, Eric Fauvet, Anastasia Zakharova
2013 J jnl
IEEE Trans. Image Process.
Olivier Laligant, Frédéric Truchetet, Eric Fauvet
2012 J jnl
EURASIP J. Adv. Signal Process.
Bushra Jalil, Eric Fauvet, Olivier Laligant
2011 conf
ICIAP (2)
Bushra Jalil, Eric Fauvet, Olivier Laligant
2011 conf
Image Processing: Machine Vision Applications
Bushra Jalil, Ouadi Beya, Eric Fauvet, Olivier Laligant
2011 J jnl
J. Signal Inf. Process.
Bushra Jalil, Eric Fauvet, Olivier Laligant
2010 J jnl
IEEE Trans. Pattern Anal. Mach. Intell.
Olivier Laligant, Frédéric Truchetet
2010 B conf
ICIP
Bushra Jalil, Olivier Laligant, Eric Fauvet, Ouadi Beya
2010 B conf
ICPR
Bushra Jalil, Ouadi Beya, Eric Fauvet, Olivier Laligant
2009 B conf
ICIP
Nicolas Walter, Olivier Aubreton, Yohan D. Fougerolle, Olivier Laligant
2008 J jnl
J. Electronic Imaging
Frédéric Truchetet, Olivier Laligant
2008 B conf
ICIP
Nicolas Walter, Olivier Aubreton, Olivier Laligant
2007 conf
IbPRIA (2)
Magali Lemaitre, Olivier Laligant, Jacques Blanc-Talon, Fabrice Mériaudeau
2007 J jnl
IEEE Signal Process. Lett.
Olivier Laligant, Frédéric Truchetet, Fabrice Mériaudeau
2005 conf
SITIS
Magali Lemaitre, Fabrice Mériaudeau, Olivier Laligant, Jacques Blanc-Talon
2005 J jnl
Pattern Recognit.
Olivier Laligant, Frédéric Truchetet, Alain Dupasquier
2005 Misc conf
DICTA
Magali Lemaitre, Fabrice Mériaudeau, Olivier Laligant, Jacques Blanc-Talon
2004 J jnl
J. Electronic Imaging
Olivier Laligant, Remy Leconge, Frédéric Truchetet, Olivier Mahu, Alain Diou
2002 J jnl
J. Electronic Imaging
Frédéric Nicolier, Olivier Laligant, Frédéric Truchetet
2001 J jnl
J. Electronic Imaging
Frédéric Truchetet, Fred Nicolier, Olivier Laligant
2000 B conf
KES
Fred Nicolier, Anne-Claire Legrand, Olivier Laligant, Sophie Kohler, Frédéric Truchetet
1999 conf
Human Vision and Electronic Imaging
Frédéric Nicolier, Olivier Laligant, Frédéric Truchetet, Anne-Claire Legrand, Sophie Kohler
1998 conf
Three-Dimensional Image Capture and Applications
A. García, Frédéric Truchetet, Olivier Laligant, Christophe Dumont, Eric Verrecchia, Mongi A. Abidi
1997 conf
CIC
Frédéric Truchetet, Olivier Laligant, Benjamin Joanne, Lew Fock Chong Lew Yan Voon
redb/extractors/pe_extractors/pe_resources.py
← Index redb/extractors/pe_extractors/pe_resources.py python
from hashlib import sha256
import inspect
from datetime import datetime, timezone
from typing import Any

import magic
from magika import Magika
import pefile
from pefile import UnicodeStringWrapperPostProcessor

from redb.extractors.enum import Tag
from redb.extractors.pe_extractor import PEExtractor
from redb.models.dataclasses import PEResource


class PEResourceExtractor(PEExtractor):

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

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

    def _extract_resources(self):
        """
        Returns:
        resources: a list of dictionaries, one per each resources type found.
                    each dictionary the key represents the name of the content,
                    which is the value itself.
                    Empty list if no resources present.
        """
        self.log.debug(inspect.currentframe().f_code.co_name)
        resources_list = []
        try:
            if hasattr(self.pe, "DIRECTORY_ENTRY_RESOURCE"):
                for resource_type in self.pe.DIRECTORY_ENTRY_RESOURCE.entries:
                    # if resource_type.name is not None:
                    #     name = resource_type.name
                    # else:
                    #     name = pefile.RESOURCE_TYPE.get(resource_type.struct.Id)
                    # if not name:
                    #     name = resource_type.struct.Id
                    name = (
                        resource_type.name
                        if resource_type.name is not None
                        else pefile.RESOURCE_TYPE.get(resource_type.struct.Id)
                    )
                    if isinstance(name, UnicodeStringWrapperPostProcessor):
                        name = name.decode()
                    try:
                        if hasattr(resource_type, "directory"):
                            for resource_id in resource_type.directory.entries:
                                if hasattr(resource_id, "directory"):
                                    for resource_lang in resource_id.directory.entries:
                                        rsrc_data = self.pe.get_data(
                                            resource_lang.data.struct.OffsetToData,
                                            resource_lang.data.struct.Size,
                                        )
                                        file_type = magic.from_buffer(rsrc_data)
                                        magik = Magika().identify_bytes(rsrc_data).output.label

                                        rsrc_entropy = (
                                            "%.2f"
                                            % pefile.SectionStructure.entropy_H(
                                                self.pe, rsrc_data
                                            )
                                        )
                                        rsrc_sha256 = sha256(rsrc_data).hexdigest()
                                        lang = pefile.LANG.get(
                                            resource_lang.data.lang, "*unknown*"
                                        )
                                        sublang = pefile.get_sublang_name_for_lang(
                                            resource_lang.data.lang,
                                            resource_lang.data.sublang,
                                        )
                                        pe_resource = PEResource(
                                            _id=rsrc_sha256,
                                            resource_type=name,
                                            resource_entropy=rsrc_entropy,
                                            resource_sha256=rsrc_sha256,
                                            resource_filetype=file_type,
                                            resource_magika=magik,
                                            resource_language=lang,
                                            resource_rva=resource_lang.data.struct.OffsetToData,
                                            resource_size=resource_lang.data.struct.Size,
                                            resource_sub_lang=sublang,
                                        )
                                        resources_list.append(pe_resource)
                    except Exception as e:
                        self.log.warning(
                            f"Continue after Error in {self.hash.sha256}: {resource_type.name} "
                            f"Exception: {e}",
                            stack_info=True,
                        )
                        # resources_list.append({f"{e} - {resource_type.name}"})
                        continue
        except Exception as e:
            self.log.exception(
                f"Extract exports error {self.hash.sha256} Exception: {e}"
            )
        self.log.debug(f"Resource list {resources_list}")
        return resources_list

    def extract(self):
        try:
            self.log.debug(inspect.currentframe().f_code.co_name)
            resources = self._extract_resources()
            # self.export_to_elastic(resources)  # Let the exporters handle this
            return resources
        except Exception as e:
            self.log.error(f"Extract resources error {self.hash.sha256} Exception: {e}")
            return None

    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type == "ElasticsearchExporter":
            return self.extract()
        elif exporter_type == "ClickHouseExporter":
            resources = self.extract()
            if resources is None:
                return None
            
            data = []
            current_time = datetime.now(timezone.utc)
            
            for resource in resources:
                data.append([
                    self.sha256,                    # sha256
                    self.md5,                       # md5
                    self.sha1,                      # sha1
                    resource.resource_type,         # resource_type
                    resource.resource_entropy,      # resource_entropy
                    resource.resource_sha256,       # resource_sha256
                    resource.resource_filetype,     # resource_filetype
                    resource.resource_magika,       # resource_magika
                    resource.resource_language,     # resource_language
                    resource.resource_sub_lang,     # resource_sub_lang
                    resource.resource_size,         # resource_size
                    resource.resource_rva,          # resource_rva
                    current_time                    # analysis_date
                ])
            
            column_names = [
                'sha256', 'md5', 'sha1', 'resource_type', 'resource_entropy',
                'resource_sha256', 'resource_filetype', 'resource_magika',
                'resource_language', 'resource_sub_lang', 'resource_size',
                'resource_rva', 'analysis_date'
            ]
            
            if not data:
                return None

            column_type_names = [
                'FixedString(64)', 'FixedString(32)', 'FixedString(40)',
                'LowCardinality(Nullable(String))', 'Float64',
                'FixedString(64)', 'LowCardinality(Nullable(String))', 'LowCardinality(Nullable(String))',
                'LowCardinality(Nullable(String))', 'LowCardinality(Nullable(String))', 'UInt64',
                'UInt64', 'DateTime64(3, \'UTC\')'
            ]

            return (data, column_names, column_type_names)

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