Skip to content

Instantly share code, notes, and snippets.

@H4niz
Created June 5, 2018 16:17
Show Gist options
  • Save H4niz/59d8fa94c1f19960c20fe3f0f311d29f to your computer and use it in GitHub Desktop.
Save H4niz/59d8fa94c1f19960c20fe3f0f311d29f to your computer and use it in GitHub Desktop.
.text:08048BD3 handler proc near ; CODE XREF: main+4A↓p
.text:08048BD3
.text:08048BD3 iVar = dword ptr -28h
.text:08048BD3 nptr = byte ptr -22h
.text:08048BD3 var_C = dword ptr -0Ch
.text:08048BD3
.text:08048BD3 ; __unwind {
.text:08048BD3 push ebp
.text:08048BD4 mov ebp, esp
.text:08048BD6 sub esp, 38h
.text:08048BD9 mov eax, large gs:14h
.text:08048BDF mov [ebp+var_C], eax
.text:08048BE2 xor eax, eax
.text:08048BE4
.text:08048BE4 loc_8048BE4: ; CODE XREF: handler:loc_8048C63↓j
.text:08048BE4 mov dword ptr [esp], offset asc_804904B ; "> "
.text:08048BEB call _printf
.text:08048BF0 mov eax, ds:stdout@@GLIBC_2_0
.text:08048BF5 mov [esp], eax ; stream
.text:08048BF8 call _fflush
.text:08048BFD mov dword ptr [esp+4], 15h ; nbytes
.text:08048C05 lea eax, [ebp+nptr]
.text:08048C08 mov [esp], eax ; buf
.text:08048C0B call my_read
.text:08048C10 lea eax, [ebp+nptr]
.text:08048C13 mov [esp], eax ; nptr
.text:08048C16 call _atoi
.text:08048C1B mov [ebp+iVar], eax
.text:08048C1E cmp [ebp+iVar], 6 ; switch 7 cases
.text:08048C22 ja short loc_8048C56 ; jumptable 08048C31 default case
.text:08048C24 mov eax, [ebp+iVar]
.text:08048C27 shl eax, 2
.text:08048C2A add eax, 8049088h
.text:08048C2F mov eax, [eax]
.text:08048C31 jmp eax ; switch jump
.text:08048C33 ; ---------------------------------------------------------------------------
.text:08048C33
.text:08048C33 loc_8048C33: ; CODE XREF: handler+5E↑j
.text:08048C33 ; DATA XREF: .rodata:08049088↓o
.text:08048C33 call list ; jumptable 08048C31 case 1
.text:08048C38 jmp short loc_8048C63
.text:08048C3A ; ---------------------------------------------------------------------------
.text:08048C3A
.text:08048C3A loc_8048C3A: ; CODE XREF: handler+5E↑j
.text:08048C3A ; DATA XREF: .rodata:08049088↓o
.text:08048C3A call add ; jumptable 08048C31 case 2
.text:08048C3F jmp short loc_8048C63
.text:08048C41 ; ---------------------------------------------------------------------------
.text:08048C41
.text:08048C41 loc_8048C41: ; CODE XREF: handler+5E↑j
.text:08048C41 ; DATA XREF: .rodata:08049088↓o
.text:08048C41 call delete ; jumptable 08048C31 case 3
.text:08048C46 jmp short loc_8048C63
.text:08048C48 ; ---------------------------------------------------------------------------
.text:08048C48
.text:08048C48 loc_8048C48: ; CODE XREF: handler+5E↑j
.text:08048C48 ; DATA XREF: .rodata:08049088↓o
.text:08048C48 call cart ; jumptable 08048C31 case 4
.text:08048C4D jmp short loc_8048C63
.text:08048C4F ; ---------------------------------------------------------------------------
.text:08048C4F
.text:08048C4F loc_8048C4F: ; CODE XREF: handler+5E↑j
.text:08048C4F ; DATA XREF: .rodata:08049088↓o
.text:08048C4F call checkout ; jumptable 08048C31 case 5
.text:08048C54 jmp short loc_8048C63
.text:08048C56 ; ---------------------------------------------------------------------------
.text:08048C56
.text:08048C56 loc_8048C56: ; CODE XREF: handler+4F↑j
.text:08048C56 ; handler+5E↑j
.text:08048C56 ; DATA XREF: ...
.text:08048C56 mov dword ptr [esp], offset aItSNotAChoiceI ; jumptable 08048C31 default case
.text:08048C5D call _puts
.text:08048C62 nop
.text:08048C63
.text:08048C63 loc_8048C63: ; CODE XREF: handler+65↑j
.text:08048C63 ; handler+6C↑j ...
.text:08048C63 jmp loc_8048BE4
.text:08048C68 ; ---------------------------------------------------------------------------
.text:08048C68
.text:08048C68 loc_8048C68: ; CODE XREF: handler+5E↑j
.text:08048C68 ; DATA XREF: .rodata:08049088↓o
.text:08048C68 nop ; jumptable 08048C31 case 6
.text:08048C69 mov dword ptr [esp], offset aThankYouForYou ; "Thank You for Your Purchase!"
.text:08048C70 call _puts
.text:08048C75 mov eax, [ebp+var_C]
.text:08048C78 xor eax, large gs:14h
.text:08048C7F jz short locret_8048C86
.text:08048C81 call ___stack_chk_fail
.text:08048C86 ; ---------------------------------------------------------------------------
.text:08048C86
.text:08048C86 locret_8048C86: ; CODE XREF: handler+AC↑j
.text:08048C86 leave
.text:08048C87 retn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment