开发者

Understanding "intercepting" of commands in linux

开发者 https://www.devze.com 2023-03-12 06:52 出处:网络
Some commands in linux, eg. ssh-agent $BASH makes 开发者_StackOverflowsure that certain actions from commands run in the present console is \"intercepted\" by another tool. How does this work in gener

Some commands in linux, eg. ssh-agent $BASH makes 开发者_StackOverflowsure that certain actions from commands run in the present console is "intercepted" by another tool. How does this work in general ? What topics should I study in order to understand this ? Lets say I wanted to make a tool that would redirect all disk-write action from all processes started afterwards to a location I specify (tired of having all sorts of crap written to strange locations on my disk, eg ~/.adobe/Flash_Player/AssetCache), how would the fundamental structure of such an app look ? Would one have to go below RING3 level ?


ELF allows interposing shared objects. On Linux, you can interpose a shared object before everything else on the symbol lookup scope of dynamic executables using LD_PRELOAD, e.g:

export LD_PRELOAD=/lib/libSegFault.so
0

精彩评论

暂无评论...
验证码 换一张
取 消