buu刷题 [ACTF新生赛2020]rome1

先查壳:

无壳 c++编译 32位

用ida打开

主函数没啥东西,进入func()看看:

发现一串字符,然后把ASCII变成char看一下:

这里肯定就是加密函数了:

int func()
{
  int result; // eax
  int v1[4]; // [esp+14h] [ebp-44h]
  unsigned __int8 v2; // [esp+24h] [ebp-34h] BYREF
  unsigned __int8 v3; // [esp+25h] [ebp-33h]
  unsigned __int8 v4; // [esp+26h] [ebp-32h]
  unsigned __int8 v5; // [esp+27h] [ebp-31h]
  unsigned __int8 v6; // [esp+28h] [ebp-30h]
  int v7; // [esp+29h] [ebp-2Fh]
  int v8; // [esp+2Dh] [ebp-2Bh]
  int v9; // [esp+31h] [ebp-27h]
  int v10; // [esp+35h] [ebp-23h]
  unsigned __int8 v11; // [esp+39h] [ebp-1Fh]
  char v12[29]; // [esp+3Bh] [ebp-1Dh] BYREF

  strcpy(v12, "Qsw3sj_lz4_Ujw@l");
  printf("Please input:");
  scanf("%s", &v2);
  result = v2;
  if ( v2 == 'A' )
  {
    result = v3;
    if ( v3 == 'C' )
    {
      result = v4;
      if ( v4 == 'T' )
      {
        result = v5;
        if ( v5 == 'F' )
        {
          result = v6;
          if ( v6 == '{' )
          {
            result = v11;
            if ( v11 == '}' )
            {
              v1[0] = v7;
              v1[1] = v8;
              v1[2] = v9;
              v1[3] = v10;
              *&v12[17] = 0;
              while ( *&v12[17] <= 15 )
              {
                if ( *(v1 + *&v12[17]) > 64 && *(v1 + *&v12[17]) <= 90 )   //如果字符在64-90之间 那么字符=(字符-51)%26+65
                  *(v1 + *&v12[17]) = (*(v1 + *&v12[17]) - 51) % 26 + 65;
                if ( *(v1 + *&v12[17]) > 96 && *(v1 + *&v12[17]) <= 122  //如果字符在96-122之间 那么字符=(字符-79)%26+97
                  *(v1 + *&v12[17]) = (*(v1 + *&v12[17]) - 79) % 26 + 97;
                ++*&v12[17];       //如果字符等于它本身那么 就返回自己
              }
              *&v12[17] = 0;
              while ( *&v12[17] <= 15 )
              {
                result = v12[*&v12[17]];
                if ( *(v1 + *&v12[17]) != result ) 
                  return result;
                ++*&v12[17];
              }
              result = printf("You are correct!");
            }
          }
        }
      }
    }
  }
  return result;
}

 脚本:

a= 'ACTF{'
enc='Qsw3sj_lz4_Ujw@l'
s=''
for i in range(len(enc)):
    for n in range(128):
        j=n
        if j >64 and j<=90:
            j=(j-51)%26+65
        if j>96 and j<=122:
            j= (j-79)%26 +97
        if j==ord(enc[i]):
            a=a+chr(n)
print(a+'}')

ACTF{Cae3ar_th4_Gre@t}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
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
发出的红包

打赏作者

元元努力向上

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值