![]() |
Baseer 0.2.0
Baseer is an advanced binary analysis tool designed to provide deep insights into any file.
|
Functions for parsing and printing ELF file metadata. More...
#include "b_elf_metadata.h"
#include "../b_hashmap/b_hashmap.h"
#include <elf.h>
#include <string.h>
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. |
Functions for parsing and printing ELF file metadata.
This module provides utilities to extract and display metadata from ELF binaries. It determines the ELF class (32-bit or 64-bit), endianness, and dispatches specialized functions to dump headers:
The output is formatted with colors for readability.
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). |