Function at 0x405680
Capabilities:
Allocate or change rwx memory
Execute shellcode via indirect call
Parse pe header

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x30c
mov eax, dword [0x41e090]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
push esi
push edi
mov ebx, ecx
xor edi, edi
push 0x150
lea ecx, [ebp - 0x2c8]
push edi
push ecx
mov dword [ebp - 0x2fc], ebx
mov dword [ebp - 0x2f8], eax
mov dword [ebp - 0x2d8], edi
call fcn.004128c0
add esp, 0xc
mov ecx, ebx
mov dword [ebp - 0x2c8], 0x150
call fcn.004054a0
push 0x40
lea edx, [ebp - 0x80]
mov esi, eax
push edi
push edx
mov dword [ebp - 0x2e8], esi
call fcn.004128c0
add esp, 0xc
push edi
push 0x40
lea eax, [ebp - 0x80]
push eax
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
test eax, eax
jne 0x405726
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ReadProcessMemory_idh__failed:__d_n
call fcn.00404e00
add esp, 8
mov eax, edi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040b5e7
mov esp, ebp
pop ebp
ret
mov ecx, 0x10
lea esi, [ebp - 0x80]
lea edi, [ebp - 0x2b4]
rep movsd dword es:[edi], dword [esi]
mov esi, dword [ebp - 0x2e8]
mov ecx, 0x5a4d
mov dword [ebp - 0x2c4], esi
cmp word [ebp - 0x80], cx
jne 0x406043
push 0xf8
lea edx, [ebp - 0x178]
push 0
push edx
call fcn.004128c0
mov ecx, dword [ebp - 0x44]
add esp, 0xc
push 0
push 0xf8
lea eax, [ebp - 0x178]
push eax
add ecx, esi
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
test eax, eax
jne 0x4057b1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ReadProcessMemory_inh__failed:__d_n
call fcn.00404e00
mov eax, dword [ebp - 0x2d8]
add esp, 8
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040b5e7
mov esp, ebp
pop ebp
ret
cmp dword [ebp - 0x178], 0x4550
mov eax, dword [ebp - 0x44]
mov ecx, 0x3e
lea esi, [ebp - 0x178]
lea edi, [ebp - 0x274]
rep movsd dword es:[edi], dword [esi]
mov edi, dword [ebp - 0x2e8]
lea edx, [eax + edi]
mov dword [ebp - 0x2c0], edx
jne 0x406043
xor esi, esi
cmp dword [ebp - 0xf8], esi
jne 0x405810
push str.No_IMAGE_DIRECTORY_ENTRY_IMPORT_n
call fcn.00404e00
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040b5e7
mov esp, ebp
pop ebp
ret
movzx ecx, word [ebp - 0x164]
xor edx, edx
mov dword [ebp - 0xa8], esi
mov dword [ebp - 0xa4], esi
mov dword [ebp - 0x2ec], esi
lea eax, [ecx + eax + 0x18]
mov dword [ebp - 0x2cc], esi
cmp dx, word [ebp - 0x172]
jae 0x405903
add eax, edi
mov dword [ebp - 0x2d4], eax
mov ecx, dword [ebp - 0x2d4]
xor eax, eax
push eax
push 0x28
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x24], eax
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x10], eax
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], eax
lea eax, [ebp - 0x2c]
push eax
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
test eax, eax
je 0x405786
mov edx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x2cc]
push edx
push eax
push ecx
push str.ish__d__:_va_p_sr_d_n
call fcn.00404e00
mov eax, dword [ebp - 0x1c]
add esp, 0x10
cmp dword [ebp - 0xa0], 0
jne 0x4058d1
mov ecx, dword [ebp - 0x20]
cmp dword [ebp - 0xf8], ecx
jb 0x4058d1
lea edx, [ecx + eax]
cmp dword [ebp - 0xf8], edx
jae 0x4058d1
mov dword [ebp - 0xa0], ecx
mov dword [ebp - 0x9c], eax
add eax, dword [ebp - 0x18]
cmp esi, eax
jae 0x4058e0
mov dword [ebp - 0x2ec], eax
mov esi, eax
mov eax, dword [ebp - 0x2cc]
movzx edx, word [ebp - 0x172]
add dword [ebp - 0x2d4], 0x28
inc eax
mov dword [ebp - 0x2cc], eax
cmp eax, edx
jb 0x40584a
push esi
push str.dwFileSize___08x_n
call fcn.00404e00
lea eax, [ebp - 0x178]
push eax
push edi
mov eax, ebx
call fcn.00405270
movzx eax, ax
mov dword [ebp - 0x300], eax
movzx eax, ax
lea ecx, [eax + esi]
push ecx
push esi
push eax
push str.ChkSum:__04x___08x____08x_n
mov dword [ebp - 0x304], eax
mov dword [ebp - 0x308], ecx
call fcn.00404e00
mov eax, dword [ebp - 0xf8]
mov ecx, dword [ebp - 0xf4]
add ecx, eax
add ecx, edi
push ecx
add eax, edi
push eax
push str._____Imports:__8p.._8p_n
call fcn.00404e00
mov edi, dword [ebp + 0xc]
mov edx, dword [ebp - 0xf4]
lea eax, [edi + edi*4]
add eax, eax
add eax, eax
mov dword [ebp - 0x2e4], eax
lea eax, [eax + edx + 7]
and eax, 0xfffffff8
mov esi, edi
shl esi, 4
add esi, eax
add esp, 0x2c
xor ecx, ecx
mov dword [ebp - 0x2f4], eax
mov dword [ebp - 0x2dc], esi
test edi, edi
je 0x4059d0
lea esp, [esp]
mov eax, dword [ebp - 0x2f8]
mov eax, dword [eax + ecx*4]
lea edx, [eax + 1]
mov dword [ebp - 0x2f0], edx
mov dl, byte [eax]
inc eax
test dl, dl
jne 0x4059b2
sub eax, dword [ebp - 0x2f0]
inc ecx
add eax, 4
and eax, 0xfffffffc
add dword [ebp - 0x2dc], eax
cmp ecx, edi
jb 0x4059a0
mov eax, dword [ebp - 0x2dc]
push eax
call fcn.0040b4ff
add esp, 4
mov dword [ebp - 0x2e0], eax
test eax, eax
jne 0x4059f8
push str.new_BYTE__cbNew__failed._n
call fcn.00404e00
jmp 0x406040
mov ecx, dword [ebp - 0x2dc]
push ecx
push 0
push eax
call fcn.004128c0
mov eax, dword [ebp - 0x154]
add eax, dword [ebp - 0x158]
mov edi, dword [ebp - 0x2e8]
add eax, dword [ebp - 0x15c]
add esp, 0xc
add eax, dword [ebp - 0x14c]
add eax, edi
cmp edi, eax
jae 0x405a30
mov edi, eax
push edi
push str.pbBase___p_n
call fcn.00404e00
mov ecx, dword [ebp - 0x2dc]
push ecx
mov eax, edi
call fcn.00405360
xor ecx, ecx
add esp, 0xc
mov dword [ebp - 0x2f0], eax
cmp eax, ecx
jne 0x405a6a
push str.FindAndAllocateNearBase_failed._n
call fcn.00404e00
add esp, 4
jmp 0x406034
mov eax, dword [ebp - 0xf4]
mov edi, dword [ebp - 0x2e8]
lea edx, [ebp - 0x2d0]
push edx
mov dword [ebp - 0x2d0], ecx
mov dword [ebp - 0x2b8], ecx
mov ecx, dword [ebp - 0xf8]
push 0x40
push eax
add ecx, edi
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualProtectEx]
test eax, eax
jne 0x405ab9
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.VirtualProtextEx_import__write_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov edx, dword [ebp - 0x2d0]
push edx
push str.IMPORT_DIRECTORY_perms_x_n
call fcn.00404e00
mov ecx, dword [ebp - 0xf4]
mov edx, dword [ebp - 0x2e4]
mov eax, dword [ebp - 0x2d0]
add edx, dword [ebp - 0x2e0]
add esp, 8
push 0
push ecx
mov ecx, dword [ebp - 0xf8]
mov dword [ebp - 0x2b8], eax
mov eax, dword [ebp - 0x2f0]
push edx
add ecx, edi
push ecx
sub eax, edi
push ebx
mov dword [ebp - 0x2d4], eax
call dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
test eax, eax
jne 0x405b2a
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ReadProcessMemory_imports__failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
cmp dword [ebp + 0xc], 0
mov dword [ebp - 0x2cc], 0
jbe 0x405c3c
mov eax, dword [ebp - 0x2f4]
mov edi, dword [ebp - 0x2e0]
mov edx, dword [ebp - 0x2d4]
mov ecx, dword [ebp - 0x2e0]
add edi, 4
add edx, eax
mov dword [ebp - 0x2f4], edx
lea edx, [eax + ecx + 4]
mov dword [ebp - 0x2e4], edx
mov eax, dword [ebp - 0x2dc]
mov ecx, dword [ebp - 0x2e0]
mov edx, dword [ebp - 0x2f8]
mov ebx, dword [ebp - 0x2cc]
mov edx, dword [edx + ebx*4]
sub eax, esi
add ecx, esi
call fcn.00405160
test eax, eax
js 0x405cf5
mov ecx, dword [ebp - 0x2e4]
mov edx, dword [ebp - 0x2f4]
mov dword [edi - 4], edx
mov dword [ecx], 0
mov eax, 0x80000001
mov dword [ecx - 4], eax
lea ebx, [edx + 8]
mov dword [edi + 0xc], ebx
mov ebx, dword [ebp - 0x2cc]
mov dword [ecx + 4], eax
xor eax, eax
mov dword [ecx + 8], eax
mov dword [edi], eax
mov dword [edi + 4], eax
mov eax, dword [ebp - 0x2d4]
add eax, esi
mov dword [edi + 8], eax
mov eax, dword [ebp - 0x2f8]
mov eax, dword [eax + ebx*4]
lea ebx, [eax + 1]
mov dword [ebp - 0x2e4], ebx
lea ebx, [ebx]
mov bl, byte [eax]
inc eax
test bl, bl
jne 0x405bf0
sub eax, dword [ebp - 0x2e4]
add edx, 0x10
add eax, 4
and eax, 0xfffffffc
add esi, eax
mov eax, dword [ebp - 0x2cc]
inc eax
add ecx, 0x10
add edi, 0x14
mov dword [ebp - 0x2cc], eax
mov dword [ebp - 0x2f4], edx
mov dword [ebp - 0x2e4], ecx
cmp eax, dword [ebp + 0xc]
jb 0x405b6b
mov ebx, dword [ebp - 0x2fc]
mov edi, dword [ebp - 0x2e8]
mov eax, 0xcccccccd
mul dword [ebp - 0xf4]
shr edx, 4
add edx, dword [ebp + 0xc]
mov dword [ebp - 0x2cc], 0
je 0x405cc0
mov edi, dword [ebp - 0x2e0]
add edi, 8
mov ecx, dword [edi + 8]
mov edx, dword [edi + 4]
mov eax, dword [edi]
push ecx
mov ecx, dword [edi - 4]
push edx
mov edx, dword [edi - 8]
push eax
mov eax, dword [ebp - 0x2cc]
push ecx
push edx
push eax
push str._8d._Look_08x_Time_08x_Fore_08x_Name_08x_Addr_08x_n
call fcn.00404e00
add esp, 0x1c
cmp dword [edi - 8], 0
jne 0x405c95
cmp dword [edi + 8], 0
je 0x405cba
mov ecx, dword [ebp - 0x2cc]
mov eax, 0xcccccccd
mul dword [ebp - 0xf4]
shr edx, 4
add edx, dword [ebp + 0xc]
inc ecx
add edi, 0x14
mov dword [ebp - 0x2cc], ecx
cmp ecx, edx
jb 0x405c62
mov edi, dword [ebp - 0x2e8]
mov ecx, dword [ebp - 0x2e0]
mov edx, dword [ebp - 0x2f0]
push 0
push esi
push ecx
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
test eax, eax
jne 0x405d0e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.WriteProcessMemory_iid__failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.StringCchCopyA_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov eax, dword [ebp - 0xf8]
mov ecx, dword [ebp - 0xf4]
add ecx, eax
push ecx
push eax
push str.obBase___p.._p_n
call fcn.00404e00
mov eax, dword [ebp - 0x2d4]
add esp, 0xc
lea edx, [eax + esi]
push edx
push eax
push str.obBase___p.._p_n
call fcn.00404e00
mov eax, dword [ebp - 0x2d4]
mov ecx, dword [ebp - 0x2dc]
mov dword [ebp - 0xf8], eax
mov eax, dword [ebp - 0x90]
add esp, 0xc
mov dword [ebp - 0xf4], ecx
test eax, eax
je 0x405e50
cmp dword [ebp - 0x8c], 0
je 0x405e50
push 0
push 0x14
lea edx, [ebp - 0x40]
push edx
lea esi, [eax + edi]
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
test eax, eax
jne 0x405da6
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ReadProcessMemory_clr__failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
lea ecx, [ebp - 0x2d0]
push ecx
push 4
lea eax, [esi + 0x10]
mov dword [ebp - 0x2bc], eax
mov eax, dword [ebp - 0x30]
push 0x14
mov dword [ebp - 0x17c], eax
push esi
and eax, 0xfffffffe
push ebx
mov dword [ebp - 0x30], eax
call dword [sym.imp.KERNEL32.dll_VirtualProtectEx]
test eax, eax
jne 0x405dee
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.VirtualProtextEx_clr__write_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
push 0
push 0x14
lea edx, [ebp - 0x40]
push edx
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
test eax, eax
jne 0x405e1b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.WriteProcessMemory_clr__failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov ecx, dword [ebp - 0x2d0]
lea eax, [ebp - 0x2d0]
push eax
push ecx
push 0x14
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualProtectEx]
test eax, eax
jne 0x405e50
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.VirtualProtextEx_clr__restore_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov eax, dword [ebp - 0x124]
lea edx, [ebp - 0x2d0]
push edx
push 0x40
push eax
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualProtectEx]
test eax, eax
jne 0x405e85
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.VirtualProtextEx_inh__write_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov esi, dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
xor ecx, ecx
push ecx
push 0x40
lea edx, [ebp - 0x80]
push edx
push edi
push ebx
mov word [ebp - 0x64], cx
call esi
test eax, eax
jne 0x405eb9
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.WriteProcessMemory_idh__failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov ecx, dword [ebp - 0x44]
push 0
push 0xf8
lea eax, [ebp - 0x178]
push eax
add ecx, edi
push ecx
push ebx
call esi
test eax, eax
jne 0x405eed
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.WriteProcessMemory_inh__failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
lea edx, [ebp - 0x178]
push edx
push edi
mov eax, ebx
call fcn.00405270
mov ecx, dword [ebp - 0x2ec]
movzx esi, ax
mov eax, esi
lea edx, [eax + ecx]
push edx
push ecx
push eax
push str.ChkSum:__04x___08x____08x_n
call fcn.00404e00
mov eax, dword [ebp - 0x300]
add esp, 0x18
cmp si, ax
sbb ecx, ecx
neg ecx
sub si, cx
mov cx, word [ebp - 0x64]
sub si, ax
movzx eax, si
cmp cx, ax
sbb edx, edx
push 0
neg edx
add dx, ax
push 0x40
lea eax, [ebp - 0x80]
push eax
push edi
sub cx, dx
push ebx
mov word [ebp - 0x64], cx
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
test eax, eax
je 0x405ea0
mov edx, dword [ebp - 0x2d0]
mov eax, dword [ebp - 0x124]
lea ecx, [ebp - 0x2d0]
push ecx
push edx
push eax
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualProtectEx]
test eax, eax
jne 0x405f97
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.VirtualProtextEx_idh__restore_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
lea ecx, [ebp - 0x178]
push ecx
push edi
mov eax, ebx
call fcn.00405270
mov ecx, dword [ebp - 0x2ec]
movzx edi, ax
mov esi, edi
lea eax, [esi + ecx]
push eax
push ecx
push esi
push str.ChkSum:__04x___08x____08x_n
mov dword [ebp - 0x2fc], eax
call fcn.00404e00
mov edx, dword [ebp - 0x2fc]
mov eax, dword [ebp - 0x308]
push edx
push eax
push str.Before:__08x__After:__08x_n
call fcn.00404e00
add esp, 0x24
cmp word [ebp - 0x300], di
je 0x406002
mov ecx, dword [ebp - 0x304]
push esi
push ecx
push str.Restore_of_checksum_failed__04x____04x._n
call fcn.00404e00
add esp, 0xc
jmp 0x406034
lea edx, [ebp - 0x2c8]
push edx
mov edi, ebx
call fcn.00404e70
test eax, eax
jne 0x40602a
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.DetourCopyPayloadToProcess_failed:__d_n
call fcn.00404e00
add esp, 8
jmp 0x406034
mov dword [ebp - 0x2d8], 1
mov eax, dword [ebp - 0x2e0]
push eax
call fcn.0040b5f6
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0x2d8]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0040b5e7
mov esp, ebp
pop ebp
ret