逆向入门(25、26)程序逆向篇-KeygenMe,MexeliteCRK1
0x01 KeygenMe
这程序打开吓我一跳, 我还以为要过检测呢
放进dbg
里面才发现算法其实还挺简单的
就是结果比较有点意思,这里的dword 403138
它是读输入序列号的位置,也就是这个序列号最多也就4
个字符,这个字符转换为ascii
要和算法最后算出来的结果相同,这就导致了有很多用户名是算不出正确的序列号的,因为有些值转成ascii
码以后成了不可输入的字符了。这里我自己试了好几次,发现用户名为8
个时候,生成的值都是满足条件的,所以就根据上面的算法写出了注册机,其实原理非常简单,就是根据上面的算法算出一个十六进制数,然后将这个十六进制的数进行倒序进行ascii
转换输出就可以了,注册机如下
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> // 用于std::setw和std::setfillint main() {std::string username;printf( "用户名: ");std::getline(std::cin, username);int userLen = username.length();if (userLen != 8 ) {printf("用户名长度必须为8位");return 1;}int esi = 0;for (int i = 0;i < userLen;i++) {int edx = username[i];int ebx = edx * edx;esi += ebx;ebx = edx >> 1;ebx += 3;ebx = ebx * edx;ebx -= edx;esi += ebx;esi *= 2;}// 将esi转换为固定长度的十六进制字符串(8位)std::stringstream ss;ss << std::hex << std::setw(8) << std::setfill('0') << esi;std::string hexKey = ss.str();printf("KeyNum: %s\nKey:", hexKey.c_str());for (int i = 6;i >= 0;i -= 2) {// 提取两个十六进制字符std::string byteStr = hexKey.substr(i, 2);// 将十六进制字符串转换为整数int byteValue;std::stringstream converter;converter << std::hex << byteStr;converter >> byteValue;// 直接输出转换后的ASCII字符putchar(static_cast<char>(byteValue));}return 0;
}
虽然最后生成的字符不知道是啥,但是不影响,直接放进程序里面注册就好了。
0x02 MexeliteCRK1
这个挺简单的,直接填入字符串就可以了
搞定了,真水啊