分析
64位ida打开后进入主函数,即输入后执行patch_me函数
跟进patch_me,发现只有输入为偶数才执行get_flag函数
进入get_flag函数,里面进行switch处理
看下switch判断的条件,rand() % 200 == 1,Rand是随机数的意思,rand() % 200则将范围定在了0~199之间
再看case的内容,首先可以将case 2,case 3 和 default三种情况排除
case1将f1与f2拼接,case4对f2进行赋值,case5对f2进行处理
故按照case4,case5,case1的顺序处理
对case4的s按h转换成十六进制为0x69,0x63,0x75,0x67,0x60,0x6f,0x66,0x7f
其中f1是"GXY{do_not_"
脚本
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<string>
#include<cstring>
#include<list>
#include<stdlib.h>
using namespace std;
typedef int status;
typedef int selemtype;
int main ()
{
int key[] ={0x69,0x63,0x75,0x67,0x60,0x6f,0x66,0x7f};
printf("GXY{do_not_");
for (int i = 0; i < 8; ++i )
{
if ( i % 2 == 1 )
key[i] -= 2;
else
--key[i];
printf("%c",key[i]);
}
}
//GXY{do_not_hate_me}
在buu提交时要改成flag{}格式