逆向攻防世界CTF系列17-dmd-50-100

64位无壳

std::string::string(v39, v42, &v38);                // v42 输入复制给 v39。
md5((MD5 *)v40, (const std::string *)v39);          //一个md5加密函数, 把 v39 进行 MD5 后保存在 v40

这里都是什么invalid key,没什么用,输出用的

image-20241020222509144

  if ( *(_WORD *)v41 == 0x3837      
    && *(_BYTE *)(v41 + 2) == 0x30
    && *(_BYTE *)(v41 + 3) == 0x34
    && *(_BYTE *)(v41 + 4) == 0x33
    && *(_BYTE *)(v41 + 5) == 0x38
    && *(_BYTE *)(v41 + 6) == 0x64
    && *(_BYTE *)(v41 + 7) == 0x35
    && *(_BYTE *)(v41 + 8) == 0x62
    && *(_BYTE *)(v41 + 9) == 0x36
    && *(_BYTE *)(v41 + 10) == 0x65
    && *(_BYTE *)(v41 + 11) == 0x32
    && *(_BYTE *)(v41 + 12) == 0x39
    && *(_BYTE *)(v41 + 13) == 0x64
    && *(_BYTE *)(v41 + 14) == 0x62
    && *(_BYTE *)(v41 + 15) == 0x30
    && *(_BYTE *)(v41 + 16) == 0x38
    && *(_BYTE *)(v41 + 17) == 0x39
    && *(_BYTE *)(v41 + 18) == 0x38
    && *(_BYTE *)(v41 + 19) == 0x62
    && *(_BYTE *)(v41 + 20) == 0x63
    && *(_BYTE *)(v41 + 21) == 0x34
    && *(_BYTE *)(v41 + 22) == 0x66
    && *(_BYTE *)(v41 + 23) == 0x30
    && *(_BYTE *)(v41 + 24) == 0x32
    && *(_BYTE *)(v41 + 25) == 0x32
    && *(_BYTE *)(v41 + 26) == 0x35
    && *(_BYTE *)(v41 + 27) == 0x39
    && *(_BYTE *)(v41 + 28) == 0x33
    && *(_BYTE *)(v41 + 29) == 0x35
    && *(_BYTE *)(v41 + 30) == 0x63
    && *(_BYTE *)(v41 + 31) == 0x30 )

这里处理为16进制

结合一下大概了解到题目意思

  std::operator<<<std::char_traits<char>>(&std::cout, "Enter the valid key!\n", envp);
  std::operator>><char,std::char_traits<char>>(&edata, v42);
  std::allocator<char>::allocator(&v38);
  std::string::string(v39, v42, &v38);
  md5(v40, v39);
  v41 = std::string::c_str((std::string *)v40);

就是v42赋值给v39,v39加密后成v40,v40处理成字符串v41在进行比较,我们可以直接得到密文(if语句里的)

key=[0x37,0x38,0x30,0x34,0x33,0x38,0x64,0x35,0x62,0x36,0x65,0x32,0x39,0x64,0x62,0x30,0x38,0x39,0x38,0x62,0x63,0x34,0x66,0x30,0x32,0x32,0x35,0x39,0x33,0x35,0x63,0x30]
md = ""
for i in key:
    md += chr(i)
print(md)

780438d5b6e29db0898bc4f0225935c0

在线解密网址:https://www.cmd5.com/

image-20241020223104899

因为进行了两次解密,要再加密一次

image-20241020223226824

加密网站

MD5在线加密/解密/破解—MD5在线