I am currently working on defusing a binary bomb and am stuck on phase 5. As far as I could figure out, there is a loop and the index (%edx) needs to be 15 to get through the loop. However, I am stuck at the array which always returns 15 after 6 cycles, therefore leaving the first loop and comparing %edx which only gets to 6, comparing this to 15 and therefore failing.
How do i calculate the value that is needed in order for the cycle to be done 15 times? The array is: 10, 2, 14, 7, 8, 12, 15, 11, 0, 4, 1, 13, 3, 9, 6, 5
0000000000401061 <phase_5>:
401061: 53 push %rbx
401062: 48 83 ec 10 sub $0x10,%rsp
401066: 48 89 fb mov %rdi,%rbx
401069: e8 53 12 00 00 call 4022c1 <phase_init>
40106e: 48 8d 4c 24 08 lea 0x8(%rsp),%rcx
401073: 48 8d 54 24 0c lea 0xc(%rsp),%rdx
401078: be 90 28 40 00 mov $0x402890,%esi
40107d: 48 89 df mov %rbx,%rdi
401080: b8 00 00 00 00 mov $0x0,%eax
401085: e8 36 fa ff ff call 400ac0 <__isoc99_sscanf@plt>
40108a: 83 f8 01 cmp $0x1,%eax
40108d: 7f 05 jg 401094 <phase_5+0x33>
40108f: e8 98 04 00 00 call 40152c <explode_bomb>
401094: 8b 44 24 0c mov 0xc(%rsp),%eax
401098: 83 e0 0f and $0xf,%eax
40109b: 89 44 24 0c mov %eax,0xc(%rsp)
40109f: 83 f8 0f cmp $0xf,%eax
4010a2: 74 30 je 4010d4 <phase_5+0x73>
4010a4: b9 64 00 00 00 mov $0x64,%ecx
4010a9: ba 00 00 00 00 mov $0x0,%edx
4010ae: 83 c2 01 add $0x1,%edx
4010b1: 48 98 cltq
4010b3: 8b 04 85 80 26 40 00 mov 0x402680(,%rax,4),%eax
4010ba: 29 c1 sub %eax,%ecx
4010bc: 83 f8 0f cmp $0xf,%eax
4010bf: 75 ed jne 4010ae <phase_5+0x4d>
4010c1: c7 44 24 0c 0f 00 00 movl $0xf,0xc(%rsp)
4010c8: 00
4010c9: 83 fa 0f cmp $0xf,%edx
4010cc: 75 06 jne 4010d4 <phase_5+0x73>
4010ce: 3b 4c 24 08 cmp 0x8(%rsp),%ecx
4010d2: 74 05 je 4010d9 <phase_5+0x78>
4010d4: e8 53 04 00 00 call 40152c <explode_bomb>
4010d9: 48 83 c4 10 add $0x10,%rsp
4010dd: 5b pop %rbx
4010de: c3 ret
I am sorry if the question seems stupid, but i only recently got into reverse engineering and am quite new to the whole topic. Thank you!
I tried to start behind the array position which would be 15, so I inputted 7 which allowed me to get 12 cycles. I also tried to use the position of 0 in the array which would be 8 (32/4), but without luck.