buu-reverse3

23位无壳
在这里插入图片描述拖入32位ida
查看字符串
在这里插入图片描述
在这里插入图片描述
可能会用到base64编码
查看main函数的伪代码
在这里插入图片描述

__int64 __usercall main_0@<edx:eax>(int a1@<ebx>, int a2@<edi>, int a3@<esi>)
{
  int v3; // eax
  const char *v4; // eax
  size_t v5; // eax
  int v6; // edx
  __int64 v7; // ST08_8
  signed int j; // [esp+DCh] [ebp-ACh]
  signed int i; // [esp+E8h] [ebp-A0h]
  signed int v11; // [esp+E8h] [ebp-A0h]
  char Dest[108]; // [esp+F4h] [ebp-94h]
  char Str; // [esp+160h] [ebp-28h]
  char v14; // [esp+17Ch] [ebp-Ch]

  for ( i = 0; i < 100; ++i )
  {
    if ( (unsigned int)i >= 0x64 )
      j____report_rangecheckfailure(a1, a2, a3);
    Dest[i] = 0;
  }
  //初始化Dest
  sub_41132F("please enter the flag:");
  sub_411375((int)"%20s", (unsigned int)&Str);
  //读入20个字符串给Str
  v3 = j_strlen(&Str);
  //获取Str长度
  v4 = (const char *)sub_4110BE((int)&Str, v3, (int)&v14);
  //sub_4110BE函数加密
  strncpy(Dest, v4, 0x28u);
  //将v7的前40位复制给Dest
  v11 = j_strlen(Dest);
  //获取Dest的长度
  for ( j = 0; j < v11; ++j )
    Dest[j] += j;
	//对Dest的每位字符加上下标
  v5 = j_strlen(Dest);
  if ( !strncmp(Dest, Str2, v5) )
  //Str2值为'e3nifIH9b_C@n@dH'
    sub_41132F("rigth flag!\n");
  else
    sub_41132F("wrong flag!\n");
  HIDWORD(v7) = v6;
  LODWORD(v7) = 0;
  return v7;
}

跟进sub_4110BE函数

while ( v11 > 0 )
  {
    byte_41A144[2] = 0;
    byte_41A144[1] = 0;
    byte_41A144[0] = 0;
    for ( i = 0; i < 3 && v11 >= 1; ++i )
    {
      byte_41A144[i] = *v13;
      --v11;
      ++v13;
    }
    if ( !i )
      break;
    switch ( i )
    {
      case 1:
        *((_BYTE *)Dst + v7) = aAbcdefghijklmn[(signed int)(unsigned __int8)byte_41A144[0] >> 2];
        v4 = v7 + 1;
        *((_BYTE *)Dst + v4++) = aAbcdefghijklmn[((byte_41A144[1] & 0xF0) >> 4) | 16 * (byte_41A144[0] & 3)];
        *((_BYTE *)Dst + v4++) = aAbcdefghijklmn[64];
        *((_BYTE *)Dst + v4) = aAbcdefghijklmn[64];
        v7 = v4 + 1;
        break;
      case 2:
        *((_BYTE *)Dst + v7) = aAbcdefghijklmn[(signed int)(unsigned __int8)byte_41A144[0] >> 2];
        v5 = v7 + 1;
        *((_BYTE *)Dst + v5++) = aAbcdefghijklmn[((byte_41A144[1] & 0xF0) >> 4) | 16 * (byte_41A144[0] & 3)];
        *((_BYTE *)Dst + v5++) = aAbcdefghijklmn[((byte_41A144[2] & 0xC0) >> 6) | 4 * (byte_41A144[1] & 0xF)];
        *((_BYTE *)Dst + v5) = aAbcdefghijklmn[64];
        v7 = v5 + 1;
        break;
      case 3:
        *((_BYTE *)Dst + v7) = aAbcdefghijklmn[(signed int)(unsigned __int8)byte_41A144[0] >> 2];
        v6 = v7 + 1;
        *((_BYTE *)Dst + v6++) = aAbcdefghijklmn[((byte_41A144[1] & 0xF0) >> 4) | 16 * (byte_41A144[0] & 3)];
        *((_BYTE *)Dst + v6++) = aAbcdefghijklmn[((byte_41A144[2] & 0xC0) >> 6) | 4 * (byte_41A144[1] & 0xF)];
        *((_BYTE *)Dst + v6) = aAbcdefghijklmn[byte_41A144[2] & 0x3F];
        v7 = v6 + 1;
        break;
    }
  }
  *((_BYTE *)Dst + v7) = 0;
  return Dst;
}

以及aAbcdefghijklmn的值
在这里插入图片描述

有点难看
先转Str2

a = "e3nifIH9b_C@n@dH"
b = ""

for i in range(0,len(a)):
	b += chr(ord(a[i]) - i)
	
print(b)

得到e2lfbDB2ZV95b3V9
然后根据哈希表和string的提示尝试base64解密
得到{i_l0ve_you}

BU reverse 1是一个反向工程题目。我们需要使用IDA来分析给定的程序并找到正确的flag。根据引用,我们可以使用strncmp函数来比较两个字符串的前几位。如果相同,返回0;如果不同,返回正数或负数。根据引用,我们可以得知,正确的flag应该与字符串"this is the right flag!"相同。因此,我们需要在IDA中查看字符串并找到正确的flag。然后,我们可以按照引用中的步骤来进行操作,将ASCII码转为字符。通过这些步骤,我们可以找到正确的flag。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [buuctf 逆向刷题01——reverse1](https://blog.csdn.net/qq_42642222/article/details/127678168)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [BUUCTF--Reverse--easyre,reverse1,新年快乐(面向新手,超详细)](https://blog.csdn.net/qq_65165505/article/details/130263889)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值