Function at 0x14013ca90
Capabilities:
Connect socket
Convert ip address from string
Get local ipv4 addresses
Get socket information
Set socket configuration

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x388
movsxd r12, r9d
lea rax, [rsp + 0xb0]
mov rsi, rdx
mov rbx, rcx
mov qword [rdx + r12*8 + 0x1c8], 0xffffffffffffffff
mov edx, dword [r8 + 4]
mov qword [rsp + 0x28], rax
lea rax, [rsp + 0x1f0]
mov qword [rsp + 0x20], rax
mov r9, qword [r8 + 0x20]
mov r8d, dword [r8 + 0x10]
call fcn.1402c3380
mov ebp, eax
test eax, eax
je 0x14013cb00
mov eax, ebp
add rsp, 0x388
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
lea rax, [rsp + 0x200]
mov edx, dword [rsp + 0x1fc]
lea r8, [rsp + 0xc0]
lea r9, [rsp + 0xa8]
mov rcx, rax
mov qword [rsp + 0x60], r8
mov qword [rsp + 0x80], rax
call fcn.14013c800
mov byte [rsp + 0x5f], al
test al, al
je 0x14013d1d0
lea rax, str.__Trying___s_:_d...
mov r8, qword [rsp + 0x60]
mov rcx, rbx
cmp dword [rsp + 0x1f0], 0x17
lea rdx, str.__Trying__s:_d...
mov r9d, dword [rsp + 0xa8]
cmove rdx, rax
call fcn.140123250
mov eax, dword [rsp + 0x1f0]
mov r14, qword [rsp + 0xb0]
cmp eax, 2
je 0x14013cce0
cmp eax, 0x17
je 0x14013cce0
mov rcx, r14
call fcn.14013c9d0
mov rax, qword [rbx + 0x270]
test rax, rax
je 0x14013cbee
mov rdx, qword [rbx + 0xd8]
test rdx, rdx
je 0x14013d228
mov byte [rdx + 0x18b], 1
mov rdx, r14
mov rcx, qword [rbx + 0x278]
xor r8d, r8d
call rax
mov rdx, qword [rbx + 0xd8]
test rdx, rdx
je 0x14013d320
mov byte [rdx + 0x18b], 0
cmp eax, 2
je 0x14013cbf3
test eax, eax
jne 0x14013d288
mov byte [rsp + 0x5f], 0
mov r10d, dword [rsp + 0x1f0]
cmp r10d, 2
je 0x14013ce00
lea rax, [rsp + 0x280]
mov qword [rsp + 0x68], rax
cmp r10d, 0x17
je 0x14013ce00
mov r8, qword [rsp + 0x68]
mov edx, 0x8004667e
mov rcx, r14
mov dword [rsp + 0x280], 1
call qword [sym.imp.WS2_32.dll_ioctlsocket]
lea rcx, [rsp + 0x90]
call fcn.1401284e0
cmp dword [rsi + 0x55c], 1
movdqu xmm0, xmmword [rsp + 0x90]
movups xmmword [rsi + 0x368], xmm0
jg 0x14013ccb0
cmp byte [rsp + 0x5f], 0
jne 0x14013cca0
cmp byte [rsi + 0x575], 4
je 0x14013cca0
test byte [rsi + 0x363], 1
jne 0x14013d168
mov r8d, dword [rsp + 0x1fc]
mov rdx, qword [rsp + 0x80]
mov rcx, r14
call qword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
je 0x14013d168
nop
mov qword [rsi + r12*8 + 0x1c8], r14
jmp 0x14013cae9
mov rdx, qword [rsi + 0x378]
mov rcx, rbx
mov r8d, 3
call fcn.140128570
mov rdx, qword [rsi + 0x380]
mov r8d, 4
mov rcx, rbx
call fcn.140128570
jmp 0x14013cc60
cmp dword [rsp + 0x1f4], 1
jne 0x14013cb90
test byte [rbx + 0xae4], 2
jne 0x14013d240
mov rcx, r14
call fcn.14013c9d0
cmp byte [rbx + 0xae4], 0
jns 0x14013cb98
mov dword [rsp + 0x20], 4
mov r8d, 8
mov edx, 0xffff
mov rcx, r14
mov dword [rsp + 0xf0], 1
lea r9, [rsp + 0xf0]
call qword [sym.imp.WS2_32.dll_setsockopt]
test eax, eax
js 0x14013d338
mov eax, dword [rbx + 0xa54]
mov edx, 0x98000004
mov rcx, r14
mov dword [rsp + 0x280], 1
mov r9d, 0xc
lea r8, [rsp + 0x280]
and eax, 0x7fffffff
imul eax, eax, 0x3e8
mov dword [rsp + 0x284], eax
mov eax, dword [rbx + 0xa58]
mov qword [rsp + 0x40], 0
and eax, 0x7fffffff
mov qword [rsp + 0x38], 0
imul eax, eax, 0x3e8
mov dword [rsp + 0x28], 0
mov qword [rsp + 0x20], 0
mov dword [rsp + 0xf0], eax
mov dword [rsp + 0x288], eax
lea rax, [rsp + 0x170]
mov qword [rsp + 0x30], rax
call qword [sym.imp.WS2_32.dll_WSAIoctl]
test eax, eax
je 0x14013cb98
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov r8d, r14d
lea rdx, str.Failed_to_set_SIO_KEEPALIVE_VALS_on_fd__d:__d
mov rcx, rbx
mov r9d, eax
call fcn.140123250
jmp 0x14013cb98
mov r11, qword [rbx + 0x7a8]
movzx r13d, word [rbx + 0x228]
mov qword [rsp + 0xb8], 0
mov r15d, dword [rbx + 0x22c]
test r11, r11
jne 0x14013ce3e
lea rax, [rsp + 0x280]
mov qword [rsp + 0x68], rax
test r13w, r13w
je 0x14013cc1c
lea rdi, [rsp + 0xf0]
mov ecx, 0x10
xor eax, eax
mov qword [rsp + 0x70], rdi
rep stosq qword [rdi], rax
test r11, r11
je 0x14013d058
mov rcx, r11
mov dword [rsp + 0x68], r10d
mov qword [rsp + 0x78], r11
call sub.msvcrt.dll_strlen
mov r10d, dword [rsp + 0x68]
cmp rax, 0xfe
ja 0x14013d058
mov qword [rsp + 0x280], 0
mov qword [rsp + 0x288], 0
mov qword [rsp + 0x290], 0
mov qword [rsp + 0x298], 0
mov qword [rsp + 0x2a0], 0
mov qword [rsp + 0x2a8], 0
mov qword [rsp + 0x2b0], 0
mov qword [rsp + 0x2b8], 0
mov qword [rsp + 0x2c0], 0
mov qword [rsp + 0x2c8], 0
mov qword [rsp + 0x2d0], 0
mov qword [rsp + 0x2d8], 0
mov qword [rsp + 0x2e0], 0
mov qword [rsp + 0x2e8], 0
mov qword [rsp + 0x2f0], 0
mov qword [rsp + 0x2f8], 0
mov qword [rsp + 0x300], 0
mov qword [rsp + 0x308], 0
mov qword [rsp + 0x310], 0
mov qword [rsp + 0x318], 0
mov qword [rsp + 0x320], 0
mov qword [rsp + 0x328], 0
mov qword [rsp + 0x330], 0
mov qword [rsp + 0x338], 0
mov qword [rsp + 0x340], 0
mov qword [rsp + 0x348], 0
mov qword [rsp + 0x350], 0
mov qword [rsp + 0x358], 0
mov qword [rsp + 0x360], 0
mov qword [rsp + 0x368], 0
mov qword [rsp + 0x370], 0
mov qword [rsp + 0x378], 0
mov r11, qword [rsp + 0x78]
cmp byte [r11], 0x69
jne 0x14013d350
cmp byte [r11 + 1], 0x66
jne 0x14013d350
cmp byte [r11 + 2], 0x21
jne 0x14013d350
lea r8, [r11 + 3]
lea rdx, str.Couldnt_bind_to_interface__s
mov rcx, rbx
call fcn.1401234a0
mov r8, r14
mov rdx, rsi
mov rcx, rbx
call fcn.1402c35a0
mov ebp, 0x2d
jmp 0x14013cae9
movzx ecx, r13w
cmp r10d, 0x17
je 0x14013d2a0
mov eax, 2
mov word [rsp + 0xf0], ax
call qword [sym.imp.WS2_32.dll_htons]
mov dword [rsp + 0x78], 0x10
mov word [rsp + 0xf2], ax
lea rax, [rsp + 0x280]
mov qword [rsp + 0x68], rax
mov dword [rsp + 0x88], ebp
mov rdi, qword [sym.imp.WS2_32.dll_bind]
jmp 0x14013d0ef
sub r15d, 1
test r15d, r15d
jle 0x14013d2d8
add r13w, 1
je 0x14013d2d8
movzx ebp, r13w
lea rdx, str.Bind_to_local_port__hu_failed__trying_next
mov rcx, rbx
lea r8d, [rbp - 1]
call fcn.140123250
mov ecx, ebp
call qword [sym.imp.WS2_32.dll_ntohs]
mov word [rsp + 0xf2], ax
mov r8d, dword [rsp + 0x78]
mov rdx, qword [rsp + 0x70]
mov rcx, r14
call rdi
test eax, eax
js 0x14013d0b0
lea rdx, [rsp + 0x170]
xor eax, eax
mov ecx, 0x10
mov dword [rsp + 0xac], pe_nt_image_headers64
mov rdi, rdx
mov ebp, dword [rsp + 0x88]
lea r8, [rsp + 0xac]
rep stosq qword [rdi], rax
mov rcx, r14
call qword [sym.imp.WS2_32.dll_getsockname]
test eax, eax
js 0x14013d530
movzx r8d, r13w
lea rdx, str.Local_port:__hu
mov rcx, rbx
call fcn.140123250
or byte [rsi + 0x362], 0x40
jmp 0x14013cc1c
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov edi, eax
cmp eax, 0xb
je 0x14013cca0
lea eax, [rax - 0x2733]
cmp eax, 1
jbe 0x14013cca0
mov rdx, qword [rsp + 0x68]
mov r8d, 0x100
mov ecx, edi
call fcn.140127c70
mov r8, qword [rsp + 0x60]
lea rdx, str.Immediate_connect_fail_for__s:__s
mov rcx, rbx
mov r9, rax
call fcn.140123250
mov dword [rbx + 0xd84], edi
mov r8, r14
mov rdx, rsi
mov rcx, rbx
mov ebp, 7
call fcn.1402c35a0
jmp 0x14013cae9
mov r12, qword [sym.imp.msvcrt.dll__errno]
call r12
lea rdx, [rsp + 0x280]
mov r8d, 0x100
mov ecx, dword [rax]
call fcn.140127c70
mov rdi, rax
call r12
mov rcx, rbx
mov r9, rdi
lea rdx, str.sa_addr_inet_ntop___failed_with_errno__d:__s
mov r8d, dword [rax]
call fcn.1401234a0
mov r8, qword [rsp + 0xb0]
mov rdx, rsi
mov rcx, rbx
call fcn.1402c35a0
jmp 0x14013cae9
mov rdx, qword [rbx + 0xd0]
test rdx, rdx
jne 0x14013cbb4
jmp 0x14013cbbb
mov dword [rsp + 0x20], 4
mov r8d, 1
mov edx, 6
mov rcx, r14
mov dword [rsp + 0x170], 1
lea r9, [rsp + 0x170]
call qword [sym.imp.WS2_32.dll_setsockopt]
test eax, eax
js 0x14013d562
mov r14, qword [rsp + 0xb0]
jmp 0x14013ccfb
mov r8, r14
mov rdx, rsi
mov rcx, rbx
mov ebp, 0x2a
call fcn.1402c35a0
jmp 0x14013cae9
mov edx, 0x17
mov word [rsp + 0xf0], dx
call qword [sym.imp.WS2_32.dll_htons]
mov dword [rsp + 0x78], 0x1c
mov word [rsp + 0xf2], ax
lea rax, [rsp + 0x280]
mov qword [rsp + 0x68], rax
jmp 0x14013d096
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rdx, qword [rsp + 0x68]
mov r8d, 0x100
mov dword [rbx + 0xd84], eax
mov ecx, eax
mov edi, eax
call fcn.140127c70
mov r8d, edi
lea rdx, str.bind_failed_with_errno__d:__s
mov r9, rax
mov rcx, rbx
call fcn.1401234a0
mov r8, r14
mov rdx, rsi
mov rcx, rbx
call fcn.1402c35a0
jmp 0x14013d047
mov rdx, qword [rbx + 0xd0]
test rdx, rdx
jne 0x14013cbda
jmp 0x14013cbe1
mov r8, r14
lea rdx, str.Failed_to_set_SO_KEEPALIVE_on_fd__d
mov rcx, rbx
call fcn.140123250
jmp 0x14013cb98
mov rdx, r11
mov r8d, 5
mov dword [rsp + 0x78], r10d
lea rcx, str.host_
mov qword [rsp + 0x68], r11
lea rdi, [rsp + 0xb8]
call sub.msvcrt.dll_strncmp
mov r11, qword [rsp + 0x68]
mov r10d, dword [rsp + 0x78]
mov rcx, rbx
mov edx, eax
test edx, edx
lea rax, [r11 + 5]
cmove r11, rax
movzx eax, byte [rsi + 0x576]
cmp r10d, 2
mov byte [rsp + 0x88], al
setne al
mov rdx, r11
xor r9d, r9d
add eax, 1
xor r8d, r8d
mov qword [rsp + 0x68], r11
mov byte [rsi + 0x576], al
mov qword [rsp + 0x20], rdi
call fcn.1401522c0
mov r11, qword [rsp + 0x68]
mov r10d, dword [rsp + 0x78]
cmp eax, 1
je 0x14013d641
movzx eax, byte [rsp + 0x88]
mov byte [rsi + 0x576], al
mov rax, qword [rsp + 0xb8]
test rax, rax
je 0x14013d518
mov rcx, qword [rax]
mov byte [rsp + 0x280], 0
mov edx, dword [rcx + 4]
cmp edx, 2
je 0x14013d5f4
cmp edx, 0x17
jne 0x14013d597
mov rdx, qword [rcx + 0x20]
mov dword [rsp + 0x78], r10d
mov ecx, 0x17
lea r8, [rsp + 0x280]
mov qword [rsp + 0x88], r11
mov r9d, 0x100
mov qword [rsp + 0x68], r8
add rdx, 8
call qword [sym.imp.WS2_32.dll_inet_ntop]
mov rax, qword [rsp + 0xb8]
mov r10d, dword [rsp + 0x78]
mov r11, qword [rsp + 0x88]
mov rax, qword [rax]
mov r9d, r10d
mov r8, r11
lea rdx, str.Name__s_family__i_resolved_to__s_family__i
mov rcx, rbx
mov dword [rsp + 0x78], r10d
mov eax, dword [rax + 4]
mov dword [rsp + 0x28], eax
mov rax, qword [rsp + 0x68]
mov qword [rsp + 0x20], rax
call fcn.140123250
mov rdx, qword [rsp + 0xb8]
mov rcx, rbx
call fcn.14014bdd0
mov rax, qword [rsp + 0xb8]
mov r10d, dword [rsp + 0x78]
mov rax, qword [rax]
cmp r10d, dword [rax + 4]
jne 0x14013d1b7
cmp r10d, 0x17
je 0x14013d5a9
mov rdx, qword [rsp + 0x68]
lea r8, [rsp + 0xf4]
mov ecx, 2
call qword [sym.imp.WS2_32.dll_inet_pton]
mov dword [rsp + 0x78], 0
test eax, eax
jle 0x14013d096
mov word [rsp + 0xf0], 2
movzx ecx, r13w
call qword [sym.imp.WS2_32.dll_htons]
mov dword [rsp + 0x78], 0x10
mov word [rsp + 0xf2], ax
jmp 0x14013d096
and byte [rbx + 0x1338], 0xf7
mov r8, r11
lea rdx, str.Couldnt_bind_to__s
jmp 0x14013d031
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rdx, qword [rsp + 0x68]
mov r8d, 0x100
mov dword [rbx + 0xd84], eax
mov ecx, eax
mov edi, eax
call fcn.140127c70
mov r8d, edi
lea rdx, str.getsockname___failed_with_errno__d:__s
mov r9, rax
jmp 0x14013d305
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov r8d, 0x100
mov ecx, eax
lea rax, [rsp + 0x280]
mov rdx, rax
call fcn.140127c70
lea rdx, str.Could_not_set_TCP_NODELAY:__s
mov rcx, rbx
mov r8, rax
call fcn.140123250
jmp 0x14013d277
lea rdi, [rsp + 0x280]
mov qword [rsp + 0x68], rdi
jmp 0x14013d460
mov rcx, qword [rsp + 0x68]
mov edx, 0x25
call sub.msvcrt.dll_strchr
mov rdi, rax
test rax, rax
je 0x14013d665
mov byte [rax], 0
mov rdx, qword [rsp + 0x68]
mov ecx, 0x17
lea r8, [rsp + 0xf8]
call qword [sym.imp.WS2_32.dll_inet_pton]
test eax, eax
jg 0x14013d6a6
mov dword [rsp + 0x78], 0x1c
jmp 0x14013d096
mov rdx, qword [rcx + 0x20]
mov dword [rsp + 0x78], r10d
mov ecx, 2
lea r8, [rsp + 0x280]
mov qword [rsp + 0x88], r11
mov r9d, 0x100
mov qword [rsp + 0x68], r8
add rdx, 4
call qword [sym.imp.WS2_32.dll_inet_ntop]
mov rax, qword [rsp + 0xb8]
mov r10d, dword [rsp + 0x78]
mov r11, qword [rsp + 0x88]
jmp 0x14013d460
mov rdx, rdi
mov rcx, rbx
mov qword [rsp + 0x78], r11
mov dword [rsp + 0x68], r10d
call fcn.1402c3790
mov r11, qword [rsp + 0x78]
mov r10d, dword [rsp + 0x68]
jmp 0x14013d3d9
mov rdx, qword [rsp + 0x68]
lea r8, [rsp + 0xf8]
mov ecx, 0x17
call qword [sym.imp.WS2_32.dll_inet_pton]
test eax, eax
jle 0x14013d5e7
mov word [rsp + 0xf0], 0x17
movzx ecx, r13w
call qword [sym.imp.WS2_32.dll_htons]
mov word [rsp + 0xf2], ax
jmp 0x14013d5e7
mov word [rsp + 0xf0], 0x17
movzx ecx, r13w
call qword [sym.imp.WS2_32.dll_htons]
lea rcx, [rdi + 1]
mov r8d, 0xa
xor edx, edx
mov word [rsp + 0xf2], ax
call sub.msvcrt.dll_strtoul
mov dword [rsp + 0x108], eax
jmp 0x14013d5e7