Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The nefarious Dr . Evil has planted a slew of binary bombs on our class machines. A binary bomb is a program that consists of

The nefarious Dr. Evil has planted a slew of binary bombs on our class machines. A binary bomb is a program that consists of a sequence of phases. Each phase expects you to type a particular string on stdin. If you type the correct string, then the phase is defused and the bomb proceeds to the next phase. Otherwise, the bomb explodes by printing "BOOM!!!" and then terminating. The bomb is defused when every phase has been defused.
disas phase_3
Dump of assembler code for function phase_3:
0x0000000000400f54<+0>: sub $0x18,%rsp
0x0000000000400f58<+4>: lea 0x8(%rsp),%rcx
0x0000000000400f5d <+9>: lea 0xc(%rsp),%rdx
0x0000000000400f62<+14>: mov $0x402785,%esi
0x0000000000400f67<+19>: mov $0x0,%eax
0x0000000000400f6c <+24>: callq 0x400c30<__isoc99_sscanf@plt>
0x0000000000400f71<+29>: cmp $0x1,%eax
0x0000000000400f74<+32>: jle 0x400f88
0x0000000000400f76<+34>: cmpl $0x7,0xc(%rsp)
0x0000000000400f7b <+39>: ja 0x400fc0
0x0000000000400f7d <+41>: mov 0xc(%rsp),%eax
0x0000000000400f81<+45>: jmpq *0x4024e0(,%rax,8)
0x0000000000400f88<+52>: callq 0x401549
0x0000000000400f8d <+57>: jmp 0x400f76
0x0000000000400f8f <+59>: mov $0x199,%eax
0x0000000000400f94<+64>: jmp 0x400fd1
0x0000000000400f96<+66>: mov $0x3a0,%eax
0x0000000000400f9b <+71>: jmp 0x400fd1
0x0000000000400f9d <+73>: mov $0x345,%eax
0x0000000000400fa2<+78>: jmp 0x400fd1
0x0000000000400fa4<+80>: mov $0x7a,%eax
0x0000000000400fa9<+85>: jmp 0x400fd1
0x0000000000400fab <+87>: mov $0x2ba,%eax
0x0000000000400fb0<+92>: jmp 0x400fd1
0x0000000000400fb2<+94>: mov $0x185,%eax
0x0000000000400fb7<+99>: jmp 0x400fd1
0x0000000000400fb9<+101>: mov $0x311,%eax
0x0000000000400fbe <+106>: jmp 0x400fd1
0x0000000000400fc0<+108>: callq 0x401549
0x0000000000400fc5<+113>: mov $0x0,%eax
0x0000000000400fca <+118>: jmp 0x400fd1
0x0000000000400fcc <+120>: mov $0xc9,%eax
0x0000000000400fd1<+125>: cmp %eax,0x8(%rsp)
0x0000000000400fd5<+129>: jne 0x400fdc
0x0000000000400fd7<+131>: add $0x18,%rsp
0x0000000000400fdb <+135>: retq
0x0000000000400fdc <+136>: callq 0x401549
0x0000000000400fe1<+141>: jmp 0x400fd7
End of assembler dump.
The function uses sscanf to read two integers from input.
It checks if at least one integer was successfully scanned. If not, it explodes the bomb.
If at least one integer is scanned, it compares the second integer with 7. If it's greater than 7, it explodes the bomb.
Otherwise, it uses a jump table to determine the next action based on the value of the second integer.
There are several jump targets based on the second integer's value.
After executing the corresponding action, it compares the first integer with a specific value. If it matches, the bomb is defused; otherwise, it explodes.
initially , i read the code and thought the output would be 3 X with X being any integer 0-7. Yet I tried all these outputs and the bomb still explodes. Can anyone please help??

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago