Advertisement
Guest User

Untitled

a guest
May 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int check_authentication(char *password){
  6.     char password_buffer[16];
  7.     int auth_flag=0;
  8.  
  9.     strcpy(password_buffer,password);
  10.  
  11.     printf("%s\n", password_buffer);
  12.  
  13.     if(strcmp(password_buffer,"brillig")==0)
  14.         auth_flag=1;
  15.     if(strcmp(password_buffer,"outgrabe")==0)
  16.         auth_flag=1;
  17.  
  18.     return auth_flag;
  19. }
  20.  
  21. int main(int argc,char *argv[]){
  22.     if(argc<2){
  23.         printf("Usage:%s <password> \n", argv[0]);
  24.         exit(0);
  25.     }
  26.     if(check_authentication(argv[1])){
  27.         printf("\n-=-=-=-=-=-=-=-=-=-=-=--=-=-=--=-=-=-=-=\n");
  28.         printf("               Access Granted             \n");
  29.         printf("\n-=-=-=-=-=-=-=-=-=-=-=--=-=-=--=-=-=-=-=\n");
  30.     }else{
  31.         printf("\nAccess Denied.\n");
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement