Hello I’m working on bomblab, but I stuck on phase 4. I see that this phase requiers a recursive call and one of my numbers is 14 the other number should <=15. Can someone help? I’ve being doing it for days and cannot move anywhere. Thank you!
Disrcription:
The nefarious Dr. Evil has planted a slew of “binary bombs” on our class server. A binary bomb is a program
that consists of a sequence of phases. Each phase expects you to type a particular string on stdin (at the
keyboard). 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.
There are too many bombs for us to deal with, so we are giving each student a bomb to defuse. Your
mission, which you have no choice but to accept, is to defuse your bomb before the due date. Good luck,
and welcome to the bomb squad!
000000000040100f <func4>:
40100f: 53 push %rbx
401010: 89 d0 mov %edx,%eax
401012: 29 f0 sub %esi,%eax
401014: 89 c3 mov %eax,%ebx
401016: c1 eb 1f shr $0x1f,%ebx
401019: 01 c3 add %eax,%ebx
40101b: d1 fb sar %ebx
40101d: 01 f3 add %esi,%ebx
40101f: 39 fb cmp %edi,%ebx
401021: 7f 06 jg 401029 <func4+0x1a>
401023: 7c 10 jl 401035 <func4+0x26>
401025: 89 d8 mov %ebx,%eax
401027: 5b pop %rbx
401028: c3 retq
401029: 8d 53 ff lea -0x1(%rbx),%edx
40102c: e8 de ff ff ff callq 40100f <func4>
401031: 01 c3 add %eax,%ebx
401033: eb f0 jmp 401025 <func4+0x16>
401035: 8d 73 01 lea 0x1(%rbx),%esi
401038: e8 d2 ff ff ff callq 40100f <func4>
40103d: 01 c3 add %eax,%ebx
40103f: eb e4 jmp 401025 <func4+0x16>
000000000401041 <phase_4>:
401041: 48 83 ec 18 sub $0x18,%rsp
401045: 48 8d 4c 24 08 lea 0x8(%rsp),%rcx
40104a: 48 8d 54 24 0c lea 0xc(%rsp),%rdx
40104f: be a5 27 40 00 mov $0x4027a5,%esi
401054: b8 00 00 00 00 mov $0x0,%eax
401059: e8 d2 fb ff ff callq 400c30 <__isoc99_sscanf@plt>
40105e: 83 f8 02 cmp $0x2,%eax
401061: 75 07 jne 40106a <phase_4+0x29>
401063: 83 7c 24 0c 0e cmpl $0xe,0xc(%rsp)
401068: 76 05 jbe 40106f <phase_4+0x2e>
40106a: e8 06 05 00 00 callq 401575 <explode_bomb>
40106f: ba 0e 00 00 00 mov $0xe,%edx
401074: be 00 00 00 00 mov $0x0,%esi
401079: 8b 7c 24 0c mov 0xc(%rsp),%edi
40107d: e8 8d ff ff ff callq 40100f <func4>
401082: 83 f8 0f cmp $0xf,%eax
401085: 75 07 jne 40108e <phase_4+0x4d>
401087: 83 7c 24 08 0f cmpl $0xf,0x8(%rsp)
40108c: 74 05 je 401093 <phase_4+0x52>
40108e: e8 e2 04 00 00 callq 401575 <explode_bomb>
401093: 48 83 c4 18 add $0x18,%rsp
401097: c3 retq
Halfway there!
15 14
Breakpoint 3, 0x0000000000401575 in explode_bomb ()
(gdb) i r
rax 0x2 2
rbx 0x7fffffffe2b8 140737488347832
rcx 0x0 0
rdx 0x7fffffffe1c8 140737488347592
rsi 0x0 0
rdi 0x0 0
rbp 0x4022b0 0x4022b0 <__libc_csu_init>
rsp 0x7fffffffe1b8 0x7fffffffe1b8
r8 0x7fffffffdb52 140737488345938
r9 0x0 0
r10 0x7ffff7b7a9a0 140737349396896
r11 0x0 0
r12 0x400cd0 4197584
r13 0x7fffffffe2b0 140737488347824
r14 0x0 0
r15 0x0 0
rip 0x401575 0x401575 <explode_bomb>
eflags 0x202 [ IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
k0 0x0 0
k1 0x0 0
k2 0x0 0
k3 0x0 0
k4 0x0 0
k5 0x0 0
k6 0x0 0
k7 0x0 0
(gdb) nexti
0x0000000000401579 in explode_bomb ()
(gdb) i r
rax 0x2 2
rbx 0x7fffffffe2b8 140737488347832
rcx 0x0 0
rdx 0x7fffffffe1c8 140737488347592
rsi 0x0 0
rdi 0x0 0
rbp 0x4022b0 0x4022b0 <__libc_csu_init>
rsp 0x7fffffffe1b0 0x7fffffffe1b0
r8 0x7fffffffdb52 140737488345938
r9 0x0 0
r10 0x7ffff7b7a9a0 140737349396896
r11 0x0 0
r12 0x400cd0 4197584
r13 0x7fffffffe2b0 140737488347824
r14 0x0 0
r15 0x0 0
rip 0x401579 0x401579 <explode_bomb+4>
eflags 0x202 [ IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
k0 0x0 0
k1 0x0 0
k2 0x0 0
k3 0x0 0
k4 0x0 0
k5 0x0 0
k6 0x0 0
k7 0x0 0
(gdb) nexti
0x000000000040157e in explode_bomb ()
(gdb) i r
rax 0x2 2
rbx 0x7fffffffe2b8 140737488347832
rcx 0x0 0
rdx 0x7fffffffe1c8 140737488347592
rsi 0x0 0
rdi 0x402779 4204409
rbp 0x4022b0 0x4022b0 <__libc_csu_init>
rsp 0x7fffffffe1b0 0x7fffffffe1b0
r8 0x7fffffffdb52 140737488345938
r9 0x0 0
r10 0x7ffff7b7a9a0 140737349396896
r11 0x0 0
r12 0x400cd0 4197584
r13 0x7fffffffe2b0 140737488347824
r14 0x0 0
r15 0x0 0
rip 0x40157e 0x40157e <explode_bomb+9>
eflags 0x202 [ IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
k0 0x0 0
k1 0x0 0
k2 0x0 0
k3 0x0 0
k4 0x0 0
k5 0x0 0
k6 0x0 0
k7 0x0 0
(gdb) nexti
BOOM!!!
0x0000000000401583 in explode_bomb ()
(gdb)
I tried to move thru the go by nexti and check register info
user25191636 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.