吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3550|回复: 29
收起左侧

[CrackMe] 小白c++手写cm,无壳

  [复制链接]
ljlVink 发表于 2021-5-22 16:39
CM是什么?Crackme是什么?这是什么东西?楼主发的什么?
他们都是一些公开给别人尝试破解的小程序,制作 Crackme 的人可能是程序员,想测试一下自己的软件保护技术,也可能是一位 Cracker,想挑战一下其它 Cracker 的破解实力,也可能是一些正在学习破解的人,自己编一些小程序给自己破解,KeyGenMe是要求别人做出它的 keygen (序号产生器), ReverseMe 要求别人把它的算法做出逆向分析, UnpackMe 是要求别人把它成功脱壳,本版块禁止回复非技术无关水贴。

tips:密码无数种,但只要一种就行



求过程 谢谢大佬们

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册[Register]

x

免费评分

参与人数 6吾爱币 +8 热心值 +6 收起 理由
T胖 + 1 + 1 我很赞同!
小菜鸟一枚 + 1 + 1 用心讨论,共获提升!
azcolf + 1 + 1 热心回复!
一梦天荒 + 1 我很赞同!
yan182 + 1 + 1 用心讨论,共获提升!
涛之雨 + 4 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

iTruth 发表于 2021-5-22 19:55
代码分析完了,但解密出来的东西对不上。我也不清楚是哪里的问题,下面是我的分析还请大佬赐教!
[C++] 纯文本查看 复制代码
int __cdecl main(int argc, const char **argv, const char **envp)
{
  unsigned int v3; // eax
  int result; // eax
  int idx_u2; // eax
  signed int pwd_map_copy_len; // [esp+1Ch] [ebp-3Ch]
  signed int other_table_len; // [esp+20h] [ebp-38h]
  signed int v8; // [esp+24h] [ebp-34h]
  int n; // [esp+28h] [ebp-30h]
  signed int m; // [esp+2Ch] [ebp-2Ch]
  int l; // [esp+30h] [ebp-28h]
  int k; // [esp+34h] [ebp-24h]
  signed int other_table_idx; // [esp+38h] [ebp-20h]
  int middle_output_to_cpy_idx; // [esp+3Ch] [ebp-1Ch]
  int final_index; // [esp+40h] [ebp-18h]
  signed int j; // [esp+44h] [ebp-14h]
  int i; // [esp+48h] [ebp-10h]
  int cpy_pwd_map_index; // [esp+4Ch] [ebp-Ch]

  __main();
  v3 = time(0);
  srand(v3);
  std::operator<<<std::char_traits<char>>((std::ostream::sentry *)&std::cout, "password:");
  std::operator>><char,std::char_traits<char>>((std::istream::sentry *)&std::cin, enter_pwd);
  if ( pwd_check_and_build_other_table() == -5 )// 第一次检查密码,并构建other_table
  {
    std::operator<<<std::char_traits<char>>((std::ostream::sentry *)&std::cout, "err\n");
    getchar();
    getchar();
    result = 0;
  }
  else
  {
    cpy_pwd_map_index = 0;
    for ( i = 0; i <= 25; ++i )                 // 拷贝密码表,已dump
                                                // 8311 7999 9691 1511 5701 1710 8323 3328 9111 1173 9118 1013 2991 1497 9910 7101 1003 2116 1041 0132 1129 7115 1151 1911 1114 1000
    {
      v8 = strlen(&pwd_map[1000 * i]);
      for ( j = 0; j < v8; ++j )
      {
        idx_u2 = cpy_pwd_map_index++;
        pwd_map_copy[idx_u2] = pwd_map[1000 * i + j];
      }
    }
    other_table_len = strlen(other_table);
    pwd_map_copy_len = strlen(pwd_map_copy);
    final_index = 0;
    middle_output_to_cpy_idx = 0;
    for ( other_table_idx = 0; other_table_idx < other_table_len; ++other_table_idx )// 遍历other_table
    {
      if ( other_table[other_table_idx] == 50 ) // 针对other_table每一个字符'2'
      {
        for ( k = final_index; final_index + 2 > k; ++k )// 遍历final_index~final_index+2,取两位pwd_map_copy
        {
          if ( k == final_index )               // 第一次进入这个for循环
            middle_output_to_cpy[middle_output_to_cpy_idx] += 10 * (pwd_map_copy[k] - 48);
          if ( final_index + 1 == k )           // 第二次进入这个for循环
            middle_output_to_cpy[middle_output_to_cpy_idx] += pwd_map_copy[k] - 48;
        }
        ++middle_output_to_cpy_idx;
        final_index += 2;
      }
      if ( other_table[other_table_idx] == 51 ) // 针对other_table每一个字符'3'
      {
        for ( l = final_index; final_index + 3 > l; ++l )// 遍历final_index~final_index+3,取三位pwd_map_copy
        {
          if ( l == final_index )               // 第一次进入这个for循环
            middle_output_to_cpy[middle_output_to_cpy_idx] = 100 * (pwd_map_copy[l] - 48);
          if ( final_index + 1 == l )           // 第二次进入这个for循环
            middle_output_to_cpy[middle_output_to_cpy_idx] += 10 * (pwd_map_copy[l] - 48);
          if ( final_index + 2 == l )           // 第三次进入这个for循环
            middle_output_to_cpy[middle_output_to_cpy_idx] += pwd_map_copy[l] - 48;
        }
        ++middle_output_to_cpy_idx;
        final_index += 3;
      }
    }
    for ( m = 0; m < pwd_map_copy_len; ++m )    // 下面就是将middle_output_to_cpy拷贝至final_output里输出
      final_output[m] = middle_output_to_cpy[m];
    for ( n = 0; n <= 39; ++n )
      std::operator<<<std::char_traits<char>>((std::ostream::sentry *)&std::cout, final_output[n]);
    std::ostream::operator<<(std::endl<char,std::char_traits<char>>);
    result = 0;
  }
  return result;
}

[C++] 纯文本查看 复制代码
// 返回0正确,返回-5错误
int pwd_check_and_build_other_table(void)
{
  int v1; // eax
  int v2; // eax
  int v3; // eax
  char enter_pwd_idx_i; // [esp+1Fh] [ebp-19h]
  int j; // [esp+24h] [ebp-14h]
  int i; // [esp+28h] [ebp-10h]
  int other_table_construct_index; // [esp+2Ch] [ebp-Ch]

  other_table_construct_index = 0;
  if ( strlen(enter_pwd) != 41 )
    return -5;
  for ( i = 0; i <= 96; ++i )                   // 根据enter_pwd填写other_table
  {
    enter_pwd_idx_i = enter_pwd[i];
    if ( enter_pwd_idx_i == 94
      || enter_pwd_idx_i == 106
      || enter_pwd_idx_i == 108
      || enter_pwd_idx_i == 102
      || enter_pwd_idx_i == 110
      || enter_pwd_idx_i == 120
      || enter_pwd_idx_i == 35
      || enter_pwd_idx_i == 33
      || enter_pwd_idx_i == 37
      || enter_pwd_idx_i == 99
      || enter_pwd_idx_i == 52
      || enter_pwd_idx_i == 57
      || enter_pwd_idx_i == 103
      || enter_pwd_idx_i == 111
      || enter_pwd_idx_i == 115 )
    {
      enter_pwd[i] = 0;
      v1 = other_table_construct_index++;
      other_table[v1] = 50;
    }
    if ( enter_pwd_idx_i == 50
      || enter_pwd_idx_i == 55
      || enter_pwd_idx_i == 97
      || enter_pwd_idx_i == 98
      || enter_pwd_idx_i == 112
      || enter_pwd_idx_i == 119
      || enter_pwd_idx_i == 113
      || enter_pwd_idx_i == 117
      || enter_pwd_idx_i == 122
      || enter_pwd_idx_i == 118
      || enter_pwd_idx_i == 104
      || enter_pwd_idx_i == 41
      || enter_pwd_idx_i == 64
      || enter_pwd_idx_i == 36
      || enter_pwd_idx_i == 47 )
    {
      enter_pwd[i] = 0;
      v2 = other_table_construct_index++;
      other_table[v2] = 51;
    }
  }
  for ( j = 0; j <= 96; ++j )                   // 遍历寻找空格,找到了返回-5
  {
    if ( enter_pwd[j] == 48 )
    {
      std::ostream::operator<<(0);
      return -5;
    }
  }
  if ( unknown_check_with_other_table(114514) == -514049345 )// 这里应该为真,关键点1
    return 0;
  v3 = unknown_check_with_other_table(114514);
  std::ostream::operator<<(v3);
  std::ostream::operator<<(std::endl<char,std::char_traits<char>>);
  return -5;
}


[C++] 纯文本查看 复制代码
int __cdecl unknown_check_with_other_table(int arg_114514)
{
  signed int other_table_len_1; // [esp+14h] [ebp-14h]
  signed int i; // [esp+18h] [ebp-10h]
  int return_value; // [esp+1Ch] [ebp-Ch]

  return_value = 0;
  other_table_len_1 = strlen(other_table);
  for ( i = 0; i < other_table_len_1; ++i )
    return_value = (arg_114514 * return_value + other_table[i]) % 1000000007;
  return return_value;
}
 楼主| ljlVink 发表于 2021-5-24 12:57
[C++] 纯文本查看 复制代码
#include<bits/stdc++.h>
using namespace std;
int asfdvgare[10000];
const int DF98D=1e9+7;
char S98HBFG[10000];
char DFHSV5Y[10000];
char  RTGDFTHR[100000];
char R0fjd[1000][1000]={"8311","7999","9691","1511","5701","1710","8323","3328","9111","1173","9118","1013","2991","1497","9910","7101","1003","2116","1041","0132","1129","7115","1151","1911","1114","100"};
char I89fhga[100000];
int Hsdfgsd23=282829919;
int Yksgbas235(int sed) {
	int res=0;
	int len=strlen(I89fhga);;
	for(int i=0;i<len;++i){
		res=(long long)(res*sed+I89fhga[i])%DF98D;
	}
	return res;
}
int rdfhfd5546(){
	int cs1=0;
	int lenpsw=strlen(S98HBFG);
	if(lenpsw!=41){
		return -5;
	}
	for(int i=0;i<97;i++){
		char pd=S98HBFG[i];
		if(pd=='^'||pd=='j'||pd=='l'||pd=='f'||pd=='n'||pd=='x'||pd=='#'||pd=='!'||pd=='%'||pd=='c'||pd=='4'||pd=='9'||pd=='g'||pd=='o'||pd=='s'){
			S98HBFG[i]=0;
			I89fhga[cs1++]='2';
		}
		if(pd=='2'||pd=='7'||pd=='a'||pd=='b'||pd=='p'||pd=='w'||pd=='q'||pd=='u'||pd=='z'||pd=='v'||pd=='h'||pd==')'||pd=='@'||pd=='$'||pd=='/'){
			S98HBFG[i]=0;
			I89fhga[cs1++]='3';
		}
	}
	for(int i=0;i<97;i++){
		if(S98HBFG[i]=='0'){
            cout<<0;
			return -5;
		}
	}/*
	if(Yksgbas235(114514)!=-514049345){
        cout<<Yksgbas235(114514)<<endl;;
		return -5;
	}*///hash写挂了,自行编译吧,不好意思
	return 0;
}
int main(int argc,char* argv[]){
	srand(time(0));
    cout<<"password:";
    cin>>S98HBFG;
    if(rdfhfd5546()==-5){
        cout<<"err\n";
        getchar();
        getchar();
        return 0;
    }
	
	int pin=0;
	for(int i=0;i<26;i++){
		int llen=strlen(R0fjd[i]);
		for(int j=0;j<llen;j++){
			RTGDFTHR[pin++]=R0fjd[i][j];
		}
	}
	int U89ywht=strlen(I89fhga);
	int len=strlen(RTGDFTHR);
	int OOihdd34=0;
	int cnt1=0;
	for(int i=0;i<U89ywht;i++){
		if(I89fhga[i]=='2'){
			for(int j=OOihdd34;j<OOihdd34+2;j++){
				if(j==OOihdd34){
					asfdvgare[cnt1]+=(RTGDFTHR[j]-'0')*10;
				}
				if(j==OOihdd34+1){
					asfdvgare[cnt1]+=RTGDFTHR[j]-'0';
				}
			}
			cnt1++;
			OOihdd34+=2;
		}
		if(I89fhga[i]=='3'){
			for(int j=OOihdd34;j<OOihdd34+3;j++){
				if(j==OOihdd34){
					asfdvgare[cnt1]=(RTGDFTHR[j]-'0')*100;
				}
				if(j==OOihdd34+1){
					asfdvgare[cnt1]+=(RTGDFTHR[j]-'0')*10;
				}
				if(j==OOihdd34+2){
					asfdvgare[cnt1]+=RTGDFTHR[j]-'0';
				}
			}
			cnt1++;
			OOihdd34+=3;
		}
	}
 	for(int i=0;i<len;i++){
		DFHSV5Y[i]=char(asfdvgare[i]);
	}
	for(int i=0;i<40;i++){
		cout<<DFHSV5Y[i];
	}
	cout<<endl;
    return 0;
}
 楼主| ljlVink 发表于 2021-5-22 16:40
fnv1c 发表于 2021-5-22 21:42
本帖最后由 fnv1c 于 2021-5-22 21:44 编辑
iTruth 发表于 2021-5-22 19:55
代码分析完了,但解密出来的东西对不上。我也不清楚是哪里的问题,下面是我的分析还请大佬赐教!
[mw_shl_ ...

主要这问题很可能不可解,或者说没有一个比暴力更优秀的解法
fnv1c 发表于 2021-5-22 21:46
z3跑了一分多钟跑不出来结果,感觉不是算法逆向题,是一个简单的密码学题...
iTruth 发表于 2021-5-22 22:03
fnv1c 发表于 2021-5-22 21:46
z3跑了一分多钟跑不出来结果,感觉不是算法逆向题,是一个简单的密码学题...

你说的对,密码的后三位似乎是无解的。至少我不知道怎么解
fnv1c 发表于 2021-5-22 22:04
one possible version

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册[Register]

x
iTruth 发表于 2021-5-22 22:05
fnv1c 发表于 2021-5-22 21:46
z3跑了一分多钟跑不出来结果,感觉不是算法逆向题,是一个简单的密码学题...

前38位已经被破译了,后面三位就像是偏移一般,最终运算结果要等于-514049345。我的数学太差了不知道怎么解。。
fnv1c 发表于 2021-5-22 22:05
iTruth 发表于 2021-5-22 22:03
你说的对,密码的后三位似乎是无解的。至少我不知道怎么解

可以直接根据密文和明文对应关系分析的,他那个114514 hash不可解。
fnv1c 发表于 2021-5-22 22:06
iTruth 发表于 2021-5-22 22:05
前38位已经被破译了,后面三位就像是偏移一般,最终运算结果要等于-514049345。我的数学太差了不知道怎么 ...

如果是三位,随便找个解方程工具就能解了。或者人工枚举
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-25 18:03

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表