Skip to content

AnmiTaliDev/libief

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libief

A C library for reading and writing Improved Executable Format (IEF) files.

Building

The project uses Meson and Ninja build systems.

meson setup build
meson compile -C build

To install the library:

meson install -C build

To build without tests:

meson setup build -Dtests=false

Testing

Run the internal test suite to verify library functionality:

meson test -C build

Usage Example

Minimal example of creating a 64-bit executable for x86_64:

#include <ief/ief.h>
#include <ief/writer.h>
#include <stdint.h>

int main(void) {
    /* Initialize builder for 64-bit LE executable */
    IEF_Builder *b = ief_builder_new(IEF_CLASS_64, IEF_ENDIAN_LE,
                                     IEF_TYPE_EXEC, IEF_ARCH_X86_64);
    
    ief_builder_set_entry(b, 0x401000);
    ief_builder_set_image_base(b, 0x400000);

    /* Code: xor rax, rax; ret */
    uint8_t code[] = { 0x48, 0x31, 0xC0, 0xC3 };
    
    ief_builder_add_section(b, ".text", IEF_SHT_CODE,
                            IEF_SHF_READ | IEF_SHF_EXEC | IEF_SHF_ALLOC,
                            code, sizeof(code), 0x401000, sizeof(code), 16);

    /* Write to disk */
    ief_builder_write(b, "example.ief");
    
    ief_builder_free(b);
    return 0;
}

Documentation

Comprehensive documentation of all structures, constants, and API functions is available in docs/api.md.

License

libief is distributed under the terms of the LGPL-3.0-or-later license.

About

A C library for reading and writing Improved Executable Format (IEF) files.

Topics

Resources

License

Stars

Watchers

Forks

Contributors