Function at 0x406582
Capabilities:
Create service
Delete registry key
Modify service
Persist via windows service
Query or enumerate registry value
Set registry value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x334
push ebx
push esi
mov dword [ebp - 0x24], ecx
push edi
xor ebx, ebx
mov ecx, 0x81
xor eax, eax
lea edi, [ebp - 0x333]
mov byte [ebp - 0x334], bl
push 0x40
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
pop ecx
xor eax, eax
lea edi, [ebp - 0x12b]
mov byte [ebp - 0x12c], bl
rep stosd dword es:[edi], eax
mov esi, dword [ebp + 0xc]
mov dword [ebp - 4], ebx
stosw word es:[edi], ax
cmp esi, ebx
mov dword [ebp - 0x14], ebx
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0x1c], ebx
stosb byte es:[edi], al
mov dword [ebp - 0xc], ebx
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0x28], ebx
mov dword [ebp - 8], ebx
je 0x406612
push esi
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
je 0x406612
push esi
call sub.MSVCRT.dll_strlen
add eax, 4
push eax
call sub.MFC42.DLL_operatornew
pop ecx
mov dword [ebp - 0x14], eax
pop ecx
push esi
push str._s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
mov esi, dword [ebp + 8]
mov edi, 0xf003f
push edi
push ebx
mov eax, dword [esi + 8]
push dword [ebp - 0x14]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
cmp eax, ebx
mov dword [ebp + 8], eax
je 0x4068cf
cmp dword [ebp + 0x10], ebx
je 0x4067be
push dword [ebp + 0x10]
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
je 0x4067be
lea eax, [ebp - 0xc]
push eax
push edi
push ebx
push str.SOFTWAREMicrosoftWindows_NTCurrentVersionSvcHost
push closesocket
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
cmp eax, ebx
mov dword [ebp - 4], eax
jne 0x4069c0
lea eax, [ebp - 8]
mov edi, dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
push eax
lea eax, [ebp - 0x28]
push ebx
push eax
push ebx
push dword [ebp + 0x10]
push dword [ebp - 0xc]
call edi
test eax, eax
jne 0x40674c
push 1
pop eax
cmp dword [ebp - 8], eax
ja 0x40669c
mov dword [ebp - 8], eax
push dword [esi]
call sub.MSVCRT.dll_strlen
mov ecx, dword [ebp - 8]
lea eax, [ecx + eax + 1]
push eax
mov dword [ebp - 8], eax
call sub.MFC42.DLL_operatornew
push dword [ebp - 8]
mov dword [ebp + 0xc], eax
push ebx
push eax
call sub.MSVCRT.dll_memset
add esp, 0x14
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0x28]
push dword [ebp + 0xc]
push eax
push ebx
push dword [ebp + 0x10]
push dword [ebp - 0xc]
call edi
mov edi, dword [ebp + 0xc]
mov dword [ebp - 4], eax
push edi
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
je 0x40670a
push dword [esi]
push edi
call dword [sym.imp.MSVCRT.dll__mbscmp]
pop ecx
test eax, eax
pop ecx
je 0x40670a
push edi
call sub.MSVCRT.dll_strlen
lea edi, [edi + eax + 1]
push edi
call sub.MSVCRT.dll_strlen
pop ecx
jmp 0x4066e3
push edi
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
jne 0x406747
push dword [esi]
push edi
call sub.MSVCRT.dll_strcpy
push edi
call sub.MSVCRT.dll_strlen
mov ecx, dword [ebp - 8]
add esp, 0xc
lea eax, [ecx + eax + 1]
push eax
mov dword [ebp - 8], eax
push dword [ebp + 0xc]
push dword [ebp - 0x28]
push ebx
push dword [ebp + 0x10]
push dword [ebp - 0xc]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
mov dword [ebp - 4], eax
push dword [ebp + 0xc]
jmp 0x40678c
push dword [esi]
call sub.MSVCRT.dll_strlen
inc eax
inc eax
push eax
mov dword [ebp - 8], eax
call sub.MFC42.DLL_operatornew
push dword [ebp - 8]
mov edi, eax
push ebx
push edi
call sub.MSVCRT.dll_memset
push dword [esi]
push edi
call sub.MSVCRT.dll_strcpy
add esp, 0x1c
push dword [ebp - 8]
push edi
push 7
push ebx
push dword [ebp + 0x10]
push dword [ebp - 0xc]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
mov dword [ebp - 4], eax
push edi
call sub.MFC42.DLL_operatordelete
pop ecx
push dword [ebp - 0xc]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
cmp dword [ebp - 4], ebx
jne 0x4069c0
push dword [ebp + 0x10]
lea eax, [ebp - 0x334]
push str.__SystemRoot__System32_svchost.exe__k__s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
jmp 0x406817
lea eax, [ebp - 0x334]
mov ecx, dword [ebp - 0x24]
push ebx
push eax
lea eax, [ebp - 0x12c]
push eax
push dword [esi]
call fcn.00406d91
lea eax, [ebp - 0x12c]
push eax
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
jbe 0x406806
mov ecx, dword [ebp - 0x24]
push 1
push ebx
push dword [ebp + 0xc]
push dword [esi]
call fcn.00407180
mov ecx, dword [ebp - 0x24]
push ebx
push dword [ebp + 0xc]
push dword [esi]
call fcn.00406b41
push dword [esi + 0x18]
lea eax, [ebp - 0x334]
push eax
call sub.MSVCRT.dll_strcpy
pop ecx
pop ecx
push dword [esi + 0x28]
lea eax, [ebp - 0x334]
mov edi, 0xf01ff
push dword [esi + 0x24]
push dword [esi + 0x20]
push ebx
push dword [esi + 0x1c]
push eax
push dword [esi + 0x14]
push dword [esi + 0x10]
push dword [esi + 0xc]
push edi
push dword [esi + 4]
push dword [esi]
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_CreateServiceA]
cmp eax, ebx
mov dword [ebp - 0x10], eax
jne 0x4068b7
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x431
mov dword [ebp - 4], eax
jne 0x4068a9
push edi
mov dword [ebp - 4], ebx
push dword [esi]
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_OpenServiceA]
cmp eax, ebx
mov dword [ebp - 0x10], eax
je 0x4068a0
push dword [esi + 4]
lea ecx, [ebp - 0x334]
push dword [esi + 0x28]
push dword [esi + 0x24]
push dword [esi + 0x20]
push ebx
push dword [esi + 0x1c]
push ecx
push dword [esi + 0x14]
push dword [esi + 0x10]
push dword [esi + 0xc]
push eax
call dword [sym.imp.ADVAPI32.dll_ChangeServiceConfigA]
test eax, eax
jne 0x4068a9
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
cmp dword [ebp - 0x10], ebx
je 0x4069a4
cmp dword [ebp - 4], ebx
jne 0x4068d8
cmp dword [ebp - 0x1c], ebx
je 0x4068d8
lea eax, [ebp - 0x1c]
push eax
push 1
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_ChangeServiceConfig2A]
test eax, eax
jne 0x4068d8
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
cmp dword [ebp - 0x10], ebx
je 0x4069a4
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push dword [esi]
call sub.MSVCRT.dll_strlen
add eax, 0x104
push eax
call sub.MFC42.DLL_operatornew
pop ecx
mov edi, eax
pop ecx
push dword [esi]
push str.SYSTEMCurrentControlSetServices_s
push edi
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [ebp - 0x18]
push eax
push 0xf003f
push ebx
push edi
push closesocket
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
cmp eax, ebx
mov dword [ebp - 4], eax
jne 0x40699d
cmp dword [ebp + 0x10], ebx
je 0x406986
push dword [ebp + 0x10]
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
je 0x406986
lea eax, [ebp - 0x20]
push eax
push str.Parameters
push dword [ebp - 0x18]
call dword [sym.imp.ADVAPI32.dll_RegCreateKeyA]
cmp eax, ebx
mov dword [ebp - 4], eax
jne 0x406994
push dword [esi + 0x18]
call sub.MSVCRT.dll_strlen
pop ecx
inc eax
push eax
push dword [esi + 0x18]
push 2
push ebx
push str.ServiceDll
push dword [ebp - 0x20]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
push dword [ebp - 0x20]
mov dword [ebp - 4], eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
jmp 0x406994
push str.Parameters
push dword [ebp - 0x18]
call dword [sym.imp.ADVAPI32.dll_RegDeleteKeyA]
push dword [ebp - 0x18]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
push edi
call sub.MFC42.DLL_operatordelete
pop ecx
cmp dword [ebp + 8], ebx
je 0x4069b2
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
cmp dword [ebp - 0x14], ebx
je 0x4069c0
push dword [ebp - 0x14]
call sub.MFC42.DLL_operatordelete
pop ecx
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
leave
ret 0xc