Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main(){
- struct User_login{
- int id;
- char usr[15];
- char pwd[15];
- }DB={1337,"nobody","letmein"};
- char tmp_usr[15];
- char tmp_pwd[15];
- printf("Username : ");
- fgets(tmp_usr,128, stdin);
- tmp_usr[strcspn(tmp_usr,"\n")] = '\0';
- if((strcmp(DB.usr,tmp_usr)) != 0){
- return 0;
- }
- printf("Password : ");
- fgets(tmp_pwd,128, stdin);
- tmp_pwd[strcspn(tmp_pwd,"\n")] = '\0';
- if((strcmp(DB.pwd,tmp_pwd)) != 0){
- return 0;
- }
- if(!strcmp(DB.usr,"root")){
- printf("You are root user");
- system("cat flag.txt");
- }else{
- printf("Access Granted, But you are %s\n", DB.usr);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement