Rafael Barea

94 papers A* 2A 3B 7C 7Journal 39Unranked 35
YearRankTypeTitle / Venue / Authors
2024 C conf
IV
Ricardo Pizarro, Luis Miguel Bergasa, Luis Baumela, José Miguel Buenaposada, Rafael Barea
2024 C conf
IV
Rodrigo Gutiérrez-Moreno, Rafael Barea, Elena López Guillén, Felipe Arango, Pedro A. Revenga, Luis Miguel Bergasa
2024 J jnl
IEEE Trans. Intell. Transp. Syst.
Carlos Gómez Huélamo, Marcos V. Conde, Rafael Barea, Manuel Ocaña, Luis Miguel Bergasa
2024 conf
ITSC
Miguel Antunes, Luis Miguel Bergasa, Santiago Montiel-Marín, Rafael Barea, Fabio Sánchez-García, Angel Llamazares
2024 J jnl
CoRR
Miguel Antunes-García, Luis Miguel Bergasa, Santiago Montiel-Marín, Rafael Barea, Fabio Sánchez-García, Angel Llamazares
2024 conf
ROBOT
Alejandro Diaz-Diaz, Francisco Parrilla, R. De La Iglesia, Rafael Barea, Luis Miguel Bergasa
2023 J jnl
Comput. Ind. Eng.
Jorge Jabón, Sergio Corbera, Rafael Barea, Javier Martín-Rabadán
2023 conf
ITSC
Rodrigo Gutiérrez-Moreno, Carlos Gómez Huélamo, Rafael Barea, Elena López Guillén, Felipe Arango, Luis Miguel Bergasa
2023 J jnl
CoRR
Carlos Gómez Huélamo, Marcos V. Conde, Rafael Barea, Manuel Ocaña, Luis Miguel Bergasa
2023 conf
ITSC
Carlos Gómez Huélamo, Marcos V. Conde, Rodrigo Gutiérrez-Moreno, Rafael Barea, Angel Llamazares, Miguel Antunes, Luis Miguel Bergasa
2023 C conf
IV
Rodrigo Gutiérrez-Moreno, Rafael Barea, María Elena López Guillén, Juan Felipe Arango, Navil Abdeselam, Luis Miguel Bergasa
2023 conf
ITSC
Navil Abdeselam, Rodrigo Gutiérrez-Moreno, Elena López Guillén, Rafael Barea, Santiago Montiel-Marín, Luis Miguel Bergasa
2023 conf
CVPR Workshops
Carlos Gómez Huélamo, Marcos V. Conde, Rafael Barea, Luis Miguel Bergasa
2022 J jnl
Multim. Tools Appl.
Carlos Gómez Huélamo, Javier del Egido, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, Javier Araluce, Miguel Antunes
2022 C conf
IV
Javier Araluce, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, Elena López Guillén, Pedro A. Revenga
2022 J jnl
Multim. Tools Appl.
Óscar Pérez-Gil, Rafael Barea, Elena López Guillén, Luis Miguel Bergasa, Carlos Gómez Huélamo, Rodrigo Gutiérrez, Alejandro Díaz
2022 J jnl
Sensors
Almudena López-Dorado, Miguel Ortiz del Castillo, María Satue, María Jesús Rodrigo, Rafael Barea, Eva M. Sánchez-Morla, Carlo Cavaliere, José Manuel Rodríguez Ascariz, Elvira Orduna-Hospital, Luciano Boquete, Elena Garcia-Martin
2022 conf
ITSC
Carlos Gómez Huélamo, Marcos V. Conde, Miguel Ortiz, Santiago Montiel, Rafael Barea, Luis Miguel Bergasa
2022 J jnl
CoRR
Carlos Gómez Huélamo, Marcos V. Conde, Miguel Ortiz, Santiago Montiel, Rafael Barea, Luis Miguel Bergasa
2022 J jnl
Sensors
Rodrigo Gutiérrez-Moreno, Rafael Barea, Elena López Guillén, Javier Araluce, Luis Miguel Bergasa
2022 J jnl
Multim. Tools Appl.
Carlos Gómez Huélamo, Javier del Egido, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, Juan Felipe Arango, Javier Araluce, Joaquín López
2021 ed.
WAF
Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, Elena López Guillén, Pedro A. Revenga
2021 C conf
IV
Óscar Pérez-Gil, Rafael Barea, Elena López Guillén, Luis Miguel Bergasa, Carlos Gómez Huélamo, Rodrigo Gutiérrez, Alejandro Díaz
2021 J jnl
Comput. Biol. Medicine
Elena Garcia-Martin, M. Ortiz del Castillo, Luciano Boquete, Eva M. Sánchez-Morla, Rafael Barea, Carlo Cavaliere, Elisa Vilades, Elvira Orduna, María Jesús Rodrigo
2021 C conf
IV
Rodrigo Gutiérrez, Juan Felipe Arango, Carlos Gómez Huélamo, Luis Miguel Bergasa, Rafael Barea, Javier Araluce
2020 conf
WAF
Javier del Egido, Carlos Gómez Huélamo, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, Javier Araluce, Rodrigo Gutiérrez, Miguel Antunes
2020 J jnl
Sensors
Rodrigo Gutiérrez, Elena López Guillén, Luis Miguel Bergasa, Rafael Barea, Óscar Pérez-Gil, Carlos Gómez Huélamo, Juan Felipe Arango, Javier del Egido, Joaquín López
2020 conf
WAF
Óscar Pérez-Gil, Rafael Barea, Elena López Guillén, Luis Miguel Bergasa, Pedro A. Revenga, Rodrigo Gutiérrez, Alejandro Díaz
2020 J jnl
Sensors
Juan Felipe Arango, Luis Miguel Bergasa, Pedro A. Revenga, Rafael Barea, Elena López Guillén, Carlos Gómez Huélamo, Javier Araluce, Rodrigo Gutiérrez
2020 conf
WAF
Javier Araluce, Luis Miguel Bergasa, Carlos Gómez Huélamo, Rafael Barea, Elena López Guillén, Juan Felipe Arango, Óscar Pérez-Gil
2020 conf
ITSC
Carlos Gómez Huélamo, Javier del Egido, Luis Miguel Bergasa, Rafael Barea, Manuel Ocaña, Juan Felipe Arango, Rodrigo Gutiérrez-Moreno
2020 conf
WAF
Carlos Gómez Huélamo, Javier del Egido, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, Juan Felipe Arango, Javier Araluce, Joaquín López
2019 A* conf
ICRA
Joaquín López, C. Otero, Rafael Sanz, E. Paz, Eduardo J. Molinos, Rafael Barea
2019 C conf
IV
Eduardo Romera, Luis Miguel Bergasa, Kailun Yang, José M. Álvarez, Rafael Barea
2019 conf
ITSC
Rafael Barea, Luis Miguel Bergasa, Eduardo Romera, Elena López Guillén, Óscar Pérez-Gil, Miguel Tradacete, Joaquín López
2019 conf
ITSC
Luis Miguel Bergasa, Javier Araluce, Eduardo Romera, Rafael Barea, Elena López Guillén, Javier del Egido, Carlos A. Hernanz-Mayoral
2019 conf
ITSC
Carlos Gómez Huélamo, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, Juan Felipe Arango, Pablo Sánchez
2018 B conf
Intelligent Vehicles Symposium
Álvaro Sáez, Luis Miguel Bergasa, Eduardo Romera, Elena López Guillén, Rafael Barea, Rafael Sanz
2018 conf
WAF
Miguel Tradacete, Álvaro Sáez, Juan Felipe Arango, Carlos Gómez Huélamo, Pedro A. Revenga, Rafael Barea, Elena López Guillén, Luis Miguel Bergasa
2018 conf
WAF
Javier del Egido, Luis Miguel Bergasa, Eduardo Romera, Carlos Gómez Huélamo, Javier Araluce, Rafael Barea
2018 conf
ICVES
Kailun Yang, Luis Miguel Bergasa, Eduardo Romera, Dongming Sun, Kaiwei Wang, Rafael Barea
2018 conf
WAF
Esther Murciego, Carlos Gómez Huélamo, Rafael Barea, Luis Miguel Bergasa, Eduardo Romera, Juan Felipe Arango, Miguel Tradacete, Álvaro Sáez
2018 conf
ITSC
Rafael Barea, Carlos Perez, Luis Miguel Bergasa, Elena López Guillén, Eduardo Romera, Eduardo J. Molinos, Manuel Ocaña, Joaquín López
2017 J jnl
Sensors
Elena López Guillén, Sergio García, Rafael Barea, Luis Miguel Bergasa, Eduardo J. Molinos, Roberto Arroyo, Eduardo Romera, Samuel Pardo
2017 J jnl
Sensors
Carlos Amo, Luis de Santiago, Rafael Barea, Almudena López-Dorado, Luciano Boquete
2017 J jnl
Sensors
Sebastián Bronte, Luis Miguel Bergasa, Daniel Pizarro, Rafael Barea
2016 conf
ICARSC
Sergio García, María Elena López Guillén, Rafael Barea, Luis Miguel Bergasa, Alejandro Gómez, Eduardo J. Molinos
2015 J jnl
Biomed. Signal Process. Control.
Miguel Ortiz del Castillo, Luis de Santiago, Alfredo Fernández, Roman Blanco, José Manuel Rodríguez Ascariz, Rafael Barea, Juan Manuel Miguel-Jiménez, Eva M. Sánchez-Morla, Luciano Boquete
2015 J jnl
Medical Biol. Eng. Comput.
Juan Manuel Miguel-Jiménez, Roman Blanco, Luis de Santiago, A. J. Fernández-Rodríguez, José Manuel Rodríguez Ascariz, Rafael Barea, José L. Martín-Sánchez, Carlos Amo, Eva M. Sánchez-Morla, Luciano Boquete
2015 J jnl
Comput. Biol. Medicine
A. J. Fernández-Rodríguez, Luis de Santiago, Roman Blanco, C. Pérez-Rico, José Manuel Rodríguez Ascariz, Rafael Barea, Juan Manuel Miguel-Jiménez, J. R. García-Luque, M. Ortiz del Castillo, Eva M. Sánchez-Morla, Luciano Boquete
2015 conf
ROBOT (1)
Elena López Guillén, Rafael Barea, Alejandro Gómez, Álvaro Saltos, Luis Miguel Bergasa, Eduardo J. Molinos, Abdelkrim Nemra
2015 conf
ROBOT (1)
Abdelkrim Nemra, Luis Miguel Bergasa, Elena López Guillén, Rafael Barea, Alejandro Gómez, Álvaro Saltos
2015 J jnl
Comput. Biol. Medicine
Luis de Santiago, Alexander Klistorner, M. Ortiz del Castillo, A. J. Fernández-Rodríguez, José Manuel Rodríguez Ascariz, Rafael Barea, Juan Manuel Miguel-Jiménez, Luciano Boquete
2013 J jnl
Sensors
Andres F. Cela, J. Javier Yebes, Roberto Arroyo, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén
2013 B conf
Intelligent Vehicles Symposium
Javier Almazán, Luis Miguel Bergasa, José Javier Yebes Torres, Rafael Barea, Roberto Arroyo
2012 J jnl
Expert Syst. Appl.
Rafael Barea, Luciano Boquete, Sergio Ortega, Elena López Guillén, José Manuel Rodríguez Ascariz
2012 J jnl
Comput. Methods Programs Biomed.
Juan Manuel Miguel-Jiménez, Luciano Boquete, Sergio Ortega, Cristina Alén-Cordero, Rafael Barea, Roman Blanco
2011 J jnl
Sensors
Rafael Barea, Luciano Boquete, José Manuel Rodríguez Ascariz, Sergio Ortega, Elena López Guillén
2010 J jnl
Sensors
Luciano Boquete, José Manuel Rodríguez Ascariz, Rafael Barea, Joaquin Cantos-Frontela, Juan Manuel Miguel-Jiménez, Sergio Ortega
2010 J jnl
Signal Process.
David Schleicher, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, Elena López Guillén
2010 J jnl
Robotics Auton. Syst.
David Schleicher, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, Elena López Guillén
2009 conf
EUROCAST
David Schleicher, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, Elena López Guillén
2009 J jnl
IEEE Trans. Intell. Transp. Syst.
David Schleicher, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, María Elena López Guillén
2009 A* conf
ICRA
David Schleicher, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, Elena López Guillén
2008 conf
ROBIO
Elena Rogado, José Luis García, Rafael Barea, Luis Miguel Bergasa, Elena López Guillén
2008 conf
ROBIO
Rafael Barea, Luis Miguel Bergasa, Elena López Guillén, Manuel Ocaña, David Schleicher, Angel León
2007 conf
EUROCAST
Manuel Ocaña, Luis Miguel Bergasa, Miguel Ángel Sotelo, Ramón Flores, Elena López Guillén, Rafael Barea
2007 conf
EUROCAST
David Schleicher, Luis Miguel Bergasa, Manuel Ocaña, Rafael Barea, María Elena López Guillén
2007 A conf
IROS
David Schleicher, Luis Miguel Bergasa, Rafael Barea, María Elena López Guillén, Manuel Ocaña, Jesús Nuevo
2006 A conf
IROS
David Schleicher, Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, Manuel Ocaña
2006 J jnl
IEEE Trans. Intell. Transp. Syst.
Luis Miguel Bergasa, Jesús Nuevo, Miguel Ángel Sotelo, Rafael Barea, María Elena López Guillén
2006 A conf
IROS
Manuel Ocaña, Luis Miguel Bergasa, Miguel Ángel Sotelo, Ramón Flores, Elena López Guillén, Rafael Barea
2005 J jnl
Auton. Robots
María Elena López Guillén, Luis Miguel Bergasa, Rafael Barea, María Soledad Escudero
2005 J jnl
Auton. Robots
Luciano Boquete, Rafael Barea, Ricardo García, Manuel Mazo, Miguel Ángel Sotelo
2005 J jnl
IEEE Trans. Educ.
Luciano Boquete, Ignacio Bravo Muñoz, Rafael Barea, José Manuel Rodríguez Ascariz, Jose L. Martín
2004 J jnl
J. Intell. Robotic Syst.
María Elena López Guillén, Rafael Barea, Luis Miguel Bergasa, María Soledad Escudero
2003 conf
ETFA (1)
Elena López Guillén, Luis Miguel Bergasa, Rafael Barea, Marisol Escudero
2003 J jnl
Int. J. Robotics Res.
Rafael Barea, Luciano Boquete, Luis Miguel Bergasa, Elena López Guillén, Manuel Mazo
2003 conf
Applied Informatics
Luis Miguel Bergasa, Rafael Barea, Elena López Guillén, María Soledad Escudero, Luciano Boquete, Juan I. Pinedo
2003 J jnl
Microprocess. Microsystems
Luciano Boquete, Ignacio Bravo Muñoz, Rafael Barea, Miguel Ángel García
2003 conf
Applied Informatics
María Elena López Guillén, Rafael Barea, Luis Miguel Bergasa, María Soledad Escudero
2002 J jnl
Neurocomputing
Luciano Boquete, Pedro Martín, Manuel Mazo, Ricardo García, Rafael Barea, Francisco Javier Rodríguez, Ignacio Fernández
2002 J jnl
J. Intell. Robotic Syst.
Rafael Barea, Luciano Boquete, Manuel Mazo, Elena López Guillén
2001 J jnl
Neural Process. Lett.
Luciano Boquete, Luis Miguel Bergasa, Rafael Barea, Ricardo García, Manuel Mazo
2000 B conf
ICPR
Luis Miguel Bergasa, Manuel Mazo, Alfredo Gardel Vicente, Rafael Barea, Luciano Boquete
2000 B conf
ICPR
Rafael Barea, Luciano Boquete, Manuel Mazo, Elena López Guillén, Luis Miguel Bergasa
2000 B conf
ESANN
Rafael Barea, Luciano Boquete, Manuel Mazo, Elena López Guillén, Luis Miguel Bergasa
2000 B conf
ESANN
M. A. Torres, M. E. Pardo, J. M. Pupo, Luciano Boquete, Rafael Barea, Luis Miguel Bergasa
1999 conf
IWANN (2)
Pedro Martín, Manuel Mazo, Luciano Boquete, Francisco Javier Rodríguez, Ignacio Fernández, Rafael Barea, José Luis Lázaro
1999 J jnl
J. Intell. Robotic Syst.
Luciano Boquete, Ricardo García, Rafael Barea, Manuel Mazo
1998 B conf
ESANN
Luciano Boquete, Rafael Barea, Manuel Mazo, I. Aranda
1998 conf
NC
Luciano Boquete, Ricardo García, Rafael Barea, Manuel Mazo, Juan Carlos García García, Jesús Ureña, Felipe Espinosa, José Luis Lázaro, María Soledad Escudero
1998 conf
NC
Rafael Barea, Luciano Boquete, Ricardo García, Manuel Mazo, Elena López Guillén, María Soledad Escudero, Francisco Javier Rodríguez
1997 conf
Fuzzy Days
Luciano Boquete, Rafael Barea, Ricardo García, Manuel Mazo, J. A. Bernad
redb/extractors/pe_extractors/pe_dotnet.py
← Index redb/extractors/pe_extractors/pe_dotnet.py python
import inspect
import pefile
from dotnetfile import DotNetPE

import base64
from hashlib import md5
from pprint import pprint

import magic
import pefile

from redb.extractors.enum import Tag
from redb.extractors.pe_extractor import PEExtractor
from redb.models.dataclasses import PEDotNet
from datetime import datetime, timezone
import json
from typing import Any


class PEDotNetExtractor(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.pe_features = None
        self.elastic_index = self.index_prefix + "-pe_dotnet"
        self.dotnet, self.error = self._generate_dotnetfile_object()
        self.log.debug(inspect.currentframe().f_code.co_name)

    def _decode_assembly_flags(self, flag_value):
        self.log.debug(inspect.currentframe().f_code.co_name)
        ASSEMBLY_FLAGS = {
            0x00000001: "COMIMAGE_FLAGS_ILONLY",
            0x00000002: "COMIMAGE_FLAGS_32BITREQUIRED",
            0x00000004: "COMIMAGE_FLAGS_IL_LIBRARY",
            0x00000008: "COMIMAGE_FLAGS_STRONGNAMESIGNED",
            0x00000010: "COMIMAGE_FLAGS_NATIVE_ENTRYPOINT",
            0x00010000: "COMIMAGE_FLAGS_TRACKDEBUGDATA",
            0x00020000: "COMIMAGE_FLAGS_32BITPREFERRED",
        }
        flags = []
        for bit, name in ASSEMBLY_FLAGS.items():
            if flag_value & bit:
                flags.append(name)
        return flags

    def _normalize_data(self, data):
        self.log.debug(inspect.currentframe().f_code.co_name)
        if isinstance(data, str):
            return {"value": data}
        return data

    def _compute_md5(self, data):
        self.log.debug(inspect.currentframe().f_code.co_name)
        if isinstance(data, str):
            # If it's a string, encode it to first
            return md5(data.encode("raw_unicode_escape")).hexdigest()
        elif not isinstance(data, bytes):
            # If it's neither string nor bytes, convert it to string and then to bytes
            return md5(str(data).encode("raw_unicode_escape")).hexdigest()
        else:
            return md5(data).hexdigest()

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

    def extract(self):
        self.log.debug(inspect.currentframe().f_code.co_name)
        metadata = {}

        if self.error:
            metadata["Corrupted"] = self.error.args[0]
            dotnet = PEDotNet(metadata)
            self.dotnet = dotnet  # Store for later use in prepare_export_data
            return dotnet  # Return the extracted data instead of exporting directly

        metadata["info"] = {}
        try:
            available_tables = self.dotnet.existent_metadata_tables()
        except Exception as e:
            self.log.error(f"Error getting metadata tables for {self.hash.sha256}: {e}")
            available_tables = []
            metadata["info"]["PotentiallyCorrupted"] = True

        # GUID extraction
        try:
            input_string = self.dotnet.guid_stream_guids[0].string_representation
            
            formatted_uuid = (
                f"{input_string[6:8]}{input_string[4:6]}{input_string[2:4]}{input_string[0:2]}"
                f"-{input_string[10:12]}{input_string[8:10]}"
                f"-{input_string[14:16]}{input_string[12:14]}"
                f"-{input_string[16:20]}"
                f"-{input_string[20:]}"
            )
            metadata["info"]["ModuleVersionID"] = formatted_uuid
        except Exception as e:
            self.log.error(f"Error extracting GUID for {self.hash.sha256}: {e}")

        # CLR Version
        try:
            metadata["info"]["CLRversion"] = self.dotnet.get_runtime_target_version()
        except Exception as e:
            self.log.error(f"Error getting CLR version for {self.hash.sha256}: {e}")

        # Module information
        try:
            if self.dotnet.metadata_table_exists("Module"):
                metadata["info"]["AssemblyModuleName"] = self.dotnet.Module.get_module_name()
        except Exception as e:
            self.log.error(f"Error getting module info for {self.hash.sha256}: {e}")

        # Basic properties
        try:
            metadata["info"].update({
                "IsNativeNgenImage": self.dotnet.is_native_image(),
                "IsMixedAssembly": self.dotnet.is_mixed_assembly(),
                "IsWindowsFormsApp": self.dotnet.is_windows_forms_app(),
                "EntryPointToken": self.dotnet.clr_header.EntryPointToken.value,
                "HasNativeEntryPoint": self.dotnet.has_native_entry_point(),
            })
        except Exception as e:
            self.log.error(f"Error getting basic properties for {self.hash.sha256}: {e}")

        # Assembly flags
        try:
            metadata["info"]["AssemblyFlags"] = self._decode_assembly_flags(
                self.dotnet.clr_header.Flags.value
            )
        except Exception as e:
            self.log.error(f"Error getting assembly flags for {self.hash.sha256}: {e}")

        # More Metadata/Info CLR Header
        try:
            metadata["info"]["NumOfStreams"] = self.dotnet.get_number_of_streams()
            # [TODO] The following two on VT are "RVA entry point"
            #  and "Resources va" respectively. To verify.
            metadata["info"][
                "ResourcesDirectoryAddress"
            ] = self.dotnet.clr_header.ResourcesDirectoryAddress.value
            metadata["info"][
                "ResourcesDirectorySize"
            ] = self.dotnet.clr_header.ResourcesDirectorySize.value
            metadata["info"][
                "StrongNameSignatureAddress"
            ] = self.dotnet.clr_header.StrongNameSignatureAddress.value
            metadata["info"][
                "StrongNameSignatureSize"
            ] = self.dotnet.clr_header.StrongNameSignatureSize.value
            metadata["info"][
                "CodeManagerTableAddress"
            ] = self.dotnet.clr_header.CodeManagerTableAddress.value
            metadata["info"][
                "CodeManagerTableSize"
            ] = self.dotnet.clr_header.CodeManagerTableSize.value
            metadata["info"][
                "VTableFixupsAddress"
            ] = self.dotnet.clr_header.VTableFixupsAddress.value
            metadata["info"][
                "VTableFixupsSize"
            ] = self.dotnet.clr_header.VTableFixupsSize.value
            metadata["info"][
                "ExportAddressTableJumpsAddress"
            ] = self.dotnet.clr_header.ExportAddressTableJumpsAddress.value
            metadata["info"][
                "ExportAddressTableJumpsSize"
            ] = self.dotnet.clr_header.ExportAddressTableJumpsSize.value
            metadata["info"][
                "ManagedNativeHeaderAddress"
            ] = self.dotnet.clr_header.ManagedNativeHeaderAddress.value
            metadata["info"][
                "ManagedNativeHeaderSize"
            ] = self.dotnet.clr_header.ManagedNativeHeaderSize.value
        except Exception as e:
            self.log.error(f"Error getting more metadata/info clr header for {self.hash.sha256}: {e}")

        # Streams section
        try:
            metadata["Streams"] = {}
            stream_names = self.dotnet.get_stream_names()
            for name in stream_names:
                indx = stream_names.index(name)
                stream_header = self.dotnet.dotnet_stream_headers[indx]
                stream_address = self.dotnet.dotnet_streams[indx].address
                metadata["Streams"][name] = {}
                metadata["Streams"][name]["raw_name"] = base64.b64encode(
                    stream_header.Name.value
                ).decode()
                # metadata["Streams"][name]["raw_name"] = name
                metadata["Streams"][name]["size"] = stream_header.Size.value
                # Retrieve the stream data directly using the given address and size
                stream_data = self.pe.get_data(stream_address, stream_header.Size.value)
                metadata["Streams"][name]["entropy"] = (
                    "%.2f" % pefile.SectionStructure.entropy_H(self.pe, stream_data)
                )
                metadata["Streams"][name]["md5"] = md5(stream_data).hexdigest()
        except Exception as e:
            self.log.error(f"Error getting streams for {self.hash.sha256}: {e}")

        # ManifestResource
        try:
            metadata["ManifestResource"] = ()
            if "ManifestResource" in available_tables:
                metadata["info"]["HasManifestResource"] = True
                metadata["ManifestResource"] = (
                    self.dotnet.ManifestResource.get_resource_names()
                )
        except Exception as e:
            self.log.error(f"Error getting manifest resource for {self.hash.sha256}: {e}")

        # ExternalAssemblyRef
        try:
            metadata["ExternalAssemblyRef"] = {}
            if "AssemblyRef" in available_tables:
                metadata["ExternalAssemblyRef"][
                    "names"
                ] = self.dotnet.AssemblyRef.get_assemblyref_names()
                metadata["ExternalAssemblyRef"][
                    "cultures"
                ] = self.dotnet.AssemblyRef.get_assemblyref_cultures()
        except Exception as e:
            self.log.error(f"Error getting external assembly ref for {self.hash.sha256}: {e}")

        # AssemblyData
        try:
            metadata["AssemblyData"] = {}
            if "Assembly" in available_tables:
                metadata["AssemblyData"][
                    "name"
                ] = self.dotnet.Assembly.get_assembly_name()
                # It's officially a one-row table, but there are ITW files with more than one row.
                # It stores information about the current assembly. It is documented in ECMA-335.
                assembly_table = self.dotnet.metadata_tables_lookup[
                    "Assembly"
                ].table_rows[0]
                metadata["AssemblyData"][
                    "MajorVersion"
                ] = assembly_table.MajorVersion.value
                metadata["AssemblyData"][
                    "MinorVersion"
                ] = assembly_table.MinorVersion.value
                metadata["AssemblyData"]["hashalgid"] = assembly_table.HashAlgId.value
                metadata["AssemblyData"][
                    "BuildNumber"
                ] = assembly_table.BuildNumber.value
                metadata["AssemblyData"][
                    "RevisionNumber"
                ] = assembly_table.RevisionNumber.value
                metadata["AssemblyData"][
                    "culture"
                ] = self.dotnet.Assembly.get_assembly_culture()
        except Exception as e:
            self.log.error(f"Error getting assembly data for {self.hash.sha256}: {e}")

        # TypeDef handling
        try:
            metadata["TypeDef"] = {}
            if "TypeDef" in available_tables:
                metadata["info"]["HasTypeDef"] = True
                # Get basic type definitions
                try:
                    # Get all types (ANY visibility)
                    type_defs = self.dotnet.TypeDef.get_type_names()
                    metadata["TypeDef"]["names"] = type_defs if type_defs else []
                    
                    # Get detailed type information with methods
                    types_with_methods = self.dotnet.TypeDef.get_type_names_with_methods()
                    if types_with_methods:
                        metadata["TypeDef"]["detailed"] = []
                        for type_info in types_with_methods:
                            type_data = {
                                "type": type_info.Type,
                                "namespace": type_info.Namespace,
                                "flags": type_info.Flags,
                                "methods": []
                            }
                            for method in type_info.Methods:
                                method_data = {
                                    "name": method.Name,
                                    "flags": method.Flags
                                }
                                if method.Signature:
                                    method_data["signature"] = {
                                        "parameters": method.Signature.get("parameter", []),
                                        "return_type": method.Signature.get("return", ""),
                                        "has_this": method.Signature.get("hasthis", False)
                                    }
                                type_data["methods"].append(method_data)
                            metadata["TypeDef"]["detailed"].append(type_data)
                except AttributeError as e:
                    self.log.warning(f"TypeDef table exists but attributes missing for {self.hash.sha256}: {e}")
                    # metadata["info"]["TypeDefParsingError"] = f"Missing attributes: {str(e)}"
                except Exception as e:
                    self.log.error(f"Error parsing TypeDef table for {self.hash.sha256}: {e}")
                    # metadata["info"]["TypeDefParsingError"] = str(e)
        except Exception as e:
            self.log.error(f"Error handling TypeDef section for {self.hash.sha256}: {e}")
            metadata["TypeDef"] = {"names": [], "detailed": []}
            # metadata["info"]["TypeDefParsingError"] = str(e)

        # ExternalUnmanagedModules
        try:
            metadata["ExternalUnmanagedModules"] = ()
            if "ModuleRef" in available_tables:
                metadata["info"]["HasModuleRef"] = True
                metadata["ExternalUnmanagedModules"] = (
                    self.dotnet.ModuleRef.get_unmanaged_module_names(
                        self.dotnet.Type.UnmanagedModules.RAW
                    )
                )
        except Exception as e:
            self.log.error(f"Error getting external unmanaged modules for {self.hash.sha256}: {e}")

        # ExternalUnmanagedMethods
        try:
            metadata["ExternalUnmanagedMethods"] = ()
            if "ImplMap" in available_tables:
                metadata["info"]["HasImplMap"] = True
                metadata["ExternalUnmanagedMethods"] = (
                    self.dotnet.ImplMap.get_unmanaged_functions()
                )
        except Exception as e:
            self.log.error(f"Error getting external unmanaged methods for {self.hash.sha256}: {e}")

        # Event
        try:
            metadata["Event"] = ()
            if "Event" in available_tables:
                metadata["info"]["HasEvent"] = True
                metadata["Event"] = self.dotnet.Event.get_event_names()
        except Exception as e:
            self.log.error(f"Error getting event for {self.hash.sha256}: {e}")

        # Resources
        try:
            metadata["Resources"] = []
            if self.dotnet.has_resources():
                tmp_resources_list = []
                resource_data = self.dotnet.get_resources()
                for data in resource_data:
                    tmp_dict = {}
                    for resource_item in data.items():
                        if resource_item[0] == "SubResources":
                            if resource_item[1]:
                                tmp_dict["SubResources"] = {}
                                for sub_resource in resource_item[1]:
                                    for sub_resource_item in sub_resource.items():
                                        if sub_resource_item[0] == "Data":
                                            # Check if data is a sequence type that supports len()
                                            if hasattr(sub_resource_item[1], '__len__') and len(sub_resource_item[1]) > 100:
                                                tmp_dict["SubResources"]["Data"] = {}
                                                try:
                                                    # tmp_dict["SubResources"]["Data"][
                                                    #     "md5"
                                                    # ] = md5(
                                                    #     sub_resource_item[1].encode()
                                                    # ).hexdigest()
                                                    tmp_dict["SubResources"]["Data"][
                                                        "md5"
                                                    ] = self._compute_md5(
                                                        sub_resource_item[1]
                                                    )
                                                except Exception as e:
                                                    self.log.error(
                                                        f"Error in dotnet resources"
                                                        f" extraction {self.hash.sha256}: {e}"
                                                    )
                                                guess = magic.from_buffer(
                                                    sub_resource_item[1], mime=True
                                                )
                                                tmp_dict["SubResources"]["Data"][
                                                    "MimeType"
                                                ] = (guess if guess else None)
                                            else:
                                                normalized_data = self._normalize_data(
                                                    sub_resource_item[1].decode()
                                                    if isinstance(
                                                        sub_resource_item[1], bytes
                                                    )
                                                    else sub_resource_item[1]
                                                )
                                                tmp_dict["SubResources"][
                                                    sub_resource_item[0]
                                                ] = normalized_data
                                        else:
                                            tmp_dict["SubResources"][
                                                sub_resource_item[0]
                                            ] = (
                                                sub_resource_item[1].decode()
                                                if isinstance(
                                                    sub_resource_item[1], bytes
                                                )
                                                else sub_resource_item[1]
                                            )
                        elif resource_item[0] == "Data":
                            # Check if data is a sequence type that supports len()
                            if hasattr(resource_item[1], '__len__') and len(resource_item[1]) > 100:
                                tmp_dict["Data"] = {}
                                tmp_dict["Data"]["md5"] = self._compute_md5(
                                    resource_item[1]
                                )
                                guess = magic.from_buffer(resource_item[1], mime=True)
                                tmp_dict["Data"]["MimeType"] = guess if guess else None
                            else:
                                normalized_data = self._normalize_data(
                                    resource_item[1].decode()
                                    if isinstance(resource_item[1], bytes)
                                    else resource_item[1]
                                )
                                tmp_dict["Data"] = normalized_data
                        else:
                            tmp_dict[resource_item[0]] = (
                                resource_item[1].decode()
                                if isinstance(resource_item[1], bytes)
                                else resource_item[1]
                            )
                    tmp_resources_list.append(tmp_dict)
                metadata["Resources"] = tmp_resources_list
        except Exception as e:
            self.log.error(f"Error getting resources for {self.hash.sha256}: {e}")
            metadata["Resources"] = []  # Ensure we always have a valid list even on error

        dotnet = PEDotNet(metadata)
        self.dotnet = dotnet  # Store for later use in prepare_export_data
        return dotnet  # Return the extracted data instead of exporting directly


    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type == "ElasticsearchExporter":
            return self.dotnet
        elif exporter_type == "ClickHouseExporter":
            # Convert metadata to JSON string
            metadata_json = json.dumps(self.dotnet.dotnet)
            
            data = [[
                self.sha256,
                self.md5,
                self.sha1,
                metadata_json,
                datetime.now(timezone.utc)
            ]]
            
            column_names = [
                'sha256', 'md5', 'sha1', 'dotnet', 'analysis_date'
            ]
            
            if not data:
                return None

            column_type_names = [
                'String', 'String', 'String', 'JSON', 'DateTime64(3, \'UTC\')'
            ]

            return (data, column_names, column_type_names)

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