本人刚开始学习汇编语言,正在做著名的二进制拆弹实验。但是以下几部分看不明白,做不出来,求解QAQ(手机端可以向右拉看见汇编语言形式的代码,左侧是机器语言的形式)
080497ed :
80497ed: f3 0f 1e fb endbr32
80497f1: 55 push %ebp
80497f2: 89 e5 mov ,%eb%espp
80497f4: 83 ec 18 sub $0x18,%esp
80497f7: 8b 55 0c mov 0xc(%ebp),%edx
80497fa: 8b 45 10 mov 0x10(%ebp),%eax
80497fd: 01 d0 add %edx,%eax
80497ff: 89 c2 mov %eax,%edx
8049801: c1 ea 1f shr $0x1f,%edx
8049804: 01 d0 add %edx,%eax
8049806: d1 f8 sar %eax
8049808: 89 45 ec mov %eax,-0x14(%ebp)
804980b: 8b 45 0c mov 0xc(%ebp),%eax
804980e: 3b 45 10 cmp 0x10(%ebp),%eax
8049811: 7c 13 jl 8049826 0x39>
8049813: 8b 45 10 mov 0x10(%ebp),%eax
8049816: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
804981d: 8b 45 08 mov 0x8(%ebp),%eax
8049820: 01 d0 add %edx,%eax
8049822: 8b 00 mov (%eax),%eax
8049824: eb 3c jmp 8049862 0x75>
8049826: 83 ec 04 sub $0x4,%esp
8049829: ff 75 ec pushl -0x14(%ebp)
804982c: ff 75 0c pushl 0xc(%ebp)
804982f: ff 75 08 pushl 0x8(%ebp)
8049832: e8 b6 ff ff ff call 80497ed
8049837: 83 c4 10 add $0x10,%esp
804983a: 89 45 f0 mov %eax,-0x10(%ebp)
804983d: 8b 45 ec mov -0x14(%ebp),%eax
8049840: 83 c0 01 add $0x1,%eax
8049843: 83 ec 04 sub $0x4,%esp
8049846: ff 75 10 pushl 0x10(%ebp)
8049849: 50 push %eax
804984a: ff 75 08 pushl 0x8(%ebp)
804984d: e8 9b ff ff ff call 80497ed
8049852: 83 c4 10 add $0x10,%esp
8049855: 89 45 f4 mov %eax,-0xc(%ebp)
8049858: 8b 45 f4 mov -0xc(%ebp),%eax
804985b: 39 45 f0 cmp %eax,-0x10(%ebp)
804985e: 0f 4d 45 f0 cmovge -0x10(%ebp),%eax
8049862: c9 leave
8049863: c3 ret
08049864 :
8049864: f3 0f 1e fb endbr32
8049868: 55 push %ebp
8049869: 89 e5 mov %esp,%ebp
804986b: 57 push %edi
804986c: 56 push %esi
804986d: 53 push %ebx
804986e: 81 ec cc 00 00 00 sub $0xcc,%esp
8049874: 8b 45 08 mov 0x8(%ebp),%eax
8049877: 89 85 34 ff ff ff mov %eax,-0xcc(%ebp)
804987d: 65 a1 14 00 00 00 mov %gs:0x14,%eax
8049883: 89 45 e4 mov %eax,-0x1c(%ebp)
8049886: 31 c0 xor %eax,%eax
8049888: 8d 85 50 ff ff ff lea -0xb0(%ebp),%eax
804988e: bb 20 b2 04 08 mov $0x804b220,%ebx
8049893: ba 25 00 00 00 mov $0x25,%edx
8049898: 89 c7 mov %eax,%edi
804989a: 89 de mov %ebx,%esi
804989c: 89 d1 mov %edx,%ecx
804989e: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
80498a0: 8d 85 48 ff ff ff lea -0xb8(%ebp),%eax
80498a6: 50 push %eax
80498a7: 8d 85 44 ff ff ff lea -0xbc(%ebp),%eax
80498ad: 50 push %eax
80498ae: 68 e8 b1 04 08 push $0x804b1e8
80498b3: ff b5 34 ff ff ff pushl -0xcc(%ebp)
80498b9: e8 32 f9 ff ff call 80491f0 <__isoc99_sscanf@plt>
80498be: 83 c4 10 add $0x10,%esp
80498c1: 89 85 4c ff ff ff mov %eax,-0xb4(%ebp)
80498c7: 83 bd 4c ff ff ff 02 cmpl $0x2,-0xb4(%ebp)
80498ce: 74 0f je 80498df 0x7b>
80498d0: e8 43 08 00 00 call 804a118
80498d5: b8 00 00 00 00 mov $0x0,%eax
80498da: e9 bc 00 00 00 jmp 804999b 0x137>
80498df: 8b 95 48 ff ff ff mov -0xb8(%ebp),%edx
80498e5: 8b 85 44 ff ff ff mov -0xbc(%ebp),%eax
80498eb: 83 ec 04 sub $0x4,%esp
80498ee: 52 push %edx
80498ef: 50 push %eax
80498f0: 8d 85 50 ff ff ff lea -0xb0(%ebp),%eax
80498f6: 50 push %eax
80498f7: e8 f1 fe ff ff call 80497ed
80498fc: 83 c4 10 add $0x10,%esp
80498ff: 3d a8 01 00 00 cmp $0x1a8,%eax
8049904: 74 0f je 8049915 0xb1>
8049906: e8 0d 08 00 00 call 804a118
804990b: b8 00 00 00 00 mov $0x0,%eax
8049910: e9 86 00 00 00 jmp 804999b 0x137>
8049915: 8b 85 44 ff ff ff mov -0xbc(%ebp),%eax
804991b: 85 c0 test %eax,%eax
804991d: 7e 36 jle 8049955 0xf1>
804991f: 8b 85 48 ff ff ff mov -0xb8(%ebp),%eax
8049925: 8b 95 44 ff ff ff mov -0xbc(%ebp),%edx
804992b: 83 ea 01 sub $0x1,%edx
804992e: 83 ec 04 sub $0x4,%esp
8049931: 50 push %eax
8049932: 52 push %edx
8049933: 8d 85 50 ff ff ff lea -0xb0(%ebp),%eax
8049939: 50 push %eax
804993a: e8 ae fe ff ff call 80497ed
804993f: 83 c4 10 add $0x10,%esp
8049942: 3d a8 01 00 00 cmp $0x1a8,%eax
8049947: 75 0c jne 8049955 0xf1>
8049949: e8 ca 07 00 00 call 804a118
804994e: b8 00 00 00 00 mov $0x0,%eax
8049953: eb 46 jmp 804999b 0x137>
8049955: 8b 85 48 ff ff ff mov -0xb8(%ebp),%eax
804995b: 83 f8 23 cmp $0x23,%eax
804995e: 7f 36 jg 8049996 0x132>
8049960: 8b 85 48 ff ff ff mov -0xb8(%ebp),%eax
8049966: 8d 50 01 lea 0x1(%eax),%edx
8049969: 8b 85 44 ff ff ff mov -0xbc(%ebp),%eax
804996f: 83 ec 04 sub $0x4,%esp
8049972: 52 push %edx
8049973: 50 push %eax
8049974: 8d 85 50 ff ff ff lea -0xb0(%ebp),%eax
804997a: 50 push %eax
804997b: e8 6d fe ff ff call 80497ed
8049980: 83 c4 10 add $0x10,%esp
8049983: 3d a8 01 00 00 cmp $0x1a8,%eax
8049988: 75 0c jne 8049996 0x132>
804998a: e8 89 07 00 00 call 804a118
804998f: b8 00 00 00 00 mov $0x0,%eax
8049994: eb 05 jmp 804999b 0x137>
8049996: b8 01 00 00 00 mov $0x1,%eax
804999b: 8b 4d e4 mov -0x1c(%ebp),%ecx
804999e: 65 33 0d 14 00 00 00 xor %gs:0x14,%ecx
80499a5: 74 05 je 80499ac 0x148>
80499a7: e8 e4 f7 ff ff call 8049190 <__stack_chk_fail@plt>
80499ac: 8d 65 f4 lea -0xc(%ebp),%esp
80499af: 5b pop %ebx
80499b0: 5e pop %esi
80499b1: 5f pop %edi
80499b2: 5d pop %ebp
80499b3: c3 ret
080499b4 :
80499b4: f3 0f 1e fb endbr32
80499b8: 55 push %ebp
80499b9: 89 e5 mov %esp,%ebp
80499bb: 83 ec 38 sub $0x38,%esp
80499be: 8b 45 08 mov 0x8(%ebp),%eax
80499c1: 89 45 d4 mov %eax,-0x2c(%ebp)
80499c4: 65 a1 14 00 00 00 mov %gs:0x14,%eax
80499ca: 89 45 f4 mov %eax,-0xc(%ebp)
80499cd: 31 c0 xor %eax,%eax
80499cf: 8d 45 e4 lea -0x1c(%ebp),%eax
80499d2: 50 push %eax
80499d3: 8d 45 e0 lea -0x20(%ebp),%eax
80499d6: 50 push %eax
80499d7: 68 e8 b1 04 08 push $0x804b1e8
80499dc: ff 75 d4 pushl -0x2c(%ebp)
80499df: e8 0c f8 ff ff call 80491f0 <__isoc99_sscanf@plt>
80499e4: 83 c4 10 add $0x10,%esp
80499e7: 89 45 f0 mov %eax,-0x10(%ebp)
80499ea: 83 7d f0 01 cmpl $0x1,-0x10(%ebp)
80499ee: 7f 0c jg 80499fc 0x48>
80499f0: e8 23 07 00 00 call 804a118
80499f5: b8 00 00 00 00 mov $0x0,%eax
80499fa: eb 57 jmp 8049a53 0x9f>
80499fc: 8b 45 e0 mov -0x20(%ebp),%eax
80499ff: 83 e0 0f and $0xf,%eax
8049a02: 89 45 e0 mov %eax,-0x20(%ebp)
8049a05: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
8049a0c: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
8049a13: eb 17 jmp 8049a2c 0x78>
8049a15: 83 45 e8 01 addl $0x1,-0x18(%ebp)
8049a19: 8b 45 e0 mov -0x20(%ebp),%eax
8049a1c: 8b 04 85 e0 d1 04 08 mov 0x804d1e0(,%eax,4),%eax
8049a23: 89 45 e0 mov %eax,-0x20(%ebp)
8049a26: 8b 45 e0 mov -0x20(%ebp),%eax
8049a29: 01 45 ec add %eax,-0x14(%ebp)
8049a2c: 8b 45 e0 mov -0x20(%ebp),%eax
8049a2f: 83 f8 0f cmp $0xf,%eax
8049a32: 75 e1 jne 8049a15 0x61>
8049a34: 83 7d e8 0a cmpl $0xa,-0x18(%ebp)
8049a38: 75 08 jne 8049a42 0x8e>
8049a3a: 8b 45 e4 mov -0x1c(%ebp),%eax
8049a3d: 39 45 ec cmp %eax,-0x14(%ebp)
8049a40: 74 0c je 8049a4e 0x9a>
8049a42: e8 d1 06 00 00 call 804a118
8049a47: b8 00 00 00 00 mov $0x0,%eax
8049a4c: eb 05 jmp 8049a53 0x9f>
8049a4e: b8 01 00 00 00 mov $0x1,%eax
8049a53: 8b 55 f4 mov -0xc(%ebp),%edx
8049a56: 65 33 15 14 00 00 00 xor %gs:0x14,%edx
8049a5d: 74 05 je 8049a64 0xb0>
8049a5f: e8 2c f7 ff ff call 8049190 <__stack_chk_fail@plt>
8049a64: c9 leave
8049a65: c3 ret
08049a66 :
8049a66: f3 0f 1e fb endbr32
8049a6a: 55 push %ebp
8049a6b: 89 e5 mov %esp,%ebp
8049a6d: 83 ec 68 sub $0x68,%esp
8049a70: 8b 45 08 mov 0x8(%ebp),%eax
8049a73: 89 45 a4 mov %eax,-0x5c(%ebp)
8049a76: 65 a1 14 00 00 00 mov %gs:0x14,%eax
8049a7c: 89 45 f4 mov %eax,-0xc(%ebp)
8049a7f: 31 c0 xor %eax,%eax
8049a81: c7 45 b8 10 d1 04 08 movl $0x804d110,-0x48(%ebp)
8049a88: 83 ec 04 sub $0x4,%esp
8049a8b: 6a 07 push $0x7
8049a8d: 8d 45 bc lea -0x44(%ebp),%eax
8049a90: 50 push %eax
8049a91: ff 75 a4 pushl -0x5c(%ebp)
8049a94: e8 3d 03 00 00 call 8049dd6
8049a99: 83 c4 10 add $0x10,%esp
8049a9c: 85 c0 test %eax,%eax
8049a9e: 75 0a jne 8049aaa 0x44>
8049aa0: b8 00 00 00 00 mov $0x0,%eax
8049aa5: e9 37 01 00 00 jmp 8049be1 0x17b>
8049aaa: c7 45 b0 00 00 00 00 movl $0x0,-0x50(%ebp)
8049ab1: eb 60 jmp 8049b13 0xad>
8049ab3: 8b 45 b0 mov -0x50(%ebp),%eax
8049ab6: 8b 44 85 bc mov -0x44(%ebp,%eax,4),%eax
8049aba: 85 c0 test %eax,%eax
8049abc: 7e 0c jle 8049aca 0x64>
8049abe: 8b 45 b0 mov -0x50(%ebp),%eax
8049ac1: 8b 44 85 bc mov -0x44(%ebp,%eax,4),%eax
8049ac5: 83 f8 07 cmp $0x7,%eax
8049ac8: 7e 0f jle 8049ad9 0x73>
8049aca: e8 49 06 00 00 call 804a118
8049acf: b8 00 00 00 00 mov $0x0,%eax
8049ad4: e9 08 01 00 00 jmp 8049be1 0x17b>
8049ad9: 8b 45 b0 mov -0x50(%ebp),%eax
8049adc: 83 c0 01 add $0x1,%eax
8049adf: 89 45 b4 mov %eax,-0x4c(%ebp)
8049ae2: eb 25 jmp 8049b09 0xa3>
8049ae4: 8b 45 b0 mov -0x50(%ebp),%eax
8049ae7: 8b 54 85 bc mov -0x44(%ebp,%eax,4),%edx
8049aeb: 8b 45 b4 mov -0x4c(%ebp),%eax
8049aee: 8b 44 85 bc mov -0x44(%ebp,%eax,4),%eax
8049af2: 39 c2 cmp %eax,%edx
8049af4: 75 0f jne 8049b05 0x9f>
8049af6: e8 1d 06 00 00 call 804a118
8049afb: b8 00 00 00 00 mov $0x0,%eax
8049b00: e9 dc 00 00 00 jmp 8049be1 0x17b>
8049b05: 83 45 b4 01 addl $0x1,-0x4c(%ebp)
8049b09: 83 7d b4 06 cmpl $0x6,-0x4c(%ebp)
8049b0d: 7e d5 jle 8049ae4 0x7e>
8049b0f: 83 45 b0 01 addl $0x1,-0x50(%ebp)
8049b13: 83 7d b0 06 cmpl $0x6,-0x50(%ebp)
8049b17: 7e 9a jle 8049ab3 0x4d>
8049b19: c7 45 b0 00 00 00 00 movl $0x0,-0x50(%ebp)
8049b20: eb 36 jmp 8049b58 0xf2>
8049b22: 8b 45 b8 mov -0x48(%ebp),%eax
8049b25: 89 45 ac mov %eax,-0x54(%ebp)
8049b28: c7 45 b4 01 00 00 00 movl $0x1,-0x4c(%ebp)
8049b2f: eb 0d jmp 8049b3e 0xd8>
8049b31: 8b 45 ac mov -0x54(%ebp),%eax
8049b34: 8b 40 08 mov 0x8(%eax),%eax
8049b37: 89 45 ac mov %eax,-0x54(%ebp)
8049b3a: 83 45 b4 01 addl $0x1,-0x4c(%ebp)
8049b3e: 8b 45 b0 mov -0x50(%ebp),%eax
8049b41: 8b 44 85 bc mov -0x44(%ebp,%eax,4),%eax
8049b45: 39 45 b4 cmp %eax,-0x4c(%ebp)
8049b48: 7c e7 jl 8049b31 0xcb>
8049b4a: 8b 45 b0 mov -0x50(%ebp),%eax
8049b4d: 8b 55 ac mov -0x54(%ebp),%edx
8049b50: 89 54 85 d8 mov %edx,-0x28(%ebp,%eax,4)
8049b54: 83 45 b0 01 addl $0x1,-0x50(%ebp)
8049b58: 83 7d b0 06 cmpl $0x6,-0x50(%ebp)
8049b5c: 7e c4 jle 8049b22 0xbc>
8049b5e: 8b 45 d8 mov -0x28(%ebp),%eax
8049b61: 89 45 b8 mov %eax,-0x48(%ebp)
8049b64: 8b 45 b8 mov -0x48(%ebp),%eax
8049b67: 89 45 ac mov %eax,-0x54(%ebp)
8049b6a: c7 45 b0 01 00 00 00 movl $0x1,-0x50(%ebp)
8049b71: eb 1a jmp 8049b8d 0x127>
8049b73: 8b 45 b0 mov -0x50(%ebp),%eax
8049b76: 8b 54 85 d8 mov -0x28(%ebp,%eax,4),%edx
8049b7a: 8b 45 ac mov -0x54(%ebp),%eax
8049b7d: 89 50 08 mov %edx,0x8(%eax)
8049b80: 8b 45 ac mov -0x54(%ebp),%eax
8049b83: 8b 40 08 mov 0x8(%eax),%eax
8049b86: 89 45 ac mov %eax,-0x54(%ebp)
8049b89: 83 45 b0 01 addl $0x1,-0x50(%ebp)
8049b8d: 83 7d b0 06 cmpl $0x6,-0x50(%ebp)
8049b91: 7e e0 jle 8049b73 0x10d>
8049b93: 8b 45 ac mov -0x54(%ebp),%eax
8049b96: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
8049b9d: 8b 45 b8 mov -0x48(%ebp),%eax
8049ba0: 89 45 ac mov %eax,-0x54(%ebp)
8049ba3: c7 45 b0 00 00 00 00 movl $0x0,-0x50(%ebp)
8049baa: eb 2a jmp 8049bd6 0x170>
8049bac: 8b 45 ac mov -0x54(%ebp),%eax
8049baf: 8b 10 mov (%eax),%edx
8049bb1: 8b 45 ac mov -0x54(%ebp),%eax
8049bb4: 8b 40 08 mov 0x8(%eax),%eax
8049bb7: 8b 00 mov (%eax),%eax
8049bb9: 39 c2 cmp %eax,%edx
8049bbb: 7e 0c jle 8049bc9 0x163>
8049bbd: e8 56 05 00 00 call 804a118
8049bc2: b8 00 00 00 00 mov $0x0,%eax
8049bc7: eb 18 jmp 8049be1 0x17b>
8049bc9: 8b 45 ac mov -0x54(%ebp),%eax
8049bcc: 8b 40 08 mov 0x8(%eax),%eax
8049bcf: 89 45 ac mov %eax,-0x54(%ebp)
8049bd2: 83 45 b0 01 addl $0x1,-0x50(%ebp)
8049bd6: 83 7d b0 05 cmpl $0x5,-0x50(%ebp)
8049bda: 7e d0 jle 8049bac 0x146>
8049bdc: b8 01 00 00 00 mov $0x1,%eax
8049be1: 8b 4d f4 mov -0xc(%ebp),%ecx
8049be4: 65 33 0d 14 00 00 00 xor %gs:0x14,%ecx
8049beb: 74 05 je 8049bf2 0x18c>
8049bed: e8 9e f5 ff ff call 8049190 <__stack_chk_fail@plt>
8049bf2: c9 leave
8049bf3: c3 ret
希望能告知答案以及思路,十分感谢!
反汇编出的代码很多地方看起来较难理解,还是看原始代码方便