Function at 0x408590
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create udp socket
Get socket status
Resolve dns
Set socket configuration

Disassembly:
sub esp, 0x128
push ebx
push 0
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x4085d7
mov eax, dword [esp + 0x130]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, ebx
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4085ca
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
call dword [edx + 4]
or eax, 0xffffffff
pop ebx
add esp, 0x128
ret 8
push esi
mov esi, dword [sym.imp.WS2_32.dll_setsockopt]
push 4
lea eax, [esp + 0xc]
push eax
push 0x1005
push 0xffff
push ebx
mov dword [esp + 0x1c], 0x1388
call esi
push 4
lea ecx, [esp + 0xc]
push ecx
push 0x1006
push 0xffff
push ebx
call esi
lea edx, [esp + 0x10]
push edx
push 0x8004667e
push ebx
mov dword [esp + 0x1c], 1
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp eax, 0xffffffff
jne 0x408662
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, dword [esp + 0x134]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x408654
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
call dword [edx + 4]
pop esi
or eax, 0xffffffff
pop ebx
add esp, 0x128
ret 8
push ebp
mov ebp, dword [esp + 0x138]
push ebp
mov word [esp + 0x24], 2
call dword [sym.imp.WS2_32.dll_gethostbyname]
test eax, eax
jne 0x4086ad
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
add ebp, 0xfffffff0
lea eax, [ebp + 0xc]
or ecx, 0xffffffff
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x40869e
mov ecx, dword [ebp]
mov edx, dword [ecx]
push ebp
call dword [edx + 4]
pop ebp
pop esi
or eax, 0xffffffff
pop ebx
add esp, 0x128
ret 8
movsx ecx, word [eax + 0xa]
mov eax, dword [eax + 0xc]
mov esi, dword [eax]
mov eax, dword [esp + 0x13c]
mov edx, ecx
push edi
shr ecx, 2
lea edi, [esp + 0x28]
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
push eax
rep movsb byte es:[edi], byte [esi]
call dword [sym.imp.WS2_32.dll_htons]
push 0x10
lea ecx, [esp + 0x28]
push ecx
push ebx
mov word [esp + 0x32], ax
call dword [sym.imp.WS2_32.dll_connect]
xor esi, esi
lea edx, [esp + 0x1c]
push edx
push esi
lea eax, [esp + 0x3c]
push eax
push esi
push esi
mov dword [esp + 0x4c], ebx
mov dword [esp + 0x48], 1
mov dword [esp + 0x30], 5
mov dword [esp + 0x34], esi
call dword [sym.imp.WS2_32.dll_select]
test eax, eax
pop edi
jg 0x40874d
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
add ebp, 0xfffffff0
lea ecx, [ebp + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40873e
mov ecx, dword [ebp]
mov eax, dword [ecx]
push ebp
call dword [eax + 4]
pop ebp
pop esi
or eax, 0xffffffff
pop ebx
add esp, 0x128
ret 8
lea ecx, [esp + 0x10]
push ecx
push 0x8004667e
push ebx
mov dword [esp + 0x1c], esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp eax, 0xffffffff
jne 0x408783
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
add ebp, 0xfffffff0
lea edx, [ebp + 0xc]
or eax, 0xffffffff
lock xadd dword [edx], eax
dec eax
test eax, eax
jmp 0x408693
add ebp, 0xfffffff0
lea eax, [ebp + 0xc]
or ecx, 0xffffffff
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x40879e
mov ecx, dword [ebp]
mov edx, dword [ecx]
push ebp
call dword [edx + 4]
pop ebp
pop esi
mov eax, ebx
pop ebx
add esp, 0x128
ret 8