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

Disassembly:
sub esp, 0x628
mov dl, byte [0x40d874]
push ebx
push ebp
push esi
push edi
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x31]
mov byte [esp + 0x30], dl
mov byte [esp + 0x134], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x135]
xor esi, esi
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov eax, dword [esp + 0x63c]
mov dword [esp + 0x10], esi
cmp eax, esi
lea eax, [esp + 0x10]
push eax
push 0x2001f
push esi
push str.SYSTEMCurrentControlSetServicesSNMPParametersExtensionAgents_
push 0x80000002
je 0x40706b
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
jne 0x40719d
mov ebx, dword [sym.imp.ADVAPI32.dll_RegEnumValueA]
mov ebp, 0x104
xor edi, edi
mov dword [esp + 0x14], ebp
mov dword [esp + 0x18], ebp
lea ecx, [esp + 0x18]
lea edx, [esp + 0x134]
push ecx
lea eax, [esp + 0x20]
push edx
push eax
mov eax, dword [esp + 0x1c]
lea ecx, [esp + 0x20]
push 0
lea edx, [esp + 0x40]
push ecx
push edx
push esi
push eax
call ebx
test eax, eax
je 0x406e6c
cmp eax, 0xea
jne 0x406e8a
lea ecx, [esp + 0x30]
push ecx
call fcn.004078c0
add esp, 4
cmp edi, eax
jge 0x406e7f
mov edi, eax
inc esi
mov dword [esp + 0x14], ebp
mov dword [esp + 0x18], ebp
jmp 0x406e3b
inc edi
lea edx, [esp + 0x30]
push edi
push 0x40b234
push edx
call dword [sym.imp.USER32.dll_wsprintfA]
mov ecx, 0xc
mov esi, str.SOFTWAREMicrosoftMSSQLServerSNMPCurrentVersion
lea edi, [esp + 0x140]
mov edx, dword [esp + 0x1c]
rep movsd dword es:[edi], dword [esi]
add esp, 0xc
lea eax, [esp + 0x134]
movsw word es:[edi], word [esi]
push ebp
push eax
push 1
lea ecx, [esp + 0x3c]
push 0
mov dword [esp + 0x28], ebp
mov ebp, dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
push ecx
push edx
movsb byte es:[edi], byte [esi]
call ebp
mov eax, dword [esp + 0x10]
mov ebx, dword [sym.imp.ADVAPI32.dll_RegCloseKey]
push eax
call ebx
mov al, byte [0x40daf0]
test al, al
jne 0x406f42
lea ecx, [esp + 0x10]
push ecx
push 0x20019
push 0
push str.SOFTWAREMicrosoftMSSQLServer_setup
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
jne 0x406f39
lea edx, [esp + 0x20]
mov dword [esp + 0x20], 0x104
push edx
push 0x40daf0
push eax
push eax
mov eax, dword [esp + 0x20]
push str.SQLPath
push eax
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
mov ecx, dword [esp + 0x10]
push ecx
call ebx
mov al, byte [0x40daf0]
test al, al
je 0x406f9e
mov edi, 0x40daf0
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x238]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
lea edx, [esp + 0x238]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
xor eax, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edi, 0x40b398
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edi, edx
mov edx, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
jmp 0x406faa
mov al, byte [0x40d874]
mov byte [esp + 0x238], al
mov edi, str.Binn_sqlsnmp.dll
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x238]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edi, edx
mov edx, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
lea eax, [esp + 0x24]
and ecx, 3
push eax
rep movsb byte es:[edi], byte [esi]
lea ecx, [esp + 0x14]
push ecx
push 0
push 0x2001f
push 0
push 0
push 0
push str.SOFTWAREMicrosoftMSSQLServerSNMPCurrentVersion
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegCreateKeyExA]
test eax, eax
jne 0x40719d
mov eax, dword [0x40b37c]
mov cl, byte [0x40b380]
mov dword [esp + 0x34], eax
mov byte [esp + 0x38], cl
lea edi, [esp + 0x238]
or ecx, 0xffffffff
xor eax, eax
mov edx, dword [str.Pathname]
repne scasb al, byte es:[edi]
not ecx
mov dword [esp + 0x30], edx
dec ecx
lea edx, [esp + 0x238]
push ecx
push edx
push 1
push eax
mov dword [esp + 0x28], ecx
mov ecx, dword [esp + 0x20]
lea eax, [esp + 0x40]
push eax
push ecx
call ebp
mov edx, dword [esp + 0x10]
push edx
call ebx
mov eax, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x628
ret
mov ebp, dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
call ebp
test eax, eax
jne 0x40719d
mov edi, dword [sym.imp.ADVAPI32.dll_RegEnumValueA]
mov ebx, 0x104
mov dword [esp + 0x14], ebx
mov dword [esp + 0x18], ebx
lea ecx, [esp + 0x18]
lea edx, [esp + 0x134]
push ecx
lea eax, [esp + 0x20]
push edx
push eax
mov eax, dword [esp + 0x1c]
lea ecx, [esp + 0x20]
push 0
lea edx, [esp + 0x40]
push ecx
push edx
push esi
push eax
call edi
test eax, eax
je 0x4070bf
cmp eax, 0xea
jne 0x4070fd
lea ecx, [esp + 0x134]
push str.MSSQLServerSNMP
push ecx
call fcn.00407240
add esp, 8
test eax, eax
je 0x4070f2
mov eax, dword [esp + 0x10]
lea edx, [esp + 0x30]
push edx
push eax
call dword [sym.imp.ADVAPI32.dll_RegDeleteValueA]
mov dword [esp + 0x14], ebx
mov dword [esp + 0x18], ebx
jmp 0x40708e
inc esi
mov dword [esp + 0x14], ebx
mov dword [esp + 0x18], ebx
jmp 0x40708e
mov ecx, dword [esp + 0x10]
mov ebx, dword [sym.imp.ADVAPI32.dll_RegCloseKey]
push ecx
call ebx
lea edx, [esp + 0x10]
push edx
push 0x2001f
push 0
push str.SOFTWAREMicrosoftMSSQLServerSNMP
push 0x80000002
call ebp
test eax, eax
jne 0x40719d
mov esi, dword [sym.imp.ADVAPI32.dll_RegEnumKeyExA]
mov edi, dword [sym.imp.ADVAPI32.dll_RegDeleteKeyA]
mov ebp, 0x104
mov dword [esp + 0x14], ebp
lea eax, [esp + 0x28]
lea ecx, [esp + 0x14]
push eax
mov eax, dword [esp + 0x14]
push 0
push 0
push 0
lea edx, [esp + 0x40]
push ecx
push edx
push 0
push eax
call esi
test eax, eax
je 0x407164
cmp eax, 0xea
jne 0x407176
mov edx, dword [esp + 0x10]
lea ecx, [esp + 0x30]
push ecx
push edx
call edi
mov dword [esp + 0x14], ebp
jmp 0x40713b
mov eax, dword [esp + 0x10]
push eax
call ebx
push str.SOFTWAREMicrosoftMSSQLServerSNMP
push 0x80000002
call edi
test eax, eax
jne 0x40719d
mov eax, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x628
ret
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x628
ret