Created
May 15, 2019 09:23
-
-
Save lionaneesh/765b4e0ede17502a2a195d8a56527210 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| int main(int argc, char **argv){ | |
| FILE *fp = fopen("level10.pass", "r"); | |
| struct {char pass[20], msg_err[20];} pwfile = {{0}}; | |
| char ptr[0]; | |
| if(!fp || argc != 2) | |
| return -1; | |
| fread(pwfile.pass, 1, 20, fp); | |
| pwfile.pass[19] = 0; | |
| ptr[atoi(argv[1])] = 0; | |
| fread(pwfile.msg_err, 1, 19, fp); | |
| fclose(fp); | |
| if(!strcmp(pwfile.pass, argv[1])) | |
| execl("/bin/sh", "sh", 0); | |
| else | |
| puts(pwfile.msg_err); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment