Skip to content

Instantly share code, notes, and snippets.

@potetisensei
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potetisensei/6ea3d4c4158fb6809436 to your computer and use it in GitHub Desktop.
Save potetisensei/6ea3d4c4158fb6809436 to your computer and use it in GitHub Desktop.
sub_8049230
.text:08049230 sub_8049230 proc near ; DATA XREF: .data:0804C270o
.text:08049230
.text:08049230 dest = dword ptr -4Ch
.text:08049230 src = dword ptr -48h
.text:08049230 n = dword ptr -44h
.text:08049230 var_40 = dword ptr -40h
.text:08049230 s2 = byte ptr -34h
.text:08049230 var_14 = dword ptr -14h
.text:08049230 var_10 = dword ptr -10h
.text:08049230 arg_0 = dword ptr 4
.text:08049230
.text:08049230 push esi
.text:08049231 push ebx
.text:08049232 sub esp, 44h
.text:08049235 mov esi, [esp+4Ch+arg_0]
.text:08049239 mov eax, large gs:14h
.text:0804923F mov [esp+3Ch], eax
.text:08049243 xor eax, eax
.text:08049245 mov eax, [esi]
.text:08049247 test eax, eax
.text:08049249 jz loc_80492D8
.text:0804924F lea ebx, [esp+4Ch+s2]
.text:08049253 mov [esp+4Ch+n], 20h ; n
.text:0804925B mov [esp+4Ch+src], eax ; src
.text:0804925F mov [esp+4Ch+dest], ebx ; dest
.text:08049262 call _strncpy
.text:08049267
.text:08049267 loc_8049267: ; CODE XREF: sub_8049230+EDj
.text:08049267 mov [esp+4Ch+src], ebx ; s2
.text:0804926B mov [esp+4Ch+dest], offset dword_804C3A0 ; s1
.text:08049272 call _strcmp
.text:08049277 mov [esp+4Ch+var_14], eax
.text:0804927B mov eax, [esp+4Ch+var_14]
.text:0804927F test eax, eax
.text:08049281 jz short loc_80492B8
.text:08049283 mov [esp+4Ch+n], ebx
.text:08049287 mov [esp+4Ch+src], offset aNope_ThePasswo ; "Nope. The password isn't %s\n"
.text:0804928F mov [esp+4Ch+dest], 1
.text:08049296 call ___printf_chk
.text:0804929B
.text:0804929B loc_804929B: ; CODE XREF: sub_8049230+A5j
.text:0804929B mov [esp+4Ch+dest], esi
.text:0804929E call sub_8049090 ; Freeing up of argv
.text:080492A3 mov eax, [esp+4Ch+var_10]
.text:080492A7 xor eax, large gs:14h
.text:080492AE jnz short loc_8049322
.text:080492B0 add esp, 44h
.text:080492B3 pop ebx
.text:080492B4 pop esi
.text:080492B5 retn
.text:080492B5 ; ---------------------------------------------------------------------------
.text:080492B6 align 4
.text:080492B8
.text:080492B8 loc_80492B8: ; CODE XREF: sub_8049230+51j
.text:080492B8 mov [esp+4Ch+dest], offset aAuthentication ; "Authentication Successful"
.text:080492BF mov ds:dword_804C3C0, 1
.text:080492C9 mov ds:byte_804C380, 23h
.text:080492D0 call _puts
.text:080492D5 jmp short loc_804929B
.text:080492D5 ; ---------------------------------------------------------------------------
.text:080492D7 align 4
.text:080492D8
.text:080492D8 loc_80492D8: ; CODE XREF: sub_8049230+19j
.text:080492D8 mov [esp+4Ch+src], offset aPleaseEnterAPa ; "Please enter a password: "
.text:080492E0 lea ebx, [esp+18h]
.text:080492E4 mov [esp+4Ch+dest], 1
.text:080492EB call ___printf_chk
.text:080492F0 mov eax, ds:stdout
.text:080492F5 mov [esp+4Ch+dest], eax ; stream
.text:080492F8 call _fflush
.text:080492FD mov [esp+4Ch+var_40], 0Ah
.text:08049305 mov [esp+4Ch+n], 20h
.text:0804930D mov [esp+4Ch+src], ebx
.text:08049311 mov [esp+4Ch+dest], 0
.text:08049318 call sub_8048C30 ; reading string from stdin
.text:0804931D jmp loc_8049267
.text:08049322 ; ---------------------------------------------------------------------------
.text:08049322
.text:08049322 loc_8049322: ; CODE XREF: sub_8049230+7Ej
.text:08049322 call ___stack_chk_fail
.text:08049322 sub_8049230 endp
.text:08049322
.text:08049322 ; ---------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment