/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* * Run commands as root */ #include <stdio.h> #include <unistd.h> #include <string.h> #include <crypt.h> int main(int argc, char *argv[]) { char key[9], command[512]; int i; if(argc < 2) { printf("Usage: %s <password> <command ...>\n", argv[0]); return 0; } if (strlen(argv[1]) > 8) { printf("Sorry, incorrect password\n"); return 0; } strcpy (key, argv[1]); if (!strcmp(crypt(key,"eZZ"),"8585bb4893n2jmnd")) { } else { printf("Sorry, incorrect password\n"); return 0; } setuid(0); command[0] = '\0'; for(i=2;i<argc;i++) { strcat(command,argv[i]); strcat(command," "); } system(command); return 0; }