新手赛maz

百度云链接:https://pan.baidu.com/s/1vAD0t_EYZB_ePZHbPHRVYQ
提取码:etmc

运行一下文件


微信图片_20190320232245.png

把exe文件丢进IDA
使用F5大法

__main();
  setmap();
  printf("Welcome to GWHT Maze Park!\n");
  printf("If you can get out of the maze, I will tell you flag.\n");
  printf("Now, come on, warrior!\n");
  Sleep(0xBB8u);
  printf("So,what's your route?\n");
  scanf("%s", v5);
  if ( !strcmp(v5, surprise) )
    printf((const char *)&unk_48C2AD);
  if ( strlen(v5) > 0x32 )
  {
    for ( i = 0; ; ++i )
    {
      v4 = i;
      if ( v4 >= strlen(v5) )
        break;
      v7 = check(v5[i]);
      v6 = map[v7];
      if ( v7 > 526 || v7 < 0 || v6 == 49 )
      {
        printf("bye bye!");
        system("pause");
        return 0;
      }
      if ( v7 == End )
      {
        judge = 1;
        break;
      }
    }
    if ( judge )
      printf("Wow!Congratulation!you made it!\n");
    else
      printf("bye bye!");
    system("pause");
    result = 0;
  }
  else
  {
    printf("bye bye!\n");
    system("pause");
    result = 0;
  }
  return result;
}

点进去setmap();


image.png

发现有一个flag
别激动,这是假象


image.png

v5输入surprise 输出为“你想得倒美”,又被坑了
v5为输入路径
点进去check函数

int __cdecl check(char a1)
{
  char v2; // [esp+4h] [ebp-4h]

  v2 = change(a1);
  if ( v2 == 105 )
    start -= 31;
  if ( v2 == 121 )
    start += 31;
  if ( v2 == 118 )
    --start;
  if ( v2 == 122 )
    ++start;
  return start;
}

check函数里还有一个change函数,点进去

int __cdecl change(char a1)
{
  return (a1 ^ 6) + 8;
}

v6 != 49意味着v6不能为'1',意味着不能碰到'1',碰到'1'则退出
v7 == End即289时改judge为1,成功
但关键还是要看check和change函数
v2=(a1 ^ 6) + 8,逆向思考,
Start+31,v2=105,v2-8=97,a1=6^97=g;
Start-31,v2=121,v2-8=113,a1=6^113=w;
Start+1,v2=118,v2-8=110,a1=6^110=h;
Start+1,v2=122,v2-8=114,a1=6^114=t;
迷宫会有四个方向,上下左右,那么左右是加减1,上下就是加减31,从而得出迷宫宽为31,上g下w左h右t,那现在我们就可以把迷宫打印出来了

#include 
#include 
#include 
using namespace std;
int main()
{
    string map="1111111111111111111111111111111111111111111111111111111111111111111111************s111111111111111111*111111111111111111111111111111*111111111111111111111111111111*111111111111111111111111111111*111111111111111111111111111111*111111111111111111111111111111*111111111111111111111111111111*1e**********111111111111111111*11111111111*111111111111111111*11111111111*111111111111111111*11111111111*111111111111111111*11111111111*111111111111111111*************111111111111111111111111111111111111111111111111111111111111111111111111";
    for(int i=0;i
image.png

现在很清晰的就是,从s走到e,我们人工数一下,先向左走12步,向下走12步,向右走12步,然后向上5步,最后向左10步,12个h12个w12个t5个g10个h


image.png

flag的形式为gwht{},所以最终答案是gwht{hhhhhhhhhhhhwwwwwwwwwwwwttttttttttttggggghhhhhhhhhh}

你可能感兴趣的:(新手赛maz)