Answered step by step
Verified Expert Solution
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 Dump of assembler code for function phase: xf: sub $xrsp xf: lea xrsprcx xfd : lea xcrsprdx xf: mov $xesi xf: mov $xeax xfc : callq xcisocsscanf@plt xf: cmp $xeax xf: jle xf xf: cmpl $xxcrsp xfb : ja xfc xfd : mov xcrspeax xf: jmpq xerax, xf: callq x xfd : jmp xf xff : mov $xeax xf: jmp xfd xf: mov $xaeax xfb : jmp xfd xfd : mov $xeax xfa: jmp xfd xfa: mov $xaeax xfa: jmp xfd xfab : mov $xbaeax xfb: jmp xfd xfb: mov $xeax xfb: jmp xfd xfb: mov $xeax xfbe : jmp xfd xfc: callq x xfc: mov $xeax xfca : jmp xfd xfcc : mov $xceax xfd: cmp eax,xrsp xfd: jne xfdc xfd: add $xrsp xfdb : retq xfdc : callq x xfe: jmp xfd 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 If it's greater than 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 X with X being any integer Yet I tried all these outputs and the bomb still explodes. Can anyone please help??
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
Dump of assembler code for function phase:
xf: sub $xrsp
xf: lea xrsprcx
xfd : lea xcrsprdx
xf: mov $xesi
xf: mov $xeax
xfc : callq xcisocsscanf@plt
xf: cmp $xeax
xf: jle xf
xf: cmpl $xxcrsp
xfb : ja xfc
xfd : mov xcrspeax
xf: jmpq xerax,
xf: callq x
xfd : jmp xf
xff : mov $xeax
xf: jmp xfd
xf: mov $xaeax
xfb : jmp xfd
xfd : mov $xeax
xfa: jmp xfd
xfa: mov $xaeax
xfa: jmp xfd
xfab : mov $xbaeax
xfb: jmp xfd
xfb: mov $xeax
xfb: jmp xfd
xfb: mov $xeax
xfbe : jmp xfd
xfc: callq x
xfc: mov $xeax
xfca : jmp xfd
xfcc : mov $xceax
xfd: cmp eax,xrsp
xfd: jne xfdc
xfd: add $xrsp
xfdb : retq
xfdc : callq x
xfe: jmp xfd
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 If it's greater than 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 X with X being any integer 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started