Function at 0x406e10
Capabilities:
Connect socket
Get local ipv4 addresses
Get socket information
Set socket configuration

Disassembly:
push ebp
push edi
push esi
push ebx
mov ebx, eax
xor esi, esi
sub esp, 0x2bc
mov ebp, dword [eax]
mov dword [ecx], 0xffffffff
lea eax, [esp + 0x60]
mov dword [esp + 4], edx
mov dword [esp], ebx
mov dword [esp + 0x3c], ecx
mov dword [esp + 0xc], eax
lea eax, [esp + 0x120]
mov dword [esp + 8], eax
call fcn.00406cb0
test eax, eax
je 0x406e60
add esp, 0x2bc
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
ret
lea ecx, [esp + 0x64]
lea edx, [esp + 0x72]
lea eax, [esp + 0x130]
call fcn.00406460
test eax, eax
je 0x4070b0
lea eax, [esp + 0x72]
mov dword [esp + 4], str.__Trying__s..._n
mov dword [esp], ebp
mov dword [esp + 8], eax
call fcn.0041b5c0
cmp dword [esp + 0x120], 2
je 0x406f70
mov eax, dword [esp + 0x60]
mov dword [esp], eax
call fcn.004069b0
mov eax, dword [ebp + 0x1a8]
test eax, eax
je 0x406ee4
mov edx, dword [esp + 0x60]
mov dword [esp + 8], 0
mov dword [esp + 4], edx
mov edx, dword [ebp + 0x1ac]
mov dword [esp], edx
call eax
cmp eax, 2
je 0x407350
test eax, eax
jne 0x407100
mov dword [esp + 0x44], 0
cmp dword [esp + 0x120], 2
mov eax, dword [esp + 0x60]
mov dword [esp + 0x40], eax
je 0x407120
mov eax, dword [esp + 0x40]
mov dword [esp + 4], 1
mov dword [esp], eax
call fcn.0040da10
call fcn.004122c0
cmp dword [ebx + 0x2d8], 1
mov dword [ebx + 0x2d0], eax
mov dword [ebx + 0x2d4], edx
jle 0x406f42
mov eax, dword [ebx + 0x2dc]
mov dword [esp], ebp
mov dword [esp + 4], eax
call fcn.00409530
mov ecx, dword [esp + 0x44]
test ecx, ecx
jne 0x406f57
cmp dword [ebx + 0x8c], 1
je 0x407375
mov eax, dword [esp + 0x60]
mov edi, dword [esp + 0x3c]
xor esi, esi
mov dword [edi], eax
add esp, 0x2bc
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
ret
cmp dword [esp + 0x124], 1
jne 0x406ea2
mov edx, dword [ebp + 0x354]
test edx, edx
jne 0x407360
mov eax, dword [esp + 0x60]
mov dword [esp], eax
call fcn.004069b0
mov eax, dword [ebp + 0x474]
test eax, eax
je 0x406eae
mov esi, dword [esp + 0x60]
lea eax, [esp + 0x6c]
mov dword [esp + 0x6c], 1
mov dword [esp + 0x10], 4
mov dword [esp + 8], 8
mov dword [esp + 0xc], eax
mov dword [esp + 4], 0xffff
mov dword [esp], esi
call dword [sym.imp.WSOCK32.DLL_setsockopt]
sub esp, 0x14
test eax, eax
js 0x407500
mov dword [esp + 0x1b0], 1
mov eax, dword [ebp + 0x478]
mov dword [esp], eax
call fcn.0040dac0
imul eax, eax, 0x3e8
mov dword [esp + 0x6c], eax
mov dword [esp + 0x1b4], eax
mov eax, dword [ebp + 0x47c]
mov dword [esp], eax
call fcn.0040dac0
imul eax, eax, 0x3e8
mov dword [esp + 0x20], 0
mov dword [esp + 0x1c], 0
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0xc
mov dword [esp + 4], 0x98000004
mov dword [esp + 0x6c], eax
mov dword [esp + 0x1b8], eax
lea eax, [esp + 0xa0]
mov dword [esp], esi
mov dword [esp + 0x18], eax
lea eax, [esp + 0x1b0]
mov dword [esp + 8], eax
call dword [sym.imp.WS2_32.dll_WSAIoctl]
sub esp, 0x24
test eax, eax
je 0x406eae
call dword [sym.imp.WSOCK32.DLL_WSAGetLastError]
mov dword [esp + 8], esi
mov dword [esp + 0xc], eax
mov dword [esp + 4], str.Failed_to_set_SIO_KEEPALIVE_VALS_on_fd__d:__d_n
mov dword [esp], ebp
call fcn.0041b5c0
jmp 0x406eae
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp], ebx
mov esi, eax
mov dword [esp + 4], eax
call fcn.0040b230
mov dword [esp + 8], esi
mov dword [esp + 0xc], eax
xor esi, esi
mov dword [esp], ebp
mov dword [esp + 4], str.sa_addr_inet_ntop___failed_with_errno__d:__s
call fcn.0041b640
mov eax, dword [esp + 0x60]
mov dword [esp], ebx
mov dword [esp + 4], eax
call fcn.00406c30
add esp, 0x2bc
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esp + 0x60]
mov dword [esp], ebx
mov esi, 0x2a
mov dword [esp + 4], eax
call fcn.00406c30
jmp 0x406e4d
lea eax, [esp + 0x130]
mov dword [esp], eax
call fcn.004231a0
mov dword [esp + 0x54], eax
mov eax, dword [esp + 0x120]
mov dword [esp + 0x68], 0
mov dword [esp + 0x50], eax
mov eax, dword [esp + 0x60]
mov dword [esp + 0x40], eax
mov eax, dword [ebx]
movzx edi, word [eax + 0x178]
mov edx, dword [eax + 0x39c]
mov dword [esp + 0x48], eax
test edx, edx
mov word [esp + 0x4e], di
jne 0x407173
test di, di
je 0x406f02
mov eax, dword [esp + 0x48]
xor esi, esi
lea edi, [esp + 0xa0]
mov ecx, 0x20
test edx, edx
mov eax, dword [eax + 0x17c]
mov dword [esp + 0x58], eax
mov eax, esi
rep stosd dword es:[edi], eax
je 0x407410
mov dword [esp], edx
mov dword [esp + 0x5c], edx
call sub.msvcrt.dll_strlen
cmp eax, 0xfe
ja 0x407410
lea edi, [esp + 0x1b4]
mov eax, esi
mov ecx, 0x3f
mov edx, dword [esp + 0x5c]
mov dword [esp + 0x1b0], 0
mov esi, 0x4ec6a3
rep stosd dword es:[edi], eax
mov ecx, 3
mov edi, edx
repe cmpsb byte [esi], byte es:[edi]
jne 0x407519
lea esi, [esp + 0x1b0]
add edx, 3
mov dword [esp + 0x14], 0x100
mov dword [esp + 0xc], edx
mov dword [esp + 0x5c], edx
mov dword [esp + 0x10], esi
mov eax, dword [ebx + 0x88]
mov dword [esp + 8], eax
mov eax, dword [esp + 0x54]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x50]
mov dword [esp], eax
call fcn.004231c0
cmp eax, 1
je 0x4076b1
mov edx, dword [esp + 0x5c]
jb 0x4076bb
cmp eax, 2
jne 0x40768f
mov eax, dword [esp + 0x50]
mov dword [esp + 0xc], esi
mov dword [esp + 8], edx
mov dword [esp + 4], str.Local_Interface__s_is_ip__s_using_address_family__i_n
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x48]
mov dword [esp], eax
call fcn.0041b5c0
cmp dword [esp + 0x50], 2
je 0x4072f5
xor esi, esi
mov dword [esp + 0x54], ebp
movzx ebp, word [esp + 0x4e]
mov dword [esp + 0x50], ebx
mov edi, dword [sym.imp.WSOCK32.DLL_bind]
mov ebx, dword [esp + 0x58]
lea eax, [esp + 0xa0]
mov dword [esp + 8], esi
mov dword [esp + 4], eax
mov eax, dword [esp + 0x40]
mov dword [esp], eax
call edi
sub esp, 0xc
test eax, eax
jns 0x407422
sub ebx, 1
test ebx, ebx
jle 0x4074a1
movzx eax, bp
mov dword [esp + 4], str.Bind_to_local_port__hu_failed__trying_next_n
add ebp, 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x48]
mov dword [esp], eax
call fcn.0041b5c0
cmp word [esp + 0xa0], 2
jne 0x407285
movzx eax, bp
mov dword [esp], eax
call dword [sym.imp.WSOCK32.DLL_ntohs]
sub esp, 4
mov word [esp + 0xa2], ax
jmp 0x407285
lea eax, [esp + 0xa4]
mov dword [esp + 4], esi
mov dword [esp], 2
mov dword [esp + 8], eax
call fcn.0040b0c0
test eax, eax
jle 0x40726c
movzx eax, word [esp + 0x4e]
mov esi, 2
mov word [esp + 0xa0], si
mov esi, 0x10
mov dword [esp], eax
call dword [sym.imp.WSOCK32.DLL_htons]
sub esp, 4
mov word [esp + 0xa2], ax
jmp 0x40726e
mov dword [esp + 0x44], 1
jmp 0x406eec
mov eax, dword [esp + 0x60]
mov dword [esp], ebx
mov dword [esp + 4], eax
call fcn.00406920
jmp 0x406f8c
mov eax, dword [esp + 0x12c]
mov dword [esp + 8], eax
lea eax, [esp + 0x130]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x60]
mov dword [esp], eax
call dword [sym.imp.WSOCK32.DLL_connect]
sub esp, 0xc
cmp eax, 0xffffffff
jne 0x406f57
call dword [sym.imp.WSOCK32.DLL_WSAGetLastError]
cmp eax, 0xb
mov esi, eax
je 0x406f57
jl 0x4073c6
lea eax, [eax - 0x2733]
cmp eax, 1
jbe 0x406f57
mov dword [esp + 4], esi
mov dword [esp], ebx
call fcn.0040b230
mov dword [esp + 0xc], eax
lea eax, [esp + 0x72]
mov dword [esp + 4], str.Immediate_connect_fail_for__s:__s_n
mov dword [esp], ebp
mov dword [esp + 8], eax
call fcn.0041b5c0
mov eax, dword [esp + 0x60]
mov dword [ebp + 0x8614], esi
mov esi, 7
mov dword [esp], ebx
mov dword [esp + 4], eax
call fcn.00406c30
jmp 0x406e4d
xor esi, esi
cmp dword [esp + 0x50], 2
jne 0x40726e
jmp 0x407318
lea edx, [esp + 0x1b0]
xor eax, eax
mov ecx, 0x20
mov word [esp + 0x4e], bp
mov ebx, dword [esp + 0x50]
mov edi, edx
mov ebp, dword [esp + 0x54]
mov dword [esp + 0x6c], pe_nt_image_headers32
rep stosd dword es:[edi], eax
lea eax, [esp + 0x6c]
mov dword [esp + 4], edx
mov dword [esp + 8], eax
mov eax, dword [esp + 0x40]
mov dword [esp], eax
call dword [sym.imp.WSOCK32.DLL_getsockname]
sub esp, 0xc
test eax, eax
js 0x40763f
movzx eax, word [esp + 0x4e]
mov dword [esp + 4], str.Local_port:__hu_n
mov dword [esp + 8], eax
mov eax, dword [esp + 0x48]
mov dword [esp], eax
call fcn.0041b5c0
mov eax, dword [esp + 0x60]
mov dword [ebx + 0x2c4], 1
mov dword [esp + 0x40], eax
jmp 0x406f02
mov ebx, dword [esp + 0x50]
call dword [sym.imp.WSOCK32.DLL_WSAGetLastError]
mov edi, dword [esp + 0x48]
mov esi, eax
mov dword [edi + 0x8614], esi
mov dword [esp + 4], esi
mov dword [esp], ebx
call fcn.0040b230
mov dword [esp + 8], esi
mov dword [esp + 0xc], eax
mov esi, 0x2d
mov dword [esp + 4], str.bind_failed_with_errno__d:__s
mov dword [esp], edi
call fcn.0041b640
mov eax, dword [esp + 0x60]
mov dword [esp], ebx
mov dword [esp + 4], eax
call fcn.00406c30
cmp esi, 1
mov eax, 7
cmove esi, eax
jmp 0x406e4d
mov dword [esp + 8], esi
mov dword [esp + 4], str.Failed_to_set_SO_KEEPALIVE_on_fd__d_n
mov dword [esp], ebp
call fcn.0041b5c0
jmp 0x406eae
mov esi, str.host_
mov ecx, 5
mov edi, edx
repe cmpsb byte [esi], byte es:[edi]
je 0x407637
lea esi, [esp + 0x1b0]
mov dword [esp + 0x14], 0x100
mov dword [esp + 0xc], edx
mov dword [esp + 0x5c], edx
mov dword [esp + 0x10], esi
mov eax, dword [ebx + 0x88]
mov dword [esp + 8], eax
mov eax, dword [esp + 0x54]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x50]
mov dword [esp], eax
call fcn.004231c0
cmp eax, 1
je 0x4076b1
cmp eax, 2
mov edx, dword [esp + 0x5c]
je 0x40723d
cmp dword [esp + 0x50], 2
mov esi, dword [ebx + 0x2e8]
je 0x4076dd
lea edi, [esp + 0x68]
mov dword [esp + 4], edx
mov dword [esp + 8], 0
mov dword [esp], ebx
mov dword [esp + 0x54], edx
mov dword [esp + 0xc], edi
call fcn.00412ca0
cmp eax, 1
mov edx, dword [esp + 0x54]
je 0x4076ec
mov eax, dword [esp + 0x68]
mov dword [ebx + 0x2e8], esi
test eax, eax
je 0x40768f
lea esi, [esp + 0x1b0]
mov dword [esp + 8], 0x100
mov dword [esp + 0x54], edx
mov dword [esp + 4], esi
mov eax, dword [eax]
mov dword [esp], eax
call fcn.00412a80
mov eax, dword [esp + 0x68]
mov edi, dword [esp + 0x48]
mov edx, dword [esp + 0x54]
mov eax, dword [eax]
mov eax, dword [eax + 4]
mov dword [esp + 0x10], esi
mov dword [esp + 8], edx
mov dword [esp + 4], str.Name__s_family__i_resolved_to__s_family__i_n
mov dword [esp], edi
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x50]
mov dword [esp + 0xc], eax
call fcn.0041b5c0
mov eax, dword [esp + 0x68]
mov dword [esp], edi
mov dword [esp + 4], eax
call fcn.00412e70
jmp 0x407261
add edx, 5
jmp 0x40757c
call dword [sym.imp.WSOCK32.DLL_WSAGetLastError]
mov edi, dword [esp + 0x48]
mov esi, eax
mov dword [edi + 0x8614], esi
mov dword [esp + 4], esi
mov dword [esp], ebx
call fcn.0040b230
mov dword [esp + 8], esi
mov dword [esp + 0xc], eax
mov esi, 0x2d
mov dword [esp + 4], str.getsockname___failed_with_errno__d:__s
mov dword [esp], edi
call fcn.0041b640
mov eax, dword [esp + 0x60]
mov dword [esp], ebx
mov dword [esp + 4], eax
call fcn.00406c30
jmp 0x406e4d
mov eax, dword [esp + 0x48]
mov dword [esp + 8], edx
mov esi, 0x2d
mov dword [esp + 4], str.Couldnt_bind_to__s
mov dword [esp], eax
call fcn.0041b640
jmp 0x4074e0
mov esi, 1
jmp 0x4074e0
mov eax, dword [esp + 0x48]
mov dword [esp + 8], edx
mov esi, 0x2d
mov dword [esp + 4], str.Couldnt_bind_to_interface__s
mov dword [esp], eax
call fcn.0041b640
jmp 0x4074e0
mov dword [ebx + 0x2e8], 1
jmp 0x40758d
mov dword [esp + 4], edi
mov dword [esp], ebx
call fcn.0040dd90
mov edx, dword [esp + 0x54]
jmp 0x4075ba