instrs

__int64 __fastcall main(__int64 a1, char **a2, char **a3)
{
  int v4; // [rsp+1Ch] [rbp-24h]
  char *lineptr; // [rsp+20h] [rbp-20h] BYREF
  size_t n; // [rsp+28h] [rbp-18h] BYREF
  FILE *stream; // [rsp+30h] [rbp-10h]
  unsigned __int64 v8; // [rsp+38h] [rbp-8h]

  v8 = __readfsqword(0x28u);
  sub_12EA(a1, a2, a3);
  memset(&unk_4050, 0, 8uLL);
  memset(&unk_4060, 0, 8uLL);
  dword_4070 = 0;
  dword_406C = 0;
  puts("Enter Your Program");
  read(0, &unk_4050, 8uLL);
  byte_4058 = 0;
  v4 = sub_136D();
  printf("Result: %d\n", (unsigned int)v4);
  if (v4 > 99999)
  {
    lineptr = 0LL;
    n = 0LL;
    stream = fopen("./flag", "r");
    getline(&lineptr, &n, stream);
    printf("Good, get the flag: %s", lineptr);
    free(lineptr);
    fclose(stream);
  }
  return 0LL;
}

main은 여기

  1. v4>99999 해야함

Image

void makev4()
{
  unsigned int v0; // eax
  unsigned int v1; // eax
  int v2; // [rsp+8h] [rbp-8h]

  v2 = 0;
  while (1)
  {
    ++v2;
    v0 = byte_4050[dword_406C];
    if (v0 > 0x72)
      goto LABEL_11;
    if (byte_4050[dword_406C] >= 0x61u)
      break;
    if (v0 == 43)
    {
      ++byte_4060[dword_4070];
    }
    else
    {
      if (v0 != 45)
        goto LABEL_11;
      --byte_4060[dword_4070];
    }
    if (++dword_406C > 7)
      dword_406C = 7;
  }
  v1 = v0 - 97;
  if (v1 <= 0x11)
    __asm { jmp     rax }
LABEL_11:
  puts("No Hack!");
  exit(-1);
}

v0<=0x72 해야함

Image

Image

v1이 분기의 조건이 되는 거 같은데.. 일단 함수 의도를 모르겠으니 pass

main 다시 뜯어보니까 unsigned100000 초기화 해주는 게 없는데…

내가 rename 하다가 디컴파일 코드가 좀 바뀐 거 같다. 동적 분석으로 넘어가서 봐야할 거 같다.