![]() |
Baseer 0.2.0
Baseer is an advanced binary analysis tool designed to provide deep insights into any file.
|
ELF metadata extraction and printing interface for Baseer. More...
#include "../bparser/bparser.h"
#include "../../baseer.h"
#include <elf.h>
#include <string.h>
#include "../bx_elf_utils/bx_elf_utils.h"
#include "udis86.h"
Go to the source code of this file.
Functions | |
void | dump_elf32hdr (Elf32_Ehdr *elf) |
Dump the ELF header information for a 32-bit ELF file. | |
void | dump_elf64hdr (Elf64_Ehdr *elf) |
Dump the ELF header information for a 64-bit ELF file. | |
void | dump_elf32_shdr (Elf32_Ehdr *elf, Elf32_Shdr *shdrs, bparser *parser) |
Dump the section header table of a 32-bit ELF file. | |
void | dump_elf64_shdr (Elf64_Ehdr *elf, Elf64_Shdr *shdrs, bparser *parser) |
Dump the section header table of a 64-bit ELF file. | |
void | dump_elf32_phdr (Elf32_Ehdr *elf, Elf32_Phdr *phdr, bparser *parser) |
Dump the program header table of a 32-bit ELF file. | |
void | dump_elf64_phdr (Elf64_Ehdr *elf, Elf64_Phdr *phdr, bparser *parser) |
Dump the program header table of a 64-bit ELF file. | |
bool | print_meta_data (bparser *parser, void *args) |
Print high-level metadata of an ELF file and dispatch detailed dump functions. |
ELF metadata extraction and printing interface for Baseer.
This module provides functions to parse and print metadata from ELF files, including ELF headers, program headers, and section headers. It is used within the Baseer binary analysis framework to display detailed ELF information in a structured and colored format.
The main entry point is print_meta_data(), which determines the ELF class (32-bit or 64-bit), detects endianness, and invokes the appropriate dump functions for headers and sections.
void dump_elf32_phdr | ( | Elf32_Ehdr * | elf, |
Elf32_Phdr * | phdr, | ||
bparser * | parser ) |
Dump the program header table of a 32-bit ELF file.
This function iterates over the program headers of a 32-bit ELF file and prints metadata and raw contents for each segment.
Printed metadata includes:
Special cases:
Raw segment bytes:
elf | Pointer to the ELF header (Elf32_Ehdr). |
phdr | Pointer to the program header table (array of Elf32_Phdr). |
parser | Pointer to a bparser structure that provides access to the file data. |
void dump_elf32_shdr | ( | Elf32_Ehdr * | elf, |
Elf32_Shdr * | shdrs, | ||
bparser * | parser ) |
Dump the section header table of a 32-bit ELF file.
This function iterates over the section headers of a 32-bit ELF file and prints human-readable information for each section.
Printed metadata includes:
Raw section bytes:
elf | Pointer to the ELF header (Elf32_Ehdr). |
shdrs | Pointer to the section header table (array of Elf32_Shdr). |
parser | Pointer to a bparser structure that provides access to the file data. |
void dump_elf32hdr | ( | Elf32_Ehdr * | elf | ) |
Dump the ELF header information for a 32-bit ELF file.
This function prints human-readable information about the provided 32-bit ELF header, including:
elf | Pointer to an Elf32_Ehdr structure representing the ELF header. |
void dump_elf64_phdr | ( | Elf64_Ehdr * | elf, |
Elf64_Phdr * | phdr, | ||
bparser * | parser ) |
Dump the program header table of a 64-bit ELF file.
This function iterates over the program headers of a 64-bit ELF file and prints metadata and raw contents for each segment.
Printed metadata includes:
Special cases:
Raw segment bytes:
elf | Pointer to the ELF header (Elf64_Ehdr). |
phdr | Pointer to the program header table (array of Elf64_Phdr). |
parser | Pointer to a bparser structure that provides access to the file data. |
void dump_elf64_shdr | ( | Elf64_Ehdr * | elf, |
Elf64_Shdr * | shdrs, | ||
bparser * | parser ) |
Dump the section header table of a 64-bit ELF file.
This function iterates over the section headers of a 64-bit ELF file and prints human-readable information for each section.
Printed metadata includes:
Raw section bytes:
elf | Pointer to the ELF header (Elf64_Ehdr). |
shdrs | Pointer to the section header table (array of Elf64_Shdr). |
parser | Pointer to a bparser structure that provides access to the file data. |
void dump_elf64hdr | ( | Elf64_Ehdr * | elf | ) |
Dump the ELF header information for a 64-bit ELF file.
This function prints human-readable information about the provided 64-bit ELF header, including:
elf | Pointer to an Elf64_Ehdr structure representing the ELF header. |
bool print_meta_data | ( | bparser * | parser, |
void * | args ) |
Print high-level metadata of an ELF file and dispatch detailed dump functions.
This function reads the ELF identification bytes from the parser source memory to determine:
Based on the ELF class, it parses the ELF header, program headers, and section headers, then calls the corresponding dump functions:
parser | Pointer to a bparser structure containing the ELF file in memory. |
args | Optional arguments (currently unused). |