csapp lab2 bomb(1)
在coursera上有个csapp有关的公开课 The Hardware/Software Interface
所以 x/s 0x80497c0 即可以得到正确的答案
上面的lib2和csapp上的二进制炸弹实验一样,但是是64位的=.=,于是我还是去 http://csapp.cs.cmu.edu/public/labs.html上下载了一个32位的文件来练习.
下面是第一关的反汇编
Dump of assembler code for function phase_1: 0x08048b20 <+0>: push %ebp 0x08048b21 <+1>: mov %esp,%ebp 0x08048b23 <+3>: sub $0x8,%esp 0x08048b26 <+6>: mov 0x8(%ebp),%eax 0x08048b29 <+9>: add $0xfffffff8,%esp 0x08048b2c <+12>: push $0x80497c0 #从下面的strings_not_equal看出,这里是将正确字符串压栈 0x08048b31 <+17>: push %eax 0x08048b32 <+18>: call 0x8049030 <strings_not_equal> 0x08048b37 <+23>: add $0x10,%esp 0x08048b3a <+26>: test %eax,%eax 0x08048b3c <+28>: je 0x8048b43 <phase_1+35> 0x08048b3e <+30>: call 0x80494fc <explode_bomb> 0x08048b43 <+35>: mov %ebp,%esp 0x08048b45 <+37>: pop %ebp 0x08048b46 <+38>: ret End of assembler dump.
0x80497c0:"Public speaking is very easy."