1 Replies - 195 Views - Last Post: 23 May 2013 - 12:05 AM Rate Topic: -----

#1 pdidy123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-May 13

Can anyone explain what this assemble code does?

Posted 22 May 2013 - 11:09 PM

0x08048b26 <phase_4+0>: push   %ebp
0x08048b27 <phase_4+1>: mov    %esp,%ebp
0x08048b29 <phase_4+3>: sub    $0x18,%esp
0x08048b2c <phase_4+6>: mov    0x804ad50,%eax
0x08048b31 <phase_4+11>:        add    $0x1,%eax
0x08048b34 <phase_4+14>:        movzbl (%eax),%eax
0x08048b37 <phase_4+17>:        movsbl %al,%eax
0x08048b3a <phase_4+20>:        mov    %eax,-0x8(%ebp)
0x08048b3d <phase_4+23>:        mov    0x804936b,%eax
0x08048b42 <phase_4+28>:        mov    0x804936f,%edx
0x08048b48 <phase_4+34>:        mov    %eax,-0x10(%ebp)
0x08048b4b <phase_4+37>:        mov    %edx,-0xc(%ebp)
0x08048b4e <phase_4+40>:        jmp    0x8048b54 <phase_4+46>
0x08048b50 <phase_4+42>:        subl   $0x3,-0x8(%ebp)
0x08048b54 <phase_4+46>:        cmpl   $0x6,-0x8(%ebp)
0x08048b58 <phase_4+50>:        jg     0x8048b50 <phase_4+42>
0x08048b5a <phase_4+52>:        mov    -0x8(%ebp),%eax
0x08048b5d <phase_4+55>:        mov    %eax,0x4(%esp)
0x08048b61 <phase_4+59>:        movl   $0x8049356,(%esp)
0x08048b68 <phase_4+66>:        call   0x8048504 <printf@plt>
0x08048b6d <phase_4+71>:        mov    0x8(%ebp),%eax
0x08048b70 <phase_4+74>:        movzbl (%eax),%eax
0x08048b73 <phase_4+77>:        mov    %al,-0x1(%ebp)
0x08048b76 <phase_4+80>:        mov    -0x8(%ebp),%eax
0x08048b79 <phase_4+83>:        sub    $0x1,%eax
0x08048b7c <phase_4+86>:        movzbl -0x10(%ebp,%eax,1),%eax
0x08048b81 <phase_4+91>:        cmp    -0x1(%ebp),%al
0x08048b84 <phase_4+94>:        je     0x8048b8b <phase_4+101>
0x08048b86 <phase_4+96>:        call   0x8048996 <explode_bomb>
0x08048b8b <phase_4+101>:       leave  
0x08048b8c <phase_4+102>:       ret    

I have been running this code through the gnu debugger and i am confused as to what it does? I know up until line 66 it is computing 'my number' which is then used later but i don't understand exactly what is happening after line 66.

I also was curious why %eax on line 71 has a different value after line 74. Doesn't movzbl change the last three bits, if so when the value in eax is '0' why is the new value 30?

Is This A Good Question/Topic? 0
  • +

Replies To: Can anyone explain what this assemble code does?

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon

Reputation: 10196
  • View blog
  • Posts: 37,655
  • Joined: 27-December 08

Re: Can anyone explain what this assemble code does?

Posted 23 May 2013 - 12:05 AM

The binary bomb is a project for you to do, not us. On top of that, we really don't help with disassembling executables. You are welcome to shoot me a PM with any questions regarding my closing of this topic.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1