与正常

时间:2018-02-24 01:39:13

标签: assembly x86-64 reverse-engineering

英语不是我的第一语言。我正在做炸弹实验室,现在我已经停留在第5阶段了。我已经搜索过互联网并与我的朋友们交谈了,他们都有一个不同于我想要字符串的第5阶段。我不想要一根绳子。

我已注释第5阶段汇编代码的汇编

//we input 2 integers
//the answer = ?  ?
0000000000401096 <phase_5>:                     
  401096:   48 83 ec 18             sub    $0x18,%rsp                //move 0x1 off of %rsp for variables
  40109a:   48 8d 4c 24 08          lea    0x8(%rsp),%rcx           //%rcx = (%rsp + 0x8)
  40109f:   48 8d 54 24 0c          lea    0xc(%rsp),%rdx           //%rdx = (%rsp + 0xc)
  4010a4:   be 0d 28 40 00          mov    $0x40280d,%esi           //looking for 2 integers again!
  4010a9:   b8 00 00 00 00          mov    $0x0,%eax                 //%eax = 0
  4010ae:   e8 7d fb ff ff          callq  400c30 <__isoc99_sscanf@plt> //scan in the input
  4010b3:   83 f8 01                cmp    $0x1,%eax                 //%eax = 1?
  4010b6:   7f 05                   jg     4010bd <phase_5+0x27>    //if %eax > 1, jump to 4010bd (bomb)
  4010b8:   e8 c7 04 00 00          callq  401584 <explode_bomb>    //we explode
  4010bd:   8b 44 24 0c             mov    0xc(%rsp),%eax           //%eax = (%rsp + 0xc) (second integer?)
  4010c1:   83 e0 0f                and    $0xf,%eax                 //%0xf and %eax
  4010c4:   89 44 24 0c             mov    %eax,0xc(%rsp)           //(%rsp + 0xc) = %eax
  4010c8:   83 f8 0f                cmp    $0xf,%eax                 //%eax = 15?
  4010cb:   74 2c                   je     4010f9 <phase_5+0x63>    //if %eax = 15, jump to 4010f9 (bomb)
  4010cd:   b9 00 00 00 00          mov    $0x0,%ecx                 //%ecx = 0
  4010d2:   ba 00 00 00 00          mov    $0x0,%edx                 //%edx = 0
  4010d7:   83 c2 01                add    $0x1,%edx                 //%edx += 1
  4010da:   48 98                   cltq                             //???
  4010dc:   8b 04 85 80 25 40 00    mov    0x402580(,%rax,4),%eax    //???
  4010e3:   01 c1                   add    %eax,%ecx                //%eax += %eax
  4010e5:   83 f8 0f                cmp    $0xf,%eax                 //%eax = 15?
  4010e8:   75 ed                   jne    4010d7 <phase_5+0x41>    //if %eax != 15, jump to 4010d7   //loop until %eax = 15
  4010ea:   89 44 24 0c             mov    %eax,0xc(%rsp)           //(%rsp + 0xc) = %eax
  4010ee:   83 fa 0f                cmp    $0xf,%edx                 //%edx = 15?
  4010f1:   75 06                   jne    4010f9 <phase_5+0x63>    //if %edx != 15, jump to 4010f9 (bomb)
  4010f3:   3b 4c 24 08             cmp    0x8(%rsp),%ecx           //(%rsp + 0x8) = %ecx?
  4010f7:   74 05                   je     4010fe <phase_5+0x68>    //if those are equal, jump to 4010fe (done)
  4010f9:   e8 86 04 00 00          callq  401584 <explode_bomb>    //we explode
  4010fe:   48 83 c4 18             add    $0x18,%rsp               //%rsp += 24
  401102:   c3                      retq               //we are done

我很难理解这一点。我看到一个循环15次,但我不明白它的作用。在这种情况下cltq做了什么?什么是mov 0x402580(,%rax,4), %eax设置%eax到?我不想爆炸。我害怕在这个实验室做得不好。谢谢。

0 个答案:

没有答案