redhook 0.1.0

Dynamic function call interposition / hooking (LD_PRELOAD) for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

preload () {
    local library
    library=$1
    shift
    if [ "$(uname)" = "Darwin" ]; then
        DYLD_INSERT_LIBRARIES=target/debug/"$library".dylib "$@"
    else
        LD_PRELOAD=target/debug/"$library".so "$@"
    fi
}

set -ex

cd examples/readlinkspy
cargo build
preload libreadlinkspy ls -l /dev/stdin | grep readlink