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
| section .data c db 74, 69, 67, 79, 71, 89, 99, 113, 111, 125, 107, 81, 125, 107, 79, 82, 18, 80, 86, 22, 76, 86, 125, 22, 125, 112, 71, 84, 17, 80, 81, 17, 95, 34 flag db 33 dup(0) format db "plz input your flag: ", 0 success db "Congratulations!", 0 failure db "Sry, plz try again", 0
section .text global _start
_start: ; Print prompt mov eax, 4 mov ebx, 1 mov ecx, format mov edx, 20 int 0x80
; Read user input mov eax, 3 mov ebx, 0 mov ecx, flag mov edx, 33 int 0x80
; Check flag xor esi, esi check_flag: mov al, byte [flag + esi] xor al, 0x22 cmp al, byte [c + esi] jne failure_check
inc esi cmp esi, 33 jne check_flag
; Print success message mov eax, 4 mov ebx, 1 mov ecx, success mov edx, 14 int 0x80
; Exit mov eax, 1 xor ebx, ebx int 0x80
failure_check: ; Print failure message mov eax, 4 mov ebx, 1 mov ecx, failure mov edx, 18 int 0x80
; Exit mov eax, 1 xor ebx, ebx int 0x80
|