Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct {
- char username[20];
- char password[16];
- } Login;
- char password[] = "follow_@wtfsper";
- int check_password(Login *login) {
- int result = 0;
- char buff[16];
- printf("password: ");
- scanf("%s", buff);
- strcpy(login->password, buff);
- if(strncmp(login->password, password, sizeof(password)) == 0)
- result = 1;
- return result;
- }
- int main(int argc, char** argv) {
- Login l;
- printf("*****************************************************************\n");
- printf("* WELCOME TO UNIVERSITY OF TEXAS(S) *\n");
- printf("* GRADE REPORT SYSTEM - 3.2.1 *\n");
- printf("* *\n");
- printf("* PLEASE LOGIN TO *\n");
- printf("* ACCESS GRADES *\n");
- printf("*****************************************************************\n");
- printf("username: ");
- scanf("%20s", l.username);
- int auth = check_password(&l);
- printf("%d\n", auth);
- if (auth == 0) {
- printf("auth failed :( \n");
- return 0;
- } else if (auth == 1) {
- system("cat grades.txt");
- } else if (auth == 2) {
- system("/bin/sh");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement