站点图标 Wankko Ree's Blog

[实验室日题][20201128][Misc]Brainfuck cppRe WriteUp

WriteUp

下载题目附件,解压得到元婴.txt2.rar,打开2.rar发现存在密码。打开元婴.txt发现如下文本:

+++++ ++++[ ->+++ +++++ +<]>+ +++++ +++++ +++++ .<+++ +[->+ +++<] >++++
++.-- --.-- ----- .<

十分眼熟,是好久没碰到的Brainfuck编码,解密后得到文本awsl爱我苏联,精苏狂喜

拿着刚才解出来的文本当密码去解压2.rar(那岂不是直接爆破更快),解压成功得到re.txtre1.rarre1.rar还是有密码,那就去看re.txt,内容如下:

 #include  <iostram>
 using namespace std;
 int main()
 {
char v11[4];
  char v12; 
  char v13; 
  char v14; 
  char v15;
  char v16; 
  char v17;
  char v18;
  char v19; 
  char v20;
  char v21; 
  char v22; 
  char v23;  
if ( v11[0] != 67
      || v23 != 88
      || v11[1] != 90
      || v11[1] + v22 != 155
      || v11[2] != 57
      || v11[2] + v21 != 155
      || v11[3] != 100
      || v20 != 55
      || v12 != 109
      || v19 != 71
      || v13 != 113
      || v13 + v18 != 170
      || v14 != 52
      || v17 != 103
      || v15 != 99
      || v16 != 56 )
{
cout<<"原本想出re的。。。"
}
return 0;
}

emm,那就直接基于这个文件改改呗。

 #include<iostream>
 using namespace std;
 int main()
 {
char v11[4];
  char v12;
  char v13;
  char v14;
  char v15;
  char v16;
  char v17;
  char v18;
  char v19;
  char v20;
  char v21;
  char v22;
  char v23;
v11[0] = 67;
v23 = 88;
v11[1] = 90;
v22 = 155 - v11[1];
v11[2] = 57;
v21 = 155 - v11[2];
v11[3] = 100;
v20 = 55;
v12 = 109;
v19 = 71;
v13 = 113;
v18 = 170 - v13;
v14 = 52;
v17 = 103;
v15 = 99;
v16 = 56;
{
cout<<v11[0]<<v11[1]<<v11[2]<<v11[3]<<endl;
cout<<v12<<v13<<v14<<v15<<v16<<v17<<v18<<v19<<v20<<v21<<v22<<v23<<endl;
}
return 0;
}

运行得到CZ9dmq4c8g9G7bAX,两个试了都不是密码,拼起来才是密码,于是解压re1.rar得到re1.txt,内容如下:

 //简单的异或运算
char flag[32]
cin<<flag;
for ( i = 1; i < 33; ++i )
    flag[i] ^= flag[i - 1];
}

if( strncmp(flag,0x66,0x0A,0x6B,0x0C,0x77,0x26,0x4F,0x2E,0x40,0x11,0x78,0x0D,0x5A,0x3B,0x55,0x110x70,0x19,0x46,0x1F,0x76,0x22,0x4D,0x23,0x44,0x0E,0x67,6,0x68,0x0F,0x47,0x32,0x4F)
)
{cout<<"成功啦"}

还是简单地改一改,因为异或两次就相当于没异或,所以倒着重新来一遍就完事。

#include<bits/stdc++.h>
using namespace std;
int main(){
char flag[33] = {0x66,0x0A,0x6B,0x0C,0x77,0x26,0x4F,0x2E,
                 0x40,0x11,0x78,0x0D,0x5A,0x3B,0x55,0x11,
                 0x70,0x19,0x46,0x1F,0x76,0x22,0x4D,0x23,
                 0x44,0x0E,0x67,6,0x68,0x0F,0x47,0x32,0x4F};
for (int i = 32; i >= 1; i-- ){
    flag[i] ^= flag[i - 1];
}
cout<<flag;
return 0;
}

运行得到flag。

flag

flag{QianQiuWanDai_YiTongJiangHu}

退出移动版