¸çĥ° ÇØ¸Þ°í Àֳ׿ä
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int main(){
char command[256];
char expand[256];
printf("I will let you execute a single command...\n");
printf("Try and get a shell with the command!\n");
fgets(command, 255, stdin);
readlink(strtok(command, "\n"), expand, 255);
if(strncmp(expand, "/bin/sh", 7) && strncmp(expand, "dash", 4)){
printf("Nope! You always want to run /bin/sh\n");
exit(0);
}
if(strstr(command, "sh")){
printf("Almost... try to use a different name!\n");
exit(0);
}
system(command);
return 0;
}
|