Function at 0x180006e8c
Capabilities:
Encrypt or decrypt via wincrypt
Generate random numbers via winapi

Disassembly:
mov rax, rsp
mov qword [rax + 0x18], rbx
mov qword [rax + 0x20], rbp
push rsi
push rdi
push r12
push r13
push r15
sub rsp, 0x50
mov rbx, rcx
xor ebp, ebp
mov rcx, rdx
and qword [rax + 0x10], rbp
mov r15, r9
mov r12, r8
mov rsi, rdx
call fcn.1800065b4
mov r8, qword [rbx + 0x20]
lea edi, [rbp + 0x10]
lea rcx, [rsi + 4]
add r8, 0x20
mov r9d, edi
mov edx, edi
call fcn.180014f68
mov rax, qword [rbx + 0xa0]
test rax, rax
je 0x180007047
cmp dword [rax + 0x14], ebp
je 0x180007047
cmp dword [rax + 0x44], ebp
je 0x180007040
mov rcx, qword [rax + 8]
lea r9, [rsp + 0x88]
xor r8d, r8d
xor edx, edx
call qword [sym.imp.ADVAPI32.dll_CryptDuplicateKey]
test eax, eax
jne 0x180006f20
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov ebp, eax
jmp 0x180007047
mov rcx, qword [rsp + 0x88]
xor r9d, r9d
lea r8, [rsp + 0x80]
lea edx, [r9 + 4]
mov dword [rsp + 0x80], 1
call qword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
je 0x180006f13
mov rcx, qword [rbx + 0xa0]
lea r8, [rsp + 0x40]
mov edx, edi
mov rcx, qword [rcx]
call qword [sym.imp.ADVAPI32.dll_CryptGenRandom]
test eax, eax
jne 0x180006f6f
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov ebp, eax
mov rcx, qword [rsp + 0x88]
xor r9d, r9d
lea r8, [rsp + 0x40]
lea edx, [r9 + 1]
call qword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
je 0x180006f13
mov ecx, 1
call qword [sym.imp.WS2_32.dll_htonl]
mov edi, dword [rsi + 0x28]
shr edi, 4
mov dword [rsi + 0x14], eax
inc edi
shl edi, 4
lea ecx, [rdi + 0x30]
call fcn.180013344
mov qword [r12], rax
mov r13, rax
lea rbx, [rax + 0x30]
mov eax, dword [rsi + 0x28]
mov dword [r15], eax
mov edx, dword [rsi + 0x28]
mov r8, qword [rsi + 0x20]
mov r9d, edx
mov rcx, rbx
call fcn.180014f68
mov rcx, qword [rsp + 0x88]
xor r9d, r9d
mov dword [rsp + 0x30], edi
lea r8d, [r9 + 1]
xor edx, edx
mov qword [rsp + 0x28], r15
mov qword [rsp + 0x20], rbx
call qword [sym.imp.ADVAPI32.dll_CryptEncrypt]
test eax, eax
jne 0x180007002
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov ebp, eax
mov ecx, dword [r15]
add ecx, 0x18
call qword [sym.imp.WS2_32.dll_ntohl]
mov edx, 0x20
mov r8, rsi
mov dword [rsi + 0x18], eax
add dword [r15], 0x30
mov r9d, edx
mov rcx, r13
call fcn.180014f68
mov edx, reloc.WS2_32.dll_recv
lea r8, [rsp + 0x40]
lea rcx, [r13 + 0x20]
mov r9d, edx
call fcn.180014f68
jmp 0x180007047
mov dword [rax + 0x44], 1
cmp qword [r12], 0
jne 0x180007097
mov eax, dword [rsi + 0x28]
add eax, 0x20
mov ecx, eax
mov dword [r15], eax
call fcn.180013344
xor ecx, ecx
mov rbx, rax
mov qword [r12], rax
call qword [sym.imp.WS2_32.dll_htonl]
mov r9d, 0x20
mov r8, rsi
mov rcx, rbx
mov edx, r9d
mov dword [rsi + 0x14], eax
call fcn.180014f68
mov edx, dword [rsi + 0x28]
mov r8, qword [rsi + 0x20]
lea rcx, [rbx + 0x20]
mov r9d, edx
call fcn.180014f68
mov r8d, dword [r15]
mov rdx, qword [r12]
mov rcx, rsi
sub r8d, 4
add rdx, 4
call fcn.180006560
mov rcx, qword [rsp + 0x88]
test rcx, rcx
je 0x1800070c1
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
lea r11, [rsp + 0x50]
mov eax, ebp
mov rbx, qword [r11 + 0x40]
mov rbp, qword [r11 + 0x48]
mov rsp, r11
pop r15
pop r13
pop r12
pop rdi
pop rsi
ret