新手一枚,如有错误(不足)请指正,谢谢!!
题目网址:https://cgctf.nuptsast.com/challenges#Re
下载下文件,IDA载入,找到main函数,F5伪代码
双击进入,查看correct的存放了啥,经整理
对输入的字符串进行处理
接下来就是写脚本了,先将那15000的数据导出来,
然后shift+e导成一个txt文本文档
#include <stdio.h>
int main()
{
char str[15000] ={}//这里的数据直接用txt文本文档里的粘贴,15000行太长了
char strings[] = {0xC4,0X34,0x22,0xB1,0xD3,0x11,0x97,0x7,0xDB,0x37,0xC4,0x6,0x1D,0xFC,0x5B,0xED,0x98,0xDF,0x94,0xD8,0xB3,0x84,0xCC,0x8,0};
int v0,i,result;
char v3;
for ( i = 14997; i >= 0; i -= 3 )
{
v0 = str[i];
v3 = str[i + 2];
result = v0;
switch ( v0 )
{
case 1u:
result = str[i + 1];
strings[(int)result] -= v3;
break;
case 2u:
result = str[i + 1];
strings[(int)result] += v3;
break;
case 3u:
result = str[i + 1];
strings[(int)result] ^= v3;
break;
case 4u:
result = str[i + 1];
strings[(int)result] /= v3;
break;
case 5u:
result = str[i + 1];
strings[(int)result] ^= strings[str[i + 2]];
break;
default:
continue;
}
}
puts(strings);
return 0;
}
运行脚本得到flag为nctf{Embr4ce_Vm_j0in_R3}