实验吧CTFreverse题目证明自己吧writeup

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiangshangbashaonian/article/details/82631654

题目地址: http://ctf5.shiyanbar.com/crackme/ 

先运行下

发现输入错误就会闪退

没有加壳

载入IDA    搜索字符串

 

 

signed int __cdecl sub_401060(const char *input)

{

  unsigned int i; // edx

  unsigned int j; // edx

  int v3; // edx

  int v5; // [esp+Ch] [ebp-10h]

  int v6; // [esp+10h] [ebp-Ch]

  int v7; // [esp+14h] [ebp-8h]

  __int16 v8; // [esp+18h] [ebp-4h]

  char v9; // [esp+1Ah] [ebp-2h]



  v5 = dword_40708C;

  v6 = dword_407090;

  v8 = word_407098;

  v9 = byte_40709A;

  v7 = dword_407094;

  if ( strlen(input) == strlen(&v5) )           // 如果我们输入的长度=v5的长度

  {

    i = 0;

    if ( strlen(input) != 0 )                   // 如果len(input) != 0 且i<len(input)

    {

      do

        input[i++] ^= 0x20u;                    // 与0x20u异或

      while ( i < strlen(input) );

    }

    j = 0;

    if ( strlen(&v5) != 0 )                     // 对v5进行-5

    {

      do

        *(&v5 + j++) -= 5;

      while ( j < strlen(&v5) );                // 那我们只需要倒过来操作  先-5  再与0x20异或即可得到flag

    }

    v3 = 0;

    if ( strlen(&v5) == 0 )

      return 1;

    while ( *(&v5 + v3 + input - &v5) == *(&v5 + v3) )

    {

      if ( ++v3 >= strlen(&v5) )

        return 1;

    }

  }

  return 0;

}

 

得到flag:Cr4ckIsSoE4sy!

猜你喜欢

转载自blog.csdn.net/xiangshangbashaonian/article/details/82631654