ASM帮助 - 汇编语言二进制炸弹phase_6

时间:2014-03-05 07:58:46

标签: assembly

我一直在努力工作几个小时。我试图找到正确的答案,但我不能。我一直在搜索,很多人说输入是数字1-6而没有重复,但我无法找到它在汇编代码中的任何位置。此外,我终于在努力寻找它们之后找到了节点。

(gdb)   x /4x 0x804a62c
0x804a62c <node0>:  0x00000006  0x00000000  0x0804a620  0x000003e9

(gdb) x /4x 0x804a614
0x804a614 <node2>:  0x0000003e  0x00000002  0x0804a608  0x0000014b

(gdb) x /4x 0x804a620
0x804a620 <node1>:  0x0000014b  0x00000001  0x0804a62c  0x00000006

(gdb) x /4x 0x804a608
0x804a608 <node3>:  0x000003e4  0x00000003  0x0804a5fc  0x0000003e

(gdb) x /4x 0x804a5fc
0x804a5fc <node4>:  0x0000016e  0x00000004  0x0804a5f0  0x000003e4

(gdb) x /4x 0x804a5f0
0x804a5f0 <node5>:  0x00000397  0x00000005  0x0804a5e4  0x0000016e

(gdb) x /4x 0x804a5e4
0x804a5e4 <node6>:  0x00000194  0x00000006  0x0804a5d8  0x00000397

(gdb) x /4x 0x804a5d8
0x804a5d8 <node7>:  0x000002a8  0x00000007  0x0804a5cc  0x00000194

(gdb) x /4x 0x804a5cc
0x804a5cc <node8>:  0x000000b9  0x00000008  0x0804a5c0  0x000002a8

(gdb) x /4x 0x804a5c0
0x804a5c0 <node9>:  0x00000355  0x00000009  0x00000000  0x000000b9

所以我把它们整理好了,我得到了3 5 9 7 6 4 1 8 2 0,但是当我把它放进去时,它仍然无效。这是

的asm代码
     Dump of assembler code for function phase_6:
       0x08048ca0 <+0>: push   %ebp
       0x08048ca1 <+1>: mov    %esp,%ebp
       0x08048ca3 <+3>: push   %ebx
       0x08048ca4 <+4>: sub    $0x14,%esp
       0x08048ca7 <+7>: movl   $0xa,0x8(%esp)
       0x08048caf <+15>:    movl   $0x0,0x4(%esp)
       0x08048cb7 <+23>:    mov    0x8(%ebp),%eax
       0x08048cba <+26>:    mov    %eax,(%esp)
       0x08048cbd <+29>:    call   0x80487e8 <strtol@plt>
       0x08048cc2 <+34>:    mov    $0x804a62c,%ebx
       0x08048cc7 <+39>:    mov    %eax,(%ebx)
       0x08048cc9 <+41>:    mov    %ebx,(%esp)
       0x08048ccc <+44>:    call   0x8048b8d <fun6>
       0x08048cd1 <+49>:    mov    0x8(%eax),%eax
       0x08048cd4 <+52>:    mov    0x8(%eax),%eax
       0x08048cd7 <+55>:    mov    0x8(%eax),%eax
       0x08048cda <+58>:    mov    (%eax),%eax
       0x08048cdc <+60>:    cmp    (%ebx),%eax
       0x08048cde <+62>:    je     0x8048ce5 <phase_6+69>
       0x08048ce0 <+64>:    call   0x8049236 <explode_bomb>
       0x08048ce5 <+69>:    add    $0x14,%esp
       0x08048ce8 <+72>:    pop    %ebx
       0x08048ce9 <+73>:    pop    %ebp
       0x08048cea <+74>:    ret    
    End of assembler dump.

And for the fun6 function:

Dump of assembler code for function fun6:
   0x08048b8d <+0>: push   %ebp
   0x08048b8e <+1>: mov    %esp,%ebp
   0x08048b90 <+3>: push   %edi
   0x08048b91 <+4>: push   %esi
   0x08048b92 <+5>: push   %ebx
   0x08048b93 <+6>: mov    0x8(%ebp),%edx
   0x08048b96 <+9>: mov    0x8(%edx),%esi
   0x08048b99 <+12>:    movl   $0x0,0x8(%edx)
   0x08048ba0 <+19>:    mov    %edx,%eax
   0x08048ba2 <+21>:    mov    %edx,%ecx
   0x08048ba4 <+23>:    mov    %edx,%edi
   0x08048ba6 <+25>:    test   %esi,%esi
   0x08048ba8 <+27>:    jne    0x8048bd8 <fun6+75>
   0x08048baa <+29>:    jmp    0x8048be4 <fun6+87>
   0x08048bac <+31>:    mov    %edx,%ecx
   0x08048bae <+33>:    mov    0x8(%ecx),%edx
   0x08048bb1 <+36>:    test   %edx,%edx
   0x08048bb3 <+38>:    je     0x8048bb9 <fun6+44>
   0x08048bb5 <+40>:    cmp    %ebx,(%edx)
   0x08048bb7 <+42>:    jg     0x8048bac <fun6+31>
   0x08048bb9 <+44>:    mov    %ecx,%edi
   0x08048bbb <+46>:    mov    %edx,%ecx
   0x08048bbd <+48>:    cmp    %ecx,%edi
   0x08048bbf <+50>:    jne    0x8048bc5 <fun6+56>
   0x08048bc1 <+52>:    mov    %esi,%eax
   0x08048bc3 <+54>:    jmp    0x8048bc8 <fun6+59>
   0x08048bc5 <+56>:    mov    %esi,0x8(%edi)
   0x08048bc8 <+59>:    mov    0x8(%esi),%edx
   0x08048bcb <+62>:    mov    %ecx,0x8(%esi)
   0x08048bce <+65>:    test   %edx,%edx
   0x08048bd0 <+67>:    je     0x8048be4 <fun6+87>
   0x08048bd2 <+69>:    mov    %edx,%esi
   0x08048bd4 <+71>:    mov    %eax,%ecx
   0x08048bd6 <+73>:    mov    %eax,%edi
   0x08048bd8 <+75>:    test   %ecx,%ecx
   0x08048bda <+77>:    je     0x8048bbd <fun6+48>
   0x08048bdc <+79>:    mov    (%esi),%ebx
   0x08048bde <+81>:    cmp    %ebx,(%ecx)
   0x08048be0 <+83>:    jg     0x8048bae <fun6+33>
   0x08048be2 <+85>:    jmp    0x8048bbd <fun6+48>
   0x08048be4 <+87>:    pop    %ebx
   0x08048be5 <+88>:    pop    %esi
   0x08048be6 <+89>:    pop    %edi
   0x08048be7 <+90>:    pop    %ebp
   0x08048be8 <+91>:    ret    
End of assembler dump.

我已经在这几个小时了!任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

请注意,炸弹有很多版本,所以有些人告诉你的答案是3 5 9 7 6 4 1 8 2 0与事实无关。如您所见,phase6strtol行调用单个+29,因此预计只有一个数字作为输入。然后将该数字存储到node0中,并使用节点的地址调用fun6,该地址最终将返回一个检查某些条件的节点指针。尝试弄清楚fun6正在做什么以及条件是什么。