-
Notifications
You must be signed in to change notification settings - Fork 0
/
F1nd_My_K3y5.asm
355 lines (324 loc) · 4.35 KB
/
F1nd_My_K3y5.asm
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
; ____ ______ ______ _ _
;| _ \ ___|__ / |/ /___ \| | | |
;| |_) / _ \ / /| ' / __) | | | |
;| _ < __// /_| . \ / __/| |___| |___
;|_| \_\___/____|_|\_\_____|_____|_____| , this should be assembled by NASM !
;
%macro write 2
mov eax,4
mov ebx,1
mov ecx,%1
mov edx,%2
int 0x80
%endmacro
%macro read 2
mov eax,3
xor ebx,ebx
mov ecx,%1
mov edx,%2
int 0x80
%endmacro
section .data
t1 db " ____ ______ ______ _ _ ",0xa
l1 equ $-t1
t2 db "| _ \ ___|__ / |/ /___ \| | | | ",0xa
l2 equ $-t2
t3 db "| |_) / _ \ / /| ' / __) | | | | ",0xa
l3 equ $-t3
t4 db "| _ < __// /_| . \ / __/| |___| |___ ",0xa
l4 equ $-t4
t5 db "|_| \_\___/____|_|\_\_____|_____|_____| F1nd_My_K3y5 #",0xa,0xa
l5 equ $-t5
t6 db "Password : ",0x0
l6 equ $-t6
nn db "No. !",0xa
ln equ $-nn
yy db "Yep , you Are correct !",0xa
ly equ $-yy
doge db "Such Flag !",0x0
ld equ $-doge
section .bss
junk resb 15
buff resb 1
flag resb 14
section .text
global _start
_start:
write t1,l1
write t2,l2
write t3,l3
write t4,l4
write t5,l5
write t6,l6
read junk,14
cmp eax,8
jl NO
mov edx,flag
push junk
xor ecx,ecx
call init
add ecx,eax
call jnit
add ecx,eax
call knit
add ecx,eax
call lnit
add ecx,eax
call mnit
add ecx,eax
call nnit
add ecx,eax
call onit
add ecx,eax
call pnit
add ecx,eax
call qnit
add ecx,eax
call anit
add ecx,eax
call bnit
add ecx,eax
call cnit
add ecx,eax
call dnit
add ecx,eax
sub ecx,0x40
mov byte [edx],0x0
mov edx,flag
mov byte [flag+0xa],0x4f
mov byte [flag+0xc],0x30
call bajbouj
cmp ecx,0x3da
jne NO
add ecx,0x40
sub ecx,eax
cmp ecx,0x3ef
jne NO
cmp ecx,0x4F
jg Yep
NO:
write nn,ln
jmp check_password
Yep:
write yy,ly
jmp check_password
check_password:
read buff,1
cmp byte [buff],0xa
jne check_password
mov eax,1
xor ebx,ebx
int 0x80
init:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,4
xor eax,eax
mov al,byte [ebx]
cmp al,0x66
je init+9
add al,6
xor al,5
mov byte [edx],al
inc edx
ret
jnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
mov al,byte [ebx]
cmp al,0x6c
je jnit+22
add al,9
xor al,7
mov byte [edx],al
inc edx
ret
add ebx,3
jmp jnit+7
knit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,2
mov al,byte [ebx]
cmp al,0x61
je knit+8
add al,7
xor al,3
mov byte [edx],al
inc edx
ret
lnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,6
mov al,byte [ebx]
cmp al,0x67
je lnit+7
add al,5
xor al,8
mov byte [edx],al
inc edx
ret
mnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,5
mov al,byte [ebx]
cmp al,0x69
je mnit+7
add al,0x10
xor al,0x45
mov byte [edx],al
inc edx
ret
bajbouj:
xor ebx,ebx
xor esi,esi
mov bl, byte [edx+esi]
sub bl, byte [junk+esi]
mov byte [edx+esi],bl
inc esi
cmp byte [edx+esi],0x0
jne bajbouj+4
call marzou9i
ret
nnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,1
mov al,byte [ebx]
cmp al,0x53
je mnit+7
add al,0x11
xor al,7
mov byte [edx],al
inc edx
ret
onit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,3
mov al,byte [ebx]
cmp al,0x4e
je onit+7
add al,0x4
xor al,2
mov byte [edx],al
inc edx
ret
pnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,9
mov al,byte [ebx]
cmp al,0x4f
je pnit+7
add al,1
xor al,8
mov byte [edx],al
inc edx
ret
marzou9i:
xor ebx,ebx
call again
ret
qnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,8
mov al,byte [ebx]
cmp al,0x30
je qnit+7
jmp knit+17
again:
dec esi
mov bl, byte [edx+esi]
shl bl,2
mov byte [edx+esi],bl
cmp esi,0x0
jne again
ret
anit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,0xa
mov al,byte [ebx]
cmp al,0x50
je anit+7
jmp knit+17
bnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,0x7
mov al,byte [ebx]
cmp al,0x50
je bnit+7
jmp knit+17
cnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,0xb
mov al,byte [ebx]
cmp al,0x45
je cnit+7
jmp knit+17
dnit:
pop esi
mov ebx,esi
pop esi
push esi
push ebx
mov ebx,esi
add ebx,0xc
mov al,byte [ebx]
cmp al,0x53
je dnit+7
jmp knit+17