5 unstable releases
new 0.3.2 | Apr 19, 2025 |
---|---|
0.3.1 | Apr 16, 2025 |
0.3.0 | Apr 11, 2025 |
0.2.0 | Mar 31, 2025 |
0.1.0 | Mar 30, 2025 |
#1050 in Encoding
496 downloads per month
245KB
6K
SLoC
elb-cli
Command-line utility for ELF files with the following features.
- Inspect ELF contents.
- Prints ELF dependencies.
- Patch
RPATH
,RUNPATH
and program interpreter. - Relocate ELF files together with their dependencies to a different system
(this involves patching
RUNPATH
and program interpreter).
Based on elb
crate.
Installation
cargo install elb-cli
# symlink `elb-cli` to `elb`
ln -s $(which elb-cli) $(dirname $(which elb-cli))/elb
Usage
Show header/sections/segments/tables
$ elb show -t header /bin/sh
Class: Elf64
Byte order: LittleEndian
OS ABI: Sysv
ABI version: 0
File type: Executable
Machine: X86_64
Flags: 0x0
Entry point: 0x41fa60
Program header: 0x40..0x318
Section header: 0xdcce8..0xdd3e8
$ elb show -t all /bin/sh
...
Show dependencies
$ elb deps -f list --names-only /bin/ls
libgcc_s.so.1
ld-linux-x86-64.so.2
libc.so.6
libcap.so.2.64
$ elb deps -f tree --names-only /bin/ls
ls
├── libcap.so.2.64
│ ├── libgcc_s.so.1
│ │ ╰── libc.so.6
│ │ ╰── ld-linux-x86-64.so.2
│ ├── libc.so.6
│ │ ╰── ld-linux-x86-64.so.2
│ ╰── ld-linux-x86-64.so.2
├── libc.so.6
│ ╰── ld-linux-x86-64.so.2
╰── ld-linux-x86-64.so.2
Patch ELF
$ elb patch \
--set-interpreter /chroot/lib64/ld-linux-x86-64.so.2 \
--set-dynamic RUNPATH=/chroot/lib64:/chroot/usr/lib64 \
/chroot/bin/ls
Dependencies
~1.8–9MB
~77K SLoC