the link
You can go to this website to download the self-study handout
In the folder, you can see three file, bomb, bomb.c README.md , the extra files are my works.
(gdb) disas Dump of assembler code for function phase_1: => 0x0000000000400ee0 <+0>: sub $0x8,%rsp 0x0000000000400ee4 <+4>: mov $0x402400,%esi 0x0000000000400ee9 <+9>: callq 0x401338 <strings_not_equal> 0x0000000000400eee <+14>: test %eax,%eax 0x0000000000400ef0 <+16>: je 0x400ef7 <phase_1+23> 0x0000000000400ef2 <+18>: callq 0x40143a <explode_bomb> 0x0000000000400ef7 <+23>: add $0x8,%rsp 0x0000000000400efb <+27>: retq End of assembler dump.
You can see there is a <strings_not_equal>, if the string you input is not equal to the target one, the bomb wil bome.
We can guess that the string is storaged in the $0x402400, check the string storaged in the 0x402400, you can get the ans.
1 2
(gdb) x/s 0x402400 0x402400: "Border relations with Canada have never been better."
看到上面的<read_six_numbers>我们可以知道这次是让我们去输入六个数字
Then we can see cmpl $0x1,(%rsp), so the first number is 1, otherwise will trigger the bomb.
In the next statement, we jump to the phase_2 + 52,in which the second number will copy to the rbx.
Then will get into this loop
The return value of the c function is always storaged in the eax, so the 0x0000000000400f56 <+19>: mov $0x0,%eax
compare the number of the parameters and the 0x1,it must be bigger than 1.
So we can input two numbers.
The first number must be less than 7,if the number is 1, it will jump to the 0x0000000000400f81. In this statement we can see the second number is 311.
综上所述,我们可以看到最终一个可行的结果是1 311
你