Function at 0x140004980
Capabilities:
Create service
Persist via windows service
Set registry value

Disassembly:
mov rax, rsp
push rbp
push r14
push r15
lea rbp, [rax - 0x1f8]
sub rsp, 0x2e0
mov qword [rbp - 0x80], 0xfffffffffffffffe
mov qword [rax + 8], rbx
mov qword [rax + 0x10], rsi
mov qword [rax + 0x18], rdi
mov qword [rax + 0x20], r12
mov rax, qword [0x140020008]
xor rax, rsp
mov qword [rbp + 0x1d0], rax
xor esi, esi
mov edi, esi
xor edx, edx
xor ecx, ecx
mov r8d, 0xf003f
call qword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov rbx, rax
test rax, rax
je 0x140004a12
lea r8d, [rsi + 1]
lea rdx, str.XfServer
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_OpenServiceW]
test rax, rax
je 0x140004a00
lea edi, [rsi + 1]
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov rcx, rbx
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
test edi, edi
je 0x140004a12
call fcn.140004db0
xor edx, edx
xor ecx, ecx
mov r8d, 0xf003f
call qword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov r15, rax
test rax, rax
je 0x140004d77
mov r8d, 0x104
lea rdx, [rbp - 0x40]
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
call fcn.140001930
mov rcx, rax
mov eax, esi
test rcx, rcx
setne al
test eax, eax
jne 0x140004a5f
mov ecx, 0x80004005
call fcn.1400013f0
int3
mov rax, qword [rcx]
call qword [rax + 0x18]
lea rbx, [rax + 0x18]
mov qword [rbp - 0x70], rbx
lea rcx, [rbp - 0x40]
lea rax, [rbp - 0x40]
or r14, 0xffffffffffffffff
test rax, 0xffffffffffff0000
jne 0x140004aa1
movzx edi, cx
mov ecx, edi
call fcn.1400014c0
test rax, rax
je 0x140004ace
mov r8d, edi
mov rdx, rax
lea rcx, [rbp - 0x70]
call fcn.140005be0
jmp 0x140004aca
lea rcx, [rbp - 0x40]
mov rax, r14
nop dword [rax + rax]
inc rax
cmp word [rcx + rax*2], 0
jne 0x140004ab0
mov r8d, eax
lea rdx, [rbp - 0x40]
lea rcx, [rbp - 0x70]
call fcn.140005a20
mov rbx, qword [rbp - 0x70]
mov edx, 0x5c
mov rcx, rbx
call fcn.140008c4c
test rax, rax
jne 0x140004ae5
mov eax, r14d
jmp 0x140004aeb
sub rax, rbx
sar rax, 1
lea r8d, [rax + 1]
lea rdx, [rsp + 0x70]
lea rcx, [rbp - 0x70]
call fcn.140005450
nop
mov rdx, rax
lea rcx, [rbp - 0x70]
call fcn.140005830
nop
mov rdx, qword [rsp + 0x70]
add rdx, 0xffffffffffffffe8
mov eax, r14d
lock xadd dword [rdx + 0x10], eax
sub eax, 1
jg 0x140004b2a
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + 8]
lea r8, str.XfServer.exe
lea rdx, [rbp - 0x70]
lea rcx, [rsp + 0x78]
call fcn.1400052b0
nop
mov rdx, rax
lea rcx, [rbp - 0x70]
call fcn.140005830
nop
mov rdx, qword [rsp + 0x78]
add rdx, 0xffffffffffffffe8
mov eax, r14d
lock xadd dword [rdx + 0x10], eax
sub eax, 1
jg 0x140004b6c
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + 8]
mov rbx, qword [rbp - 0x70]
mov edx, dword [rbx - 0x10]
mov rcx, rbx
call qword [sym.imp.OLEAUT32.dll_SysReAllocStringLen]
test rax, rax
jne 0x140004b87
call fcn.140005750
int3
mov qword [rsp + 0x60], rsi
mov qword [rsp + 0x58], rsi
lea rcx, [0x14001a228]
mov qword [rsp + 0x50], rcx
mov qword [rsp + 0x48], rsi
mov qword [rsp + 0x40], rsi
mov qword [rsp + 0x38], rax
mov dword [rsp + 0x30], 1
mov dword [rsp + 0x28], 2
mov dword [rsp + 0x20], pe_nt_image_headers64
mov r9d, 0xf01ff
lea r8, str.XfServer
lea rdx, str.XfServer
mov rcx, r15
call qword [sym.imp.ADVAPI32.dll_CreateServiceW]
mov r12, rax
test rax, rax
jne 0x140004bf7
mov rcx, r15
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x140004d5b
call fcn.140001930
mov rcx, rax
mov eax, esi
test rcx, rcx
setne al
test eax, eax
jne 0x140004c16
mov ecx, 0x80004005
call fcn.1400013f0
int3
mov rax, qword [rcx]
call qword [rax + 0x18]
lea rbx, [rax + 0x18]
mov qword [rbp - 0x68], rbx
lea rdx, str.XfServer_P2P
test rdx, 0xffffffffffff0000
jne 0x140004c54
movzx edi, dx
mov ecx, edi
call fcn.1400014c0
test rax, rax
je 0x140004c67
mov r8d, edi
mov rdx, rax
lea rcx, [rbp - 0x68]
call fcn.140005be0
jmp 0x140004c63
mov r8d, 0x14
lea rcx, [rbp - 0x68]
call fcn.140005a20
mov rbx, qword [rbp - 0x68]
mov rdi, rsi
mov qword [rbp - 0x58], rsi
mov qword [rbp - 0x78], rsi
lea rax, [rbp - 0x60]
mov qword [rsp + 0x40], rax
lea rax, [rbp - 0x78]
mov qword [rsp + 0x38], rax
mov qword [rsp + 0x30], rsi
mov dword [rsp + 0x28], 0x2001f
mov dword [rsp + 0x20], esi
xor r9d, r9d
xor r8d, r8d
lea rdx, str.SystemCurrentControlSetServicesXfServer
mov rcx, 0xffffffff80000002
call qword [sym.imp.ADVAPI32.dll_RegCreateKeyExW]
test eax, eax
jne 0x140004d19
mov rdi, qword [rbp - 0x78]
mov qword [rbp - 0x58], rdi
mov eax, esi
test rbx, rbx
setne al
test eax, eax
je 0x140004d04
mov rax, r14
nop word [rax + rax]
lea rax, [rax + 1]
cmp word [rbx + rax*2], 0
jne 0x140004cd0
lea eax, [rax*2 + 2]
mov dword [rsp + 0x28], eax
mov qword [rsp + 0x20], rbx
mov r9d, 1
xor r8d, r8d
lea rdx, str.Description
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_RegSetValueExW]
test rdi, rdi
je 0x140004d19
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov rdi, rsi
mov qword [rbp - 0x58], rsi
mov rcx, r12
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov rcx, r15
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov esi, 1
test rdi, rdi
je 0x140004d3e
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea rdx, [rbx - 0x18]
mov eax, r14d
lock xadd dword [rdx + 0x10], eax
sub eax, esi
jg 0x140004d57
mov rcx, qword [rdx]
mov rax, qword [rcx]
call qword [rax + 8]
mov rbx, qword [rbp - 0x70]
lea rdx, [rbx - 0x18]
lock xadd dword [rdx + 0x10], r14d
sub r14d, 1
jg 0x140004d75
mov rcx, qword [rdx]
mov r8, qword [rcx]
call qword [r8 + 8]
mov eax, esi
mov rcx, qword [rbp + 0x1d0]
xor rcx, rsp
call fcn.140006200
lea r11, [rsp + 0x2e0]
mov rbx, qword [r11 + 0x20]
mov rsi, qword [r11 + 0x28]
mov rdi, qword [r11 + 0x30]
mov r12, qword [r11 + 0x38]
mov rsp, r11
pop r15
pop r14
pop rbp
ret