1

I learnt that we can use LD_PRELOAD to preload open() function to fake a path to a process.

I learnt it from here: Is it possible to fake a specific path for a process?

I am wondering if there is a command, which redirects a process' reading/writing file to another path? Like proxychains, it uses LD_PRELOAD.

1 Answer 1

0

Why don't you write it yourself?

#include <dlfcn.h>
#include <sys/stat.h>
#include <fcntl.h>

int
open(const char *name, int flags, mode_t mode)
{
    int (*real_open)() = dlsym(RTLD_NEXT, "open");

    if (strcmp(name, "xxzzy") == 0) {

          do my stuff
          .....
    }
    return (real_open(name, flang, mode);
}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.