tux_mind

authThread

Nov 30th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.67 KB | None | 0 0
  1.  
  2.  
  3. int authThread() {
  4.   char v8[4];
  5.   int curLine;
  6.   int i;
  7.   int v14;
  8.   int isGuest;
  9.   FILE *saltFp;
  10.   FILE *passwdFp;
  11.   char *encPswd;
  12.   char v44[32];
  13.   char salt[100];
  14.   char readBuffer[10][350];
  15.   char v1C00[10][350];
  16.   char v1C10[16];
  17.   int v1C14;
  18.   int v1C18;
  19.  
  20.   curLine = 0;
  21.   isGuest = 0;
  22.  
  23.   saltFp = fopen("salt", "r");
  24.   fscanf(saltFp, "%s", salt);
  25.   fclose(saltFp);
  26.  
  27.   passwdFp = fopen("passwd", "r");
  28.  
  29.   for(curLine=0;fgets(readBuffer[curLine], 300, passwdFp);curLine++) {
  30.    
  31.     if( readBuffer[curLine][strlen(readBuffer[curLine]) - 1] == '\n') {
  32.       readBuffer[curLine][strlen(readBuffer[curLine]) - 1] = '\0';
  33.     }
  34.    
  35.     for(i = 0; i < 300; i++ ) {
  36.      
  37.       if(readBuffer[curLine][i] != ':')
  38.     continue;
  39.     }
  40.    
  41.     if(i==300) continue;
  42.    
  43.     for(v14=0;v14<i;v14++) {
  44.       // ENCRYPT HERE ( 17 instructions from 0x0804A93 )
  45.     }
  46.    
  47.     for(v14 = i+1;v14 < 300; v14++) {
  48.       // ENCRYPT HERE ( 22 instructions from 0x08048AE0 )
  49.     }
  50.   }
  51.  
  52.   fclose(passwdFp);
  53.  
  54.   while(true) {
  55.     pthread_mutex_lock(&loginMutex);
  56.     pthread_cond_wait(&loginCond, &loginMutex);
  57.    
  58.     if(strlen(username) < 31) {
  59.      
  60.       if(!strcmp(username, "guest") && !strcmp(password, "guest")) {
  61.     isGuest=1;
  62.       }
  63.      
  64.       for(i=0; i < curLine; i++) {
  65.     if(strcmp(username, v1C00[i])) {
  66.       break;
  67.     }
  68.       }
  69.      
  70.       encPswd = crypt(salt, password);
  71.      
  72.       pthread_cond_wait(&loginCond, &loginMutex);
  73.      
  74.       if(!strcmp(readBuffer[i], encPswd) || isGuest) {
  75.     strcpy(v44, username);
  76.     strcpy(globalUsername, v44);
  77.       }
  78.      
  79.     }
  80.    
  81.     pthread_mutex_unlock(&loginMutex);
  82.   }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment