c - how to use this in terminal: -


i got moddified ls:

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h>  int main(int argc, char **argv){     char command[50];     strcpy(command,"/bin/ls ");     gid_t egid = getegid();     setregid(egid, egid);     if(argc > 1) {         if(strlen(argv[1]) > 40) {             printf("the command have given long, try again.\n");             return 0;         }         strcat(command,argv[1]);         system(command);     }else{         printf("this special nsa-modified 'ls' program. see 'man ls' further details on how use it.\n");         printf("usage: %s [flags & files]\n",argv[0]);     }     return 0; } 

i have execute program called get-code don't have privileges execute without ls(the modified ls in same directory get-code program), how can fool system() execute get-code using modified ls?

the key line: strcat(command,argv[1]); how can make command more ls?

to execute multiple commands on same line, can separate them ; character. echo "hello"; echo "world" have shell execute both of commands, 1 after other. knowing that, how can make system(command); execute get-code after ls?


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -