ABaDy1996

challenge

Jun 14th, 2019
459
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3. /*
  4.     twitter : @yxs
  5.     abady-blackfoxs-team
  6. */
  7. int main(int argc, char **argv) {
  8.     char *user = "root";
  9.     char pass[30] ={18,60,49,51,59,54,63,72,67,5,1,2,3};
  10.     char flag[30] = {-402, -396, -407, -401, -381, -438, -402, -389, -409, -422, -453, -409, -404, -456, -409, -471, -388, -379};
  11.     char username[30];
  12.     char password[30];
  13. user:
  14.     printf("username : ");
  15.     scanf("%s", username); 
  16.     if(strcmp(user,username)==0){
  17. pass:
  18.         printf("password : ");
  19.         scanf("%s", password);
  20.         char password1[] = {0};
  21.         int i = 0;
  22.         for (i=0; i<strlen(password); i++)
  23.         {  
  24.             password1[i] = ((int)password[i] ) - 48;
  25.         }
  26.         if(memcmp(pass,password1,strlen(pass)-1) == 0)
  27.         {
  28.             int summ = 0,ii = 0;
  29.             printf("flag: ");
  30.             for (int ii = 0; ii < strlen(password1)-1; ii++)
  31.             {
  32.                 summ += password1[ii];
  33.             }
  34.             for (int iii = 0; iii < strlen(flag); iii++)
  35.             {
  36.                 printf("%c", (flag[iii]+summ));
  37.             }
  38.         }else{
  39.             printf("username and password not match :(\n");
  40.             goto pass;
  41.         }
  42.     }else{
  43.         printf("user not found !\n");
  44.         goto user;
  45.     }
  46.     return 0;
  47.  
  48. }
RAW Paste Data