понедельник, 28 ноября 2016 г.

Cracks me - static

http://wormholetravel.net/
Cracks me - the very simple static example. We have got a tool.

Open it in Ollydbg

And make run tryint the analysis the application. Here we can see the header


Here the assembler code of tool 


Ok. This is Ollydbg investigation and we see that the password. static and doesn't generated by algorithm.

We use IDA 6.6 and find there the function
//IDA disassembler
signed int sub_EB1000()
{
sub_EB1136((int)aEnterLogin, v2);
sub_EB11E5(aS, v7, 64);

sub_EB1136((int)aEnterPassword, v0);
sub_EB11E5(aS_0, v6, 64);

v3 = strlen(v7);
v4 = strlen(v6);
if ( v3 == v4 ) {
 for ( i = 0; i < (signed int)v3; ++i ) {
  if ( v7[i] != v6[v4 - 1 - i] ) {
   sub_EB1136((int)aIncorrectPas_0, v3);
   return 1;
  }
 }
    sub_EB1136((int)aPasswordIsCorr, v3);
 result = 0;
}
else {
 sub_EB1136((int)aIncorrectPassw, v3);
 result = 1;
}
  return result;
}

We can rewrite this code in C.

#include <stdio.h> 
#include <string.h> 

int main(void)
{
    char log[64];  
    char pass[64];  
    int i;     
    int result;    
printf("EnterLogin \n"); 
scanf("%s", log);   

printf("EnterPassword \n");
scanf("%s", pass);

signed int v3 = strlen(log); 
int v4 = strlen(pass);

if ( v3 == v4 )     
 {
 for ( i = 0; i < v3; ++i )     
  {
  if ( log[i] != pass[v4 - 1 - i] )   
  {
   printf("%c IncorrectPas_0", v3);
   return 1;
  }
 }
    printf("%c PasswordIsCorr", v3);
 result = 0;
}
else
{
 printf("%c IncorrectPassw", v3);
 result = 1;
}

 getchar();
 getchar();

  return result;
}

The first if checks if entered to a string length. If they are equal, it checks the input string is inverted with the login password string. if (! v7 [I] = v6 [v4 - 1 - I]), v7 [i] - i-th character string with login v6 [v4 - 1 - I] - "v4-1-I 'th character from the password where v4- length string with a password, -1 because Xi numbering starts with 0 and "length of the string minus 1."


Here is a sample text keygens for this task:
#include "stdio.h"
int main() {
 char login[100];
 printf("Enter Login:");
 scanf("%s", login);
 printf("Password: ");
 for (int i = strlen(login) - 1; i <= 0; --i) {
  putchar(login[i]);
 }
 return 0;
}

Here's a crack compiles and produces the correct result:
#include "stdio.h"
#include "string.h"
int main() {
    char login[100];
    printf("Enter Login:");
    scanf("%s", login);
    printf("Password: ");
    for (int i = strlen(login) - 1; i >= 0; --i) {
        printf("%c", login[i]);
    }
    printf("\n");
    return 0;

}

Комментариев нет:

Отправить комментарий