1、ida加载看看,代码如下,是简单xor操作
int __cdecl main(int argc, const char **argv, const char **envp)
{
int i; // [rsp+2Ch] [rbp-124h]
char __b[264]; // [rsp+40h] [rbp-110h] BYREF
memset(__b, 0, 0x100uLL);
printf(“Input your flag:\n”);
get_line(__b, 256LL);
if ( strlen(__b) != 33 )
goto LABEL_7;
for ( i = 1; i < 33; ++i )
__b[i] ^= __b[i - 1];
if ( !strncmp(__b, global, 33uLL) )
printf(“Success”);
else
LABEL_7:
printf(“Failed”);
return 0;
}
global ida 转换为数组,写代码得到密码
// buuctfdemo.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
int main()
{
unsigned char data[] =
{
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, 0x06, 0x68, 0x0F,
0x47, 0x32, 0x4F, 0x00
};
int i;
for (i = 1; i < 33; i++)
data[i] ^= data[i + 1];
printf("Success:%s", data);
getchar();
return 0;
}
fag{QianQiuWanDai_YiTongJiangHu}O
flag{QianQiuWanDai_YiTongJiangHu}O