BUUCTF-MISC-[GWCTF2019]math
每天一题,只能多不能少
[GWCTF2019]math
题目分析
- pwntools交互
- recvuntil方法
开始
1.题目
给出一个环境。
环境连接后提示:
给出一个算式,要成功计算150次,每次几秒内没给出结果就退出。
和这个环境的源程序。gwctf_2019_math
2.源程序分析
(1)查壳
无壳
(2)IDA分析
丢进IDA,找到核心函数
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int seed; // ST14_4
unsigned int v4; // ST18_4
unsigned int v5; // ST1C_4
unsigned int v6; // ST20_4
unsigned int v7; // ST24_4
signed int v9; // [rsp+10h] [rbp-130h]
char buf; // [rsp+30h] [rbp-110h]
unsigned __int64 v11; // [rsp+138h] [rbp-8h]
v11 = __readfsqword(0x28u);
setvbuf(stdin, 0LL, 2, 0LL);
setvbuf(stdout, 0LL, 2, 0LL);
setvbuf(stderr, 0LL, 2, 0LL);
v9 = 0;
seed = time(0LL);
srand(seed);
do
{
alarm(5u);
v4 = rand() % 200;
v5 = rand() % 200;
v6 = rand() % 200;
v7 = rand() % 200;
puts("Pass 150 levels and i will give you the flag~");
puts("====================================================");
prin