A simple library for the manipulation of extant elf files
C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README

Manipulate ELF executables

This tool modifies the .text section of ELF executables

    number | print number of bytes in the .text section
       get | print the nth byte in the .text section
       set | set the nth byte in the .text section to a value
       out | write the modified elf data to a file

Installation

    make
    make install

Examples

    $ rw-elf -h
    rw-elf ELF [ACTIONS..]
    load ELF format FILE and perform ACTIONS

    Actions:
      -h          print this help information
      -n          print the number of .text bytes
      -s ID       get the value of .text byte ID
      -s ID NUM   set the value of .text byte ID to NUM
      -o OUTFILE  write current contents to OUTFILE

    $ rw-elf hello -n
    404

    $ rw-elf hello -g 402 -g 403
    66
    90

    $ rw-elf hello -s 402 90 -o hello2

    $ rw-elf hello2 -g 402 -g 403     
    90
    90

    $ diff hello hello2
    Binary files hello and hello2 differ

    $ ./hello2
    hello