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

Disassembly:
mov rax, rsp
mov qword [rax + 0x20], rbx
mov qword [rax + 0x18], r8
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x50
mov rbp, rcx
xor edi, edi
and qword [rax + 0x10], rdi
mov rcx, rdx
mov r14, r9
mov r13, r8
mov rbx, rdx
call fcn.180006628
mov rdx, qword [rbp + 0x20]
lea rcx, [rbx + 4]
add rdx, 0x20
lea r15d, [rdi + 0x16]
lea r12d, [rdi + 0x10]
test rcx, rcx
je 0x180006f79
mov r8d, r12d
test rdx, rdx
je 0x180006f74
call fcn.180015fd0
jmp 0x180006f86
call fcn.180016890
call fcn.18001b880
mov dword [rax], r15d
call fcn.18001b760
mov rax, qword [rbp + 0xa0]
test rax, rax
je 0x180007156
cmp dword [rax + 0x14], edi
je 0x180007156
cmp dword [rax + 0x44], edi
je 0x18000714e
mov rcx, qword [rax + 8]
lea r9, [rsp + 0x98]
xor r8d, r8d
xor edx, edx
call qword [sym.imp.ADVAPI32.dll_CryptDuplicateKey]
test eax, eax
je 0x18000702f
mov rcx, qword [rsp + 0x98]
lea r8, [rsp + 0x90]
mov esi, 1
xor r9d, r9d
mov dword [rsp + 0x90], esi
lea edx, [rsi + 3]
call qword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
je 0x18000702f
mov rcx, qword [rbp + 0xa0]
lea r8, [rsp + 0x40]
mov edx, r12d
mov rcx, qword [rcx]
call qword [sym.imp.ADVAPI32.dll_CryptGenRandom]
test eax, eax
jne 0x180007013
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov rcx, qword [rsp + 0x98]
lea r8, [rsp + 0x40]
xor r9d, r9d
mov edx, esi
call qword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
jne 0x18000703c
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x180007156
mov ecx, esi
call qword [sym.imp.WS2_32.dll_htonl]
mov r12d, dword [rbx + 0x28]
and r12d, 0xfffffff0
mov dword [rbx + 0x14], eax
add r12d, 0x10
lea ecx, [r12 + 0x30]
call fcn.1800178f0
mov qword [r13], rax
mov r15, rax
lea r13, [rax + 0x20]
mov eax, dword [rbx + 0x28]
mov dword [r14], eax
lea rbp, [r13 + 0x10]
mov r8d, dword [rbx + 0x28]
mov rdx, qword [rbx + 0x20]
test r8, r8
je 0x1800070a8
test rbp, rbp
je 0x180007098
mov rcx, rbp
test rdx, rdx
je 0x180007093
call fcn.180015fd0
jmp 0x1800070a8
call fcn.180016890
call fcn.18001b880
mov dword [rax], socket
call fcn.18001b760
mov rcx, qword [rsp + 0x98]
xor r9d, r9d
mov dword [rsp + 0x30], r12d
mov r8d, esi
mov qword [rsp + 0x28], r14
xor edx, edx
mov qword [rsp + 0x20], rbp
call qword [sym.imp.ADVAPI32.dll_CryptEncrypt]
test eax, eax
jne 0x1800070d9
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov ecx, dword [r14]
add ecx, 0x18
call qword [sym.imp.WS2_32.dll_ntohl]
mov dword [rbx + 0x18], eax
add dword [r14], 0x30
test r15, r15
jne 0x180007106
call fcn.18001b880
mov r15d, socket
mov dword [rax], r15d
call fcn.18001b760
jmp 0x18000711d
mov r8d, 0x20
mov rdx, rbx
mov rcx, r15
call fcn.180015fd0
mov r15d, socket
test r13, r13
jne 0x180007131
call fcn.18001b880
mov dword [rax], r15d
call fcn.18001b760
jmp 0x180007144
mov r8d, reloc.WS2_32.dll_recv
lea rdx, [rsp + 0x40]
mov rcx, r13
call fcn.180015fd0
mov r13, qword [rsp + 0xa0]
jmp 0x180007156
mov esi, 1
mov dword [rax + 0x44], esi
cmp qword [r13], 0
jne 0x1800071db
mov eax, dword [rbx + 0x28]
add eax, 0x20
mov ecx, eax
mov dword [r14], eax
call fcn.1800178f0
xor ecx, ecx
mov qword [r13], rax
mov rsi, rax
lea rbp, [rax + 0x20]
call qword [sym.imp.WS2_32.dll_htonl]
mov dword [rbx + 0x14], eax
test rsi, rsi
jne 0x180007197
call fcn.18001b880
mov dword [rax], r15d
call fcn.18001b760
jmp 0x1800071a8
mov r8d, 0x20
mov rdx, rbx
mov rcx, rsi
call fcn.180015fd0
mov r8d, dword [rbx + 0x28]
mov rdx, qword [rbx + 0x20]
test r8, r8
je 0x1800071db
test rbp, rbp
je 0x1800071ce
mov rcx, rbp
test rdx, rdx
je 0x1800071c9
call fcn.180015fd0
jmp 0x1800071db
call fcn.180016890
call fcn.18001b880
mov dword [rax], r15d
call fcn.18001b760
mov r8d, dword [r14]
mov rcx, rbx
mov rdx, qword [r13]
sub r8d, 4
add rdx, 4
call fcn.1800065d0
mov rcx, qword [rsp + 0x98]
test rcx, rcx
je 0x180007205
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov rbx, qword [rsp + 0xa8]
mov eax, edi
add rsp, 0x50
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret