Reputation: 1
I am currently working on defusing a bomb and am on the fourth phase of the bomb, but I have run into a problem. I am not sure what this part of the code means.
0x08048f64 <phase_4+81>: mov 0x804a20c(,%edx,4),%eax
0x08048f6b <phase_4+88>: jmp *%eax
I think that this line of code means to input some line of code into $eax and jump to it, but not so sure though since I do not know what value s at 0x804a20c. I am a little new to assembly. So far I know that the input has to consist of two numbers and that the second number has to be 126. I am not sure what the first number has to be though. Everytime I run the code with numbers x and 126. X being any number I get to the final step, but in that step it compares the value of 0 in -0x8(ebp) to the length of the string. Since on line 56 it inputs 0 into -0x8(ebp). I am wondering if the above code has anything to do with this.
For example, if I input "100 126" then the program will compare the values of 7 to 0 and not let me jump the last explosion on line 191.
Here's the full code.
0x08048f13 <phase_4+0>: push %ebp
0x08048f14 <phase_4+1>: mov %esp,%ebp
0x08048f16 <phase_4+3>: push %ebx
0x08048f17 <phase_4+4>: sub $0x24,%esp
0x08048f1a <phase_4+7>: lea -0x14(%ebp),%eax
0x08048f1d <phase_4+10>: mov %eax,0xc(%esp)
0x08048f21 <phase_4+14>: lea -0x10(%ebp),%eax
0x08048f24 <phase_4+17>: mov %eax,0x8(%esp)
0x08048f28 <phase_4+21>: movl $0x804a206,0x4(%esp)
0x08048f30 <phase_4+29>: mov 0x8(%ebp),%eax
0x08048f33 <phase_4+32>: mov %eax,(%esp)
0x08048f36 <phase_4+35>: call 0x8048b10 <sscanf@plt>
0x08048f3b <phase_4+40>: cmp $0x2,%eax
0x08048f3e <phase_4+43>: je 0x8048f45 <phase_4+50>
0x08048f40 <phase_4+45>: call 0x8049e74 <explosion>
0x08048f45 <phase_4+50>: mov -0x10(%ebp),%eax
0x08048f48 <phase_4+53>: mov %eax,-0xc(%ebp)
0x08048f4b <phase_4+56>: movl $0x0,-0x8(%ebp)
0x08048f52 <phase_4+63>: mov -0x14(%ebp),%eax
0x08048f55 <phase_4+66>: sub $0x74,%eax
0x08048f58 <phase_4+69>: mov %eax,-0x18(%ebp)
0x08048f5b <phase_4+72>: cmpl $0xa,-0x18(%ebp)
0x08048f5f <phase_4+76>: ja 0x8048fb5 <phase_4+162>
0x08048f61 <phase_4+78>: mov -0x18(%ebp),%edx
0x08048f64 <phase_4+81>: mov 0x804a20c(,%edx,4),%eax
0x08048f6b <phase_4+88>: jmp *%eax
0x08048f6d <phase_4+90>: addl $0x1,-0x8(%ebp)
0x08048f71 <phase_4+94>: movl $0x72,-0xc(%ebp)
0x08048f78 <phase_4+101>: shll -0x8(%ebp)
0x08048f7b <phase_4+104>: jmp 0x8048fba <phase_4+167>
0x08048f7d <phase_4+106>: addl $0x38,-0xc(%ebp)
0x08048f81 <phase_4+110>: addl $0x1,-0xc(%ebp)
0x08048f85 <phase_4+114>: movl $0x7a,-0x8(%ebp)
0x08048f8c <phase_4+121>: jmp 0x8048fba <phase_4+167>
0x08048f8e <phase_4+123>: movl $0x44,-0xc(%ebp)
0x08048f95 <phase_4+130>: subl $0x1,-0xc(%ebp)
0x08048f99 <phase_4+134>: shll -0x8(%ebp)
0x08048f9c <phase_4+137>: jmp 0x8048fba <phase_4+167>
0x08048f9e <phase_4+139>: subl $0x1,-0x8(%ebp)
0x08048fa2 <phase_4+143>: subl $0x7a,-0xc(%ebp)
0x08048fa6 <phase_4+147>: jmp 0x8048fba <phase_4+167>
0x08048fa8 <phase_4+149>: movl $0x3,-0xc(%ebp)
0x08048faf <phase_4+156>: addl $0x1,-0x8(%ebp)
0x08048fb3 <phase_4+160>: jmp 0x8048fba <phase_4+167>
0x08048fb5 <phase_4+162>: call 0x8049e74 <explosion>
0x08048fba <phase_4+167>: mov -0xc(%ebp),%eax
0x08048fbd <phase_4+170>: imul -0x8(%ebp),%eax
0x08048fc1 <phase_4+174>: mov %eax,%ebx
0x08048fc3 <phase_4+176>: mov 0x8(%ebp),%eax
0x08048fc6 <phase_4+179>: mov %eax,(%esp)
0x08048fc9 <phase_4+182>: call 0x8048a20 <strlen@plt>
0x08048fce <phase_4+187>: cmp %eax,%ebx
0x08048fd0 <phase_4+189>: je 0x8048fd7 <phase_4+196>
0x08048fd2 <phase_4+191>: call 0x8049e74 <explosion>
0x08048fd7 <phase_4+196>: add $0x24,%esp
0x08048fda <phase_4+199>: pop %ebx
0x08048fdb <phase_4+200>: pop %ebp
0x08048fdc <phase_4+201>: ret
any help is appreciated. Thank you.
Upvotes: 0
Views: 3169
Reputation: 5648
What is at 804a20c is inconsequential, because the address from which the jump is loaded depends on what is in edx. The address is actually the base of a jump table that is indexed by edx. The address jumped to in the second line is the address in memory at 804a20c+(edx*4).
Upvotes: 5