0%

二进制炸弹 phase_6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
08048b71 <phase_6>:
8048b71: 55 push %ebp
8048b72: 89 e5 mov %esp,%ebp
8048b74: 56 push %esi
8048b75: 53 push %ebx
8048b76: 83 ec 48 sub $0x48,%esp
8048b79: 65 a1 14 00 00 00 mov %gs:0x14,%eax
8048b7f: 89 45 f4 mov %eax,-0xc(%ebp)
8048b82: 31 c0 xor %eax,%eax
8048b84: 8d 45 c4 lea -0x3c(%ebp),%eax
8048b87: 50 push %eax
8048b88: ff 75 08 pushl 0x8(%ebp)
8048b8b: e8 5b 03 00 00 call 8048eeb <read_six_numbers>
8048b90: 83 c4 10 add $0x10,%esp
8048b93: be 00 00 00 00 mov $0x0,%esi

#read_six_numbers函数读取六个整数



#for(i=0;i<6;++i) #处理a[i]

8048b98: 8b 44 b5 c4 mov -0x3c(%ebp,%esi,4),%eax
8048b9c: 83 e8 01 sub $0x1,%eax
8048b9f: 83 f8 05 cmp $0x5,%eax #每个数都小于六
8048ba2: 76 05 jbe 8048ba9 <phase_6+0x38>
8048ba4: e8 1a 03 00 00 call 8048ec3 <explode_bomb>

8048ba9: 83 c6 01 add $0x1,%esi #外循环
8048bac: 83 fe 06 cmp $0x6,%esi
8048baf: 74 1b je 8048bcc <phase_6+0x5b>
8048bb1: 89 f3 mov %esi,%ebx


8048bb3: 8b 44 9d c4 mov -0x3c(%ebp,%ebx,4),%eax
8048bb7: 39 44 b5 c0 cmp %eax,-0x40(%ebp,%esi,4) #六个数无重复
8048bbb: 75 05 jne 8048bc2 <phase_6+0x51>
8048bbd: e8 01 03 00 00 call 8048ec3 <explode_bomb>

8048bc2: 83 c3 01 add $0x1,%ebx
8048bc5: 83 fb 05 cmp $0x5,%ebx
8048bc8: 7e e9 jle 8048bb3 <phase_6+0x42> #内循环
8048bca: eb cc jmp 8048b98 <phase_6+0x27>


#循环结束


8048bcc: 8d 45 c4 lea -0x3c(%ebp),%eax
8048bcf: 8d 5d dc lea -0x24(%ebp),%ebx #取址
8048bd2: b9 07 00 00 00 mov $0x7,%ecx

8048bd7: 89 ca mov %ecx,%edx
8048bd9: 2b 10 sub (%eax),%edx
8048bdb: 89 10 mov %edx,(%eax)
8048bdd: 83 c0 04 add $0x4,%eax
8048be0: 39 c3 cmp %eax,%ebx
8048be2: 75 f3 jne 8048bd7 <phase_6+0x66> #循环实现a[i]=7-a[i];

8048be4: bb 00 00 00 00 mov $0x0,%ebx #ebx为偏移量
8048be9: eb 16 jmp 8048c01 <phase_6+0x90>

8048beb: 8b 52 08 mov 0x8(%edx),%edx
8048bee: 83 c0 01 add $0x1,%eax
8048bf1: 39 c8 cmp %ecx,%eax
8048bf3: 75 f6 jne 8048beb <phase_6+0x7a>
8048bf5: 89 54 b5 dc mov %edx,-0x24(%ebp,%esi,4)
8048bf9: 83 c3 01 add $0x1,%ebx
8048bfc: 83 fb 06 cmp $0x6,%ebx
8048bff: 74 17 je 8048c18 <phase_6+0xa7>


8048c01: 89 de mov %ebx,%esi
8048c03: 8b 4c 9d c4 mov -0x3c(%ebp,%ebx,4),%ecx
8048c07: b8 01 00 00 00 mov $0x1,%eax
8048c0c: ba 34 b1 04 08 mov $0x804b134,%edx

#ecx=a[i]使用edx= *(edx+ 8) 构造value指针,edx初始地址为0x804b134

#依次加8,获取下一结点地址,输出各个数:109、302、870、275、602、109

8048c11: 83 f9 01 cmp $0x1,%ecx #循环
8048c14: 7f d5 jg 8048beb <phase_6+0x7a>
8048c16: eb dd jmp 8048bf5 <phase_6+0x84>

#构造链表,比较相邻元素

8048c18: 8b 5d dc mov -0x24(%ebp),%ebx
8048c1b: 8d 45 dc lea -0x24(%ebp),%eax
8048c1e: 8d 75 f0 lea -0x10(%ebp),%esi
8048c21: 89 d9 mov %ebx,%ecx

8048c23: 8b 50 04 mov 0x4(%eax),%edx
8048c26: 89 51 08 mov %edx,0x8(%ecx)
8048c29: 83 c0 04 add $0x4,%eax
8048c2c: 89 d1 mov %edx,%ecx
8048c2e: 39 c6 cmp %eax,%esi
8048c30: 75 f1 jne 8048c23 <phase_6+0xb2>


8048c32: c7 42 08 00 00 00 00 movl $0x0,0x8(%edx)
8048c39: be 05 00 00 00 mov $0x5,%esi #esi为循环标

8048c3e: 8b 43 08 mov 0x8(%ebx),%eax
# %ebx = *(value[i] + 8) = next + i。


8048c41: 8b 00 mov (%eax),%eax
8048c43: 39 03 cmp %eax,(%ebx) #比较eax与ebx内容
8048c45: 7d 05 jge 8048c4c <phase_6+0xdb> #单调不增
8048c47: e8 77 02 00 00 call 8048ec3 <explode_bomb>
8048c4c: 8b 5b 08 mov 0x8(%ebx),%ebx
8048c4f: 83 ee 01 sub $0x1,%esi #循环比较五次
8048c52: 75 ea jne 8048c3e <phase_6+0xcd>

8048c54: 8b 45 f4 mov -0xc(%ebp),%eax
8048c57: 65 33 05 14 00 00 00 xor %gs:0x14,%eax
8048c5e: 74 05 je 8048c65 <phase_6+0xf4>
8048c60: e8 7b f9 ff ff call 80485e0 <__stack_chk_fail@plt>
8048c65: 8d 65 f8 lea -0x8(%ebp),%esp
8048c68: 5b pop %ebx
8048c69: 5e pop %esi
8048c6a: 5d pop %ebp
8048c6b: c3 ret