rab Posted October 18, 2006 Share Posted October 18, 2006 [code]section .data _execve equ 59 _passwd db 'hi', 0x00 _passwdlen equ $-_passwd _wrong db 'WRONG',10,0 _wronglen equ $-_wrong _right db 'RIGHT!!!',10,0 _rightlen equ $-_right _write equ 4 _stdout equ 1 _exit equ 1section .text global _start_start: pop eax pop ebx pop ebx cmp eax, 2 jne _die mov eax, 0 jmp _checkpasswdstart_checkpasswdstart: cmp ebx[eax], _passwd[eax] jne _wrongpasswd cmp eax, _passwdlen je _winner inc eax jmp _checkpasswdstart _wrongpasswd: mov eax, _write mov ebx, _stdout mov ecx, _wrong mov edx, _wronglen int 0x80 jmp _die_winner: mov eax, _write mov ebx, _stdout mov ecx, _right mov edx, _rightlen int 0x80 jmp _die_die: mov eax, _exit xor ebx, ebx int 0x80[/code]I've tried google, but found nothing on what im trying to do. I want to compare byte by byte to see if the passwords are right. I'm just starting out on ASM so constructive criticism and useful pointers will be much appriciated. Quote Link to comment https://forums.phpfreaks.com/topic/24289-x86-asm-cmp-strings-help/ Share on other sites More sharing options...
heckenschutze Posted October 25, 2006 Share Posted October 25, 2006 Perhaps compare each byte of the string, using a loop (with an conditional jmp)... If the byte matches the byte of the password...Basically go through each byte of the password checking if it matches... Rather than trying to compar strings.. Quote Link to comment https://forums.phpfreaks.com/topic/24289-x86-asm-cmp-strings-help/#findComment-114037 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.