Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
- int main(int argc, char const *argv[])
- {
- if (argc == 2)
- {
- setuid(0);
- char pwd[100], cmd[400];
- printf("New password:\n");
- scanf("%s", pwd);
- sprintf(cmd, "echo -n '%s\\n%s' | /usr/bin/passwd %s &> /dev/null", pwd, pwd, argv[1]);
- // printf("%s\n", cmd);
- // system(cmd);
- // if (!system("echo $? &> /dev/null"))
- // {
- // printf("Password for user %s is now changed successfully.\n", argv[1]);
- // } else {
- // printf("Something went wrong, password for user %s is unchanged.\n", argv[1]);
- // }
- printf("%s\n", cmd);
- } else {
- printf("./fake_passwd user\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement