首页 > 技术文章 > 注册机代码~

distanceblog 2016-04-09 00:16 原文

做看雪的crackme才看出差距,包含的东西比别的多。

这个ck没别的,用代码校验和来做反调试,于是下硬件断点,直接还原上代码

// Reverse11.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "windows.h"

int _tmain(int argc, _TCHAR* argv[])
{
    char username[30] = { 0 };
    char password[30] = { 0 };
    scanf_s("%s", username, 30);
    scanf_s("%s", password, 30);

    BYTE v1 = 0;
    BYTE v2 = 0;
    char str[] = "ZWATRQLCGHPSXYENVBJDFKMU";
    if (password[1] != 'E' || strlen(password) != 0xa)
    {
        printf_s("wrong");
        system("pause");
        return 0;
    }
    for (int i = 0; i < strlen(password); i++)
    {
        if (password[i]<'A' || password[i]>'Z')
        {
            printf_s("wrong");
            system("pause");
            return 0;
        }
            
    }
    int temp1 = 0;
    for (int i = 0; i < strlen(username); i++)
    {
        temp1 += username[i];
    }
    v1 = temp1 % 0x18;
    int temp2 = 0;
    for (int i = 0; i < 9; i++)
    {
        temp2 += password[i];
    }
    v2 = temp2 / 0x9;

    if (v1 > 0x18)
    v1 -= 0x18;
    if (password[0] != str[v1])
    {
        printf_s("wrong");
        system("pause");
        return 0;
    }

    BYTE v3 = v1 + (v1 + 0x18);
    if (v3 > 0x18)
    v3 -= 0x18;
    if (password[2] != str[v3])
    {
        printf_s("wrong");
        system("pause");
        return 0;
    }
    for (int i = 2; i < 8; i++)
    {
        v1 -= 0x41;
        v3 += v1;
        if (v3 > 0x18)
            v3 -= 0x18;
        if (password[i] != str[v3])
        {
            printf_s("wrong");
            system("pause");
            return 0;
        }
    }
    if (v2 == password[9])
    {
        printf_s("right");
        system("pause");
        return 0;
    }


    return 0;
}

 

推荐阅读