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

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x31c
mov dword [ebp - 0x318], eax
mov eax, dword [eax]
mov dword [ecx], 0xffffffff
mov dword [ebp - 0x310], eax
lea eax, [ebp - 0x14]
push eax
lea eax, [ebp - 0x1f0]
push eax
push edx
push dword [ebp - 0x318]
mov dword [ebp - 0x31c], ecx
call fcn.0040e666
add esp, 0x10
mov dword [ebp - 0x30c], eax
test eax, eax
je 0x40e97d
mov dword [ebp - 0x30c], 0
jmp 0x40efb8
lea ecx, [ebp - 0x18]
lea edx, [ebp - 0x5e]
lea eax, [ebp - 0x1e0]
call fcn.0040e7ff
test al, al
jne 0x40e9cf
call sub.KERNEL32.DLL_GetLastError
push edi
push edi
push eax
push dword [ebp - 0x318]
mov ebx, eax
call fcn.004032f7
push eax
push ebx
push str.sa_addr_inet_ntop___failed_with_errno__d:__s
push dword [ebp - 0x310]
call fcn.0040e249
add esp, 0x18
push dword [ebp - 0x14]
push dword [ebp - 0x318]
call fcn.0040e715
jmp 0x40ef5d
mov edx, dword [ebp - 0x310]
cmp byte [edx + 0x2de], 0
je 0x40ea08
mov ecx, dword [ebp - 0x318]
sub esp, 0xc
mov eax, dword [ecx]
movzx eax, byte [eax + 0x2de]
mov dword [ebp - 0x24], eax
lea eax, [ebp - 0x24]
push 4
push eax
push 1
push 6
push dword [ebp - 0x14]
call sub.WS2_32.DLL_setsockopt
add esp, 0xc
sub esp, 0xc
push dword [ebp - 0x14]
call fcn.0040e858
mov edi, dword [ebp - 0x310]
add esp, 0x10
cmp byte [edi + 0x3cc], 0
je 0x40eaae
sub esp, 0xc
mov ebx, dword [ebp - 0x14]
lea eax, [ebp - 0x24]
mov dword [ebp - 0x24], 1
push 4
push eax
push 8
push 0xffff
push ebx
call sub.WS2_32.DLL_setsockopt
add esp, 0xc
test eax, eax
js 0x40eaae
sub esp, 0xc
mov dword [ebp - 0x30], 1
push dword [edi + 0x3d0]
call fcn.00415e48
pop esi
imul eax, eax, 0x3e8
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x24], eax
push dword [edi + 0x3d4]
call fcn.00415e48
mov dword [esp], 0
imul eax, eax, 0x3e8
mov dword [ebp - 0x24], eax
mov dword [ebp - 0x28], eax
lea eax, [ebp - 0x1c]
push 0
push eax
lea eax, [ebp - 0x30]
push 0
push 0
push 0xc
push eax
push 0x98000004
push ebx
call sub.WS2_32.DLL_WSAIoctl
add esp, 0xc
mov edx, dword [ebp - 0x310]
mov eax, dword [edx + 0x198]
test eax, eax
je 0x40eafe
push ebx
push 0
push dword [ebp - 0x14]
push dword [edx + 0x19c]
call eax
add esp, 0x10
mov byte [ebp - 0x311], 1
cmp eax, 2
je 0x40eb05
test eax, eax
je 0x40eafe
push ecx
push ecx
push dword [ebp - 0x14]
push dword [ebp - 0x318]
call fcn.0040e715
mov dword [ebp - 0x30c], 0x2a
jmp 0x40ef5d
mov byte [ebp - 0x311], 0
mov eax, dword [ebp - 0x318]
mov ecx, dword [ebp - 0x1f0]
mov dword [ebp - 0x308], ecx
mov edi, dword [ebp - 0x14]
mov eax, dword [eax]
mov dword [ebp - 0x304], edi
mov dword [ebp - 0x2f8], eax
mov dword [ebp - 0x20], 0
mov edx, dword [eax + 0x168]
mov ecx, dword [eax + 0x16c]
mov ebx, dword [eax + 0x30c]
mov al, byte [0x41fcf0]
mov byte [ebp - 0x2f0], al
lea eax, [ebp - 0x2ef]
mov word [ebp - 0x2fa], dx
push edx
push 0xff
push 0
push eax
mov dword [ebp - 0x300], ecx
call sub.msvcrt.dll_memset
add esp, 0x10
test ebx, ebx
sete byte [ebp - 0x2f1]
jne 0x40eb89
cmp word [ebp - 0x2fa], 0
je 0x40ef76
lea edi, [ebp - 0xe0]
push eax
push pe_nt_image_headers32
push 0
push edi
call sub.msvcrt.dll_memset
add esp, 0x10
cmp byte [ebp - 0x2f1], 0
jne 0x40ed5f
cld
or ecx, 0xffffffff
mov edi, ebx
mov al, byte [ebp - 0x2f1]
repne scasb al, byte es:[edi]
not ecx
dec ecx
cmp ecx, 0xfe
ja 0x40ed5f
mov edx, dword [0x41feb4]
or ecx, 0xffffffff
mov edi, edx
repne scasb al, byte es:[edi]
not ecx
push eax
lea esi, [ecx - 1]
push esi
push ebx
push edx
call sub.msvcrt.dll_strncmp
add esp, 0x10
test eax, eax
jne 0x40ebf5
add ebx, esi
mov edi, 1
jmp 0x40ec24
mov edx, dword [str.host_]
or ecx, 0xffffffff
cld
mov edi, edx
mov al, byte [ebp - 0x2f1]
repne scasb al, byte es:[edi]
not ecx
push edi
xor edi, edi
lea esi, [ecx - 1]
push esi
push ebx
push edx
call sub.msvcrt.dll_strncmp
add esp, 0x10
test eax, eax
jne 0x40ec24
add ebx, esi
jmp 0x40ec7f
sub esp, 0xc
lea eax, [ebp - 0x2f0]
push 0x100
push eax
mov eax, dword [ebp - 0x318]
push ebx
push dword [eax + 0x88]
push dword [ebp - 0x308]
call fcn.0041bf9b
add esp, 0x20
cmp eax, 1
je 0x40ee92
jb 0x40ec63
cmp eax, 2
jne 0x40ec75
jmp 0x40eced
mov edx, edi
test dl, dl
je 0x40ec7f
push esi
push ebx
push str.Couldnt_bind_to_interface__s
jmp 0x40ed4c
mov ecx, edi
test cl, cl
jne 0x40ed45
mov edi, dword [ebp - 0x318]
cmp dword [ebp - 0x308], 2
mov esi, dword [edi + 0x1f4]
jne 0x40ec9e
mov dword [edi + 0x1f4], 1
lea eax, [ebp - 0x20]
push eax
push 0
push ebx
push dword [ebp - 0x318]
call fcn.00403ec8
mov eax, dword [ebp - 0x318]
mov edx, dword [ebp - 0x20]
add esp, 0x10
mov dword [eax + 0x1f4], esi
test edx, edx
je 0x40ed45
lea eax, [ebp - 0x2f0]
push ecx
push 0x100
push eax
push dword [edx]
call fcn.0040407e
pop eax
pop edx
push dword [ebp - 0x20]
push dword [ebp - 0x2f8]
call fcn.00403b1d
add esp, 0x10
cmp dword [ebp - 0x308], 2
jne 0x40ef6f
push eax
lea eax, [ebp - 0xe0]
add eax, 4
push eax
lea eax, [ebp - 0x2f0]
push eax
push 2
call fcn.0041bfa4
add esp, 0x10
test eax, eax
jle 0x40ef6f
sub esp, 0xc
mov word [ebp - 0xe0], 2
movzx eax, word [ebp - 0x2fa]
push eax
call sub.WS2_32.DLL_htons
mov ebx, 0x10
mov word [ebp - 0xde], ax
jmp 0x40ed8c
push eax
push ebx
push str.Couldnt_bind_to__s
push dword [ebp - 0x2f8]
call fcn.0040e249
add esp, 0x10
jmp 0x40efae
xor ebx, ebx
cmp dword [ebp - 0x308], 2
jne 0x40ed8f
sub esp, 0xc
mov word [ebp - 0xe0], 2
movzx eax, word [ebp - 0x2fa]
push eax
call sub.WS2_32.DLL_htons
mov bl, 0x10
mov word [ebp - 0xde], ax
add esp, 0xc
lea edx, [ebp - 0xe0]
push edi
push ebx
push edx
push dword [ebp - 0x304]
call sub.WS2_32.DLL_bind
pop esi
test eax, eax
js 0x40ee17
lea ebx, [ebp - 0x160]
push ecx
push pe_nt_image_headers32
push 0
push ebx
mov dword [ebp - 0x24], pe_nt_image_headers32
call sub.msvcrt.dll_memset
add esp, 0xc
lea eax, [ebp - 0x24]
push eax
push ebx
push dword [ebp - 0x304]
call sub.WS2_32.DLL_getsockname
pop edx
test eax, eax
jns 0x40ee05
call sub.WS2_32.DLL_WSAGetLastError
mov ecx, dword [ebp - 0x2f8]
mov ebx, eax
mov dword [ecx + 0x8564], eax
push eax
push eax
push ebx
push dword [ebp - 0x318]
call fcn.004032f7
push eax
push ebx
push str.getsockname___failed_with_errno__d:__s
jmp 0x40ee7f
mov edi, dword [ebp - 0x318]
mov byte [edi + 0x1d7], 1
jmp 0x40ef76
dec dword [ebp - 0x300]
cmp dword [ebp - 0x300], 0
jle 0x40ee57
inc word [ebp - 0x2fa]
cmp word [ebp - 0xe0], 2
jne 0x40ed8f
sub esp, 0xc
movzx eax, word [ebp - 0x2fa]
push eax
call sub.WS2_32.DLL_ntohs
mov word [ebp - 0xde], ax
jmp 0x40ed8c
call sub.WS2_32.DLL_WSAGetLastError
mov ebx, eax
mov eax, dword [ebp - 0x2f8]
mov dword [eax + 0x8564], ebx
push edi
push edi
push ebx
push dword [ebp - 0x318]
call fcn.004032f7
push eax
push ebx
push str.bind_failed_with_errno__d:__s
push dword [ebp - 0x2f8]
call fcn.0040e249
add esp, 0x20
jmp 0x40efae
mov ebx, 1
push esi
push esi
push dword [ebp - 0x14]
push dword [ebp - 0x318]
call fcn.0040e715
add esp, 0x10
cmp ebx, 1
je 0x40efb8
mov dword [ebp - 0x30c], ebx
jmp 0x40efb8
mov edx, dword [ebp - 0x318]
push ebx
push ebx
push dword [edx + 0x1e8]
push dword [ebp - 0x310]
call fcn.0040a23f
add esp, 0x10
cmp byte [ebp - 0x311], 0
jne 0x40ef27
mov ecx, dword [ebp - 0x318]
cmp dword [ecx + 0x8c], 1
jne 0x40ef27
push ecx
lea eax, [ebp - 0x1e0]
push dword [ebp - 0x1e4]
push eax
push dword [ebp - 0x14]
call sub.WS2_32.DLL_connect
pop edx
inc eax
jne 0x40ef62
call sub.WS2_32.DLL_WSAGetLastError
mov edx, eax
cmp eax, 0xb
je 0x40ef62
jl 0x40ef37
lea eax, [eax - 0x2733]
cmp eax, 1
ja 0x40ef37
jmp 0x40ef62
mov edi, dword [ebp - 0x31c]
mov eax, dword [ebp - 0x14]
mov dword [edi], eax
jmp 0x40efb8
mov eax, dword [ebp - 0x310]
mov dword [eax + 0x8564], edx
push eax
push eax
push dword [ebp - 0x14]
push dword [ebp - 0x318]
call fcn.0040e715
mov dword [ebp - 0x30c], 7
add esp, 0x10
jmp 0x40efb8
mov edx, dword [ebp - 0x31c]
mov eax, dword [ebp - 0x14]
mov dword [edx], eax
jmp 0x40efb8
xor ebx, ebx
jmp 0x40ed8f
push eax
push eax
push 1
push dword [ebp - 0x14]
call fcn.0041c078
call fcn.0040c374
mov ecx, dword [ebp - 0x318]
add esp, 0x10
mov dword [ecx + 0x1dc], eax
mov dword [ecx + 0x1e0], edx
cmp dword [ecx + 0x1e4], 1
jg 0x40eebe
jmp 0x40eeda
mov ebx, 0x2d
jmp 0x40ee97
mov eax, dword [ebp - 0x30c]
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret