网站建设公司盈利,成都微网站开发,阿里云购买域名后怎么建网站,国外网站模板欣赏您可以尝试FILE_PRELOAD utility#xff0c;它们会生成带钩子的C代码#xff0c;编译和LD_PRELOAD它。在简短的看了一下之后#xff0c;你可以感觉到如何轻松地挂接linux。起点是this tutorial。例如#xff0c;如果你想改变文件/ tmp的“公开征集” /一些带有的/ tmp/repl…您可以尝试FILE_PRELOAD utility它们会生成带钩子的C代码编译和LD_PRELOAD它。在简短的看了一下之后你可以感觉到如何轻松地挂接linux。起点是this tutorial。例如如果你想改变文件/ tmp的“公开征集” /一些带有的/ tmp/replace_with#: FILE_PRELOAD -C Af:/tmp/some:/tmp/replace_with -- bash#: echo HaHa /tmp/some#: ll /tmp/somels: cannot access /tmp/some: No such file or directory#: cat /tmp/replace_withHaHa如果你想看到的生成的代码源只需加上“-p “选项。#: FILE_PRELOAD -p -C Af:/tmp/some:/tmp/replace_with -- bash在另外的所有generated.cpp文件你可以找到在/ tmp/$ USER/FILE_PRELOAD/CPP。与Linux的钩一个漂亮的打)生成的代码看起来是这样的#include #include #include #include #include #define I int#define C char#define S string#define P printf#define R returnusing std::map;using std::string;typedef map MAP;static I (*old_open)(const C *p, I flags, mode_t mode);extern CI open (const C *p, I flags, mode_t mode){old_open dlsym(RTLD_NEXT, open);P(open hook\n);MAP files;files[p]p;files[/tmp/some]/tmp/replace_with;S newpath files[S(p)];R old_open(newpath.c_str(), flags, mode);}# compilegcc -w -fpermissive -fPIC -c -Wall file.cppgcc -shared file.o -ldl -lstdc -o wrap_loadfile.soLD_PRELOAD./wrap_loadfile.so bashnm -D /lib/libc.so.6 | grep open # we hook this syscall