机器级表示

时间:2010-11-02 17:33:59

标签: assembly x86 reverse-engineering

我正在做这个项目,这个特殊的部分令我感到困惑。我们得到了这个机器级别的表示,它将读取我必须弄清楚的六个数字。到目前为止,我知道这是一个循环,它将迭代,直到它到达它的停止子句。我们不希望它在0x08048d3a处调用爆炸:调用0x80492f3。有谁知道将生成六个数字。非常感谢任何帮助。

0x08048d0b <phase_2+0>:         push   %ebp
0x08048d0c <phase_2+1>:         mov    %esp,%ebp
0x08048d0e <phase_2+3>:         push   %esi
0x08048d0f <phase_2+4>:         push   %ebx
0x08048d10 <phase_2+5>:         sub    $0x30,%esp
0x08048d13 <phase_2+8>:         lea    -0x20(%ebp),%eax
0x08048d16 <phase_2+11>:        mov    %eax,0x4(%esp)
0x08048d1a <phase_2+15>:        mov    0x8(%ebp),%eax
0x08048d1d <phase_2+18>:        mov    %eax,(%esp)
0x08048d20 <phase_2+21>:        call   0x8049335 <read_six_numbers>
0x08048d25 <phase_2+26>:        mov    $0x2,%ebx
0x08048d2a <phase_2+31>:        lea    -0x20(%ebp),%esi
0x08048d2d <phase_2+34>:        mov    -0x8(%esi,%ebx,4),%eax
0x08048d31 <phase_2+38>:        add    $0x5,%eax
0x08048d34 <phase_2+41>:        cmp    %eax,-0x4(%esi,%ebx,4)
0x08048d38 <phase_2+45>:        je     0x8048d3f <phase_2+52>
0x08048d3a <phase_2+47>:        call   0x80492f3 <explode_bomb>
0x08048d3f <phase_2+52>:        add    $0x1,%ebx
0x08048d42 <phase_2+55>:        cmp    $0x7,%ebx
0x08048d45 <phase_2+58>:        jne    0x8048d2d <phase_2+34>
0x08048d47 <phase_2+60>:        add    $0x30,%esp
0x08048d4a <phase_2+63>:        pop    %ebx
0x08048d4b <phase_2+64>:        pop    %esi
0x08048d4c <phase_2+65>:        pop    %ebp
0x08048d4d <phase_2+66>:        ret

具体来说,你可以解释这些行发生的事情

0x08048d10 <phase_2+5>:         sub    $0x30,%esp
0x08048d13 <phase_2+8>:         lea    -0x20(%ebp),%eax
0x08048d16 <phase_2+11>:        mov    %eax,0x4(%esp)
0x08048d1a <phase_2+15>:        mov    0x8(%ebp),%eax
0x08048d1d <phase_2+18>:        mov    %eax,(%esp)

谢谢!

2 个答案:

答案 0 :(得分:2)

这种AT&amp; T语法让我困惑,但这一部分很简单:

0x08048d10 <phase_2+5>:         sub    $0x30,%esp //reserve additional 0x30bytes 12 ints) on the stack
0x08048d13 <phase_2+8>:         lea    -0x20(%ebp),%eax // int vals[6]; eax = vals;
0x08048d16 <phase_2+11>:        mov    %eax,0x4(%esp) // int some_local_var = vals;
0x08048d1a <phase_2+15>:        mov    0x8(%ebp),%eax // first param we received
0x08048d1d <phase_2+18>:        mov    %eax,(%esp) // pass it as param to function
0x08048d20 <phase_2+21>:        call   0x8049335 <read_six_numbers>

答案 1 :(得分:1)

char answer[6];
answer[0] = any_char
for n > 0
answer[n] = answer[n-1] + 5;