[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

Bomblab Phase 2

Asked by Cosmonaut in Assembly Programming Language, Programming Languages, C Programming Language

Tags: Binary Bomb, Phase 2, Bomblab

Hello!
I am working on the second phase of the binary bomb/bomblab project, and I am a bit stuck.
Basically, we have to input 6 integers to keep the bomb from exploding - however they must be the 6 correct digits, and you have to find them in order.  I am using the gdb compiler.  
This is my code and the comments are how I understand it at the moment:

08048dc2 <phase_2>:
 8048dc2:      55                         push   %ebp
 8048dc3:      89 e5                      mov    %esp,%ebp
 8048dc5:      56                         push   %esi
 8048dc6:      53                         push   %ebx
 8048dc7:      83 ec 30                   sub    $0x30,%esp
 8048dca:      8d 45 e0                   lea    -0x20(%ebp),%eax
 8048dcd:      89 44 24 04                mov    %eax,0x4(%esp)
 8048dd1:      8b 45 08                   mov    0x8(%ebp),%eax
 8048dd4:      89 04 24                   mov    %eax,(%esp) //*esp = eax <- esp points to eax
 8048dd7:      e8 37 06 00 00             call   8049413 <read_six_numbers> //function call
 8048ddc:      bb 02 00 00 00             mov    $0x2,%ebx // ebx = 2
 8048de1:      8d 75 e0                   lea    -0x20(%ebp),%esi // loop -0x20(%ebp) = &esi
 8048de4:      8b 44 9e f8                mov    -0x8(%esi,%ebx,4),%eax // eax = esi[ebx-2]
 8048de8:      83 c0 05                   add    $0x5,%eax // eax += 5
 8048deb:      39 44 9e fc                cmp    %eax,-0x4(%esi,%ebx,4) // if (esi[ebx-1] == eax)
 8048def:      74 05                      je     8048df6 <phase_2+0x34> // safe
 8048df1:      e8 db 05 00 00             call   80493d1 <explode_bomb> // yuck
 8048df6:      83 c3 01                   add    $0x1,%ebx // ebx += 1
 8048df9:      83 fb 07                   cmp    $0x7,%ebx // if ebx != 7
 8048dfc:      75 e6                      jne    8048de4 <phase_2+0x22> // go to loop
 8048dfe:      83 c4 30                   add    $0x30,%esp
 8048e01:      5b                         pop    %ebx
 8048e02:      5e                         pop    %esi
 8048e03:      5d                         pop    %ebp
 8048e04:      c3                         ret  

08049413 <read_six_numbers>: //checks to make sure you have entered 6 integers & puts them in stack then returns to phase 2
 8049413:      55                         push   %ebp
 8049414:      89 e5                      mov    %esp,%ebp
 8049416:      83 ec 28                   sub    $0x28,%esp
 8049419:      8b 55 0c                   mov    0xc(%ebp),%edx
 804941c:      8d 42 14                   lea    0x14(%edx),%eax
 804941f:      89 44 24 1c                mov    %eax,0x1c(%esp)
 8049423:      8d 42 10                   lea    0x10(%edx),%eax
 8049426:      89 44 24 18                mov    %eax,0x18(%esp)
 804942a:      8d 42 0c                   lea    0xc(%edx),%eax
 804942d:      89 44 24 14                mov    %eax,0x14(%esp)
 8049431:      8d 42 08                   lea    0x8(%edx),%eax
 8049434:      89 44 24 10                mov    %eax,0x10(%esp)
 8049438:      8d 42 04                   lea    0x4(%edx),%eax
 804943b:      89 44 24 0c                mov    %eax,0xc(%esp)
 804943f:      89 54 24 08                mov    %edx,0x8(%esp)
 8049443:      c7 44 24 04 59 9c 04       movl   $0x8049c59,0x4(%esp)
 804944a:      08
 804944b:      8b 45 08                   mov    0x8(%ebp),%eax
 804944e:      89 04 24                   mov    %eax,(%esp)
 8049451:      e8 7e f5 ff ff             call   80489d4 <sscanf@plt>
 8049456:      83 f8 05                   cmp    $0x5,%
 8049459:      7f 05                      jg     8049460 <read_six_numbers+0x4d>
 804945b:      e8 71 ff ff ff             call   80493d1 <explode_bomb>
 8049460:      c9                         leave  
 8049461:      c3                         ret    

I have been using a few examples to try and walk through the code, and my main problem at the moment is that I feel I should be able to use "p $eax"  at this point "cmp    %eax,-0x4(%esi,%ebx,4)" to see what is being compared to the numbers I input.  It has been returning 6, however, if I use that for my first integer the bomb explodes.  

Any help would be greatly appreciated!!!

 
Loading Advertisement...
 
[+][-]10/20/09 07:24 AM, ID: 25614466Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Assembly Programming Language, Programming Languages, C Programming Language
Tags: Binary Bomb, Phase 2, Bomblab
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 1
Solution Grade: A
 
[+][-]10/20/09 07:40 AM, ID: 25614635Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/20/09 08:13 AM, ID: 25615017Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/20/09 08:26 AM, ID: 25615140Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/20/09 08:36 AM, ID: 25615238Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/20/09 09:59 AM, ID: 25616118Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/20/09 09:59 AM, ID: 25616122Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/20/09 10:43 AM, ID: 25616571Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625