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

Disassembly:
push ebp
mov ebp, esp
push ebx
sub esp, 0x1b4
mov dword [0x41e060], 1
mov dword [ebp - 0x14], 0
mov eax, dword [ebp + 8]
movzx eax, byte [eax]
test al, al
jne 0x40277a
mov dword [0x41e060], 0
mov dword [esp], 0x3e8
call sym._Sleep_4
sub esp, 4
mov eax, 0x3e8
jmp 0x402be0
mov eax, dword [ebp + 8]
mov dword [esp], eax
call sym._strlen
cmp eax, 0x12
jbe 0x40282f
mov dword [ebp - 0x14], 1
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 0x17
call sym._socket_12
sub esp, 0xc
mov dword [ebp - 0x54], eax
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
lea eax, [ebp - 0x38]
mov dword [esp], eax
call sym._memset
mov word [ebp - 0x38], 0x17
mov eax, dword [ebp + 0xc]
movzx eax, ax
mov dword [esp], eax
call sym._htons_4
sub esp, 4
mov word [ebp - 0x36], ax
lea eax, [ebp - 0x38]
add eax, 4
mov dword [esp + 8], eax
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov dword [esp], 0x17
call sym.inet_pton_int__char_const__char_
test eax, eax
setle al
test al, al
je 0x4028c0
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov dword [esp], str.inet_pton_error_for__s_n
call sym._printf
jmp 0x4028c0
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 2
call sym._socket_12
sub esp, 0xc
mov dword [ebp - 0x54], eax
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
lea eax, [ebp - 0x38]
mov dword [esp], eax
call sym._memset
mov word [ebp - 0x38], 2
mov eax, dword [ebp + 0xc]
movzx eax, ax
mov dword [esp], eax
call sym._htons_4
sub esp, 4
mov word [ebp - 0x36], ax
lea eax, [ebp - 0x38]
add eax, 4
mov dword [esp + 8], eax
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov dword [esp], 2
call sym.inet_pton_int__char_const__char_
test eax, eax
setle al
test al, al
je 0x4028c0
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov dword [esp], str.inet_pton_error_for__s_n
call sym._printf
mov eax, dword [ebp - 0x54]
cmp eax, 0xffffffff
jne 0x4028ff
mov dword [0x41e060], 0
call sym.__errno
mov eax, dword [eax]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Failed_to_create_INET_socket__error__d_n
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sym._fprintf
mov eax, 1
jmp 0x402be0
mov dword [ebp - 0x5c], 1
mov dword [ebp - 0x58], 0
mov eax, dword [ebp - 0x54]
mov edx, eax
mov dword [esp + 0x10], 8
lea eax, [ebp - 0x5c]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1006
mov dword [esp + 4], 0xffff
mov dword [esp], edx
call sym._setsockopt_20
sub esp, 0x14
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jns 0x402968
call sym.__errno
mov eax, dword [eax]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Failed_setsockopt_SO_RCVTIMEO__error__d_n
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sym._fprintf
mov eax, dword [ebp - 0x54]
mov edx, eax
mov dword [esp + 0x10], 8
lea eax, [ebp - 0x5c]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1005
mov dword [esp + 4], 0xffff
mov dword [esp], edx
call sym._setsockopt_20
sub esp, 0x14
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jns 0x4029c3
call sym.__errno
mov eax, dword [eax]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Failed_setsockopt_SO_SNDTIMEO__error__d_n
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sym._fprintf
mov dword [esp + 4], 0
lea eax, [ebp - 0x64]
mov dword [esp], eax
call sym._gettimeofday
mov dword [ebp - 0x78], 5
mov eax, dword [ebp - 0x54]
mov edx, eax
lea eax, [ebp - 0x78]
mov dword [esp + 8], eax
mov dword [esp + 4], 0x8004667e
mov dword [esp], edx
call sym._ioctlsocket_12
sub esp, 0xc
mov eax, dword [ebp - 0x54]
mov edx, eax
mov dword [esp + 8], 0x10
lea eax, [ebp - 0x38]
mov dword [esp + 4], eax
mov dword [esp], edx
call sym._connect_12
sub esp, 0xc
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0xffffffff
jne 0x402b68
mov dword [ebp - 0x80], 1
mov dword [ebp - 0x7c], 0
lea eax, [ebp - 0x194]
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0x28]
mov dword [eax], 0
mov eax, dword [ebp - 0x54]
mov dword [ebp - 0x88], eax
lea eax, [ebp - 0x194]
mov dword [ebp - 0x84], eax
mov eax, dword [ebp - 0x84]
mov eax, dword [eax]
cmp eax, 0x3f
ja 0x402a9c
mov eax, dword [ebp - 0x84]
mov edx, dword [ebp - 0x88]
mov dword [ebp - 0x20], edx
mov dword [ebp - 0x24], eax
mov eax, dword [ebp - 0x24]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call sym.___WSAFDIsSet_8
sub esp, 8
test eax, eax
jne 0x402a9c
mov eax, 1
jmp 0x402aa1
mov eax, 0
test al, al
je 0x402ac2
mov ecx, dword [ebp - 0x84]
mov edx, dword [ebp - 0x84]
mov eax, dword [edx]
lea ebx, [eax + 1]
mov dword [edx], ebx
mov edx, dword [ebp - 0x88]
mov dword [ecx + eax*4 + 4], edx
mov eax, dword [ebp - 0x54]
lea edx, [eax + 1]
lea eax, [ebp - 0x80]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
lea eax, [ebp - 0x194]
mov dword [esp + 8], eax
mov dword [esp + 4], 0
mov dword [esp], edx
call sym._select_20
sub esp, 0x14
test eax, eax
setg al
test al, al
je 0x402b61
mov dword [ebp - 0x8c], 0xffffffff
mov dword [ebp - 0x90], 4
mov eax, dword [ebp - 0x54]
mov edx, eax
lea eax, [ebp - 0x90]
mov dword [esp + 0x10], eax
lea eax, [ebp - 0x8c]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1007
mov dword [esp + 4], 0xffff
mov dword [esp], edx
call sym._getsockopt_20
sub esp, 0x14
mov eax, dword [ebp - 0x8c]
test eax, eax
jne 0x402b58
mov dword [ebp - 0xc], 1
jmp 0x402b68
mov dword [ebp - 0xc], 0
jmp 0x402b68
mov dword [ebp - 0xc], 0
mov dword [esp + 4], 0
lea eax, [ebp - 0x6c]
mov dword [esp], eax
call sym._gettimeofday
lea eax, [ebp - 0x64]
mov dword [esp + 4], eax
lea eax, [ebp - 0x6c]
mov dword [esp], eax
call sym.timeval_subtract_timeval_const__timeval_const_
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0x54]
mov dword [esp], eax
call sym._closesocket_4
sub esp, 4
mov dword [0x41e060], 0
mov ecx, dword [ebp - 0x1c]
mov edx, 0x10624dd3
mov eax, ecx
imul edx
sar edx, 6
mov eax, ecx
sar eax, 0x1f
sub edx, eax
mov eax, edx
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0xc], 0
jne 0x402bd0
mov dword [ebp - 0x10], 0x3e8
cmp dword [ebp - 0x10], 0
jne 0x402bdd
mov dword [ebp - 0x10], 1
mov eax, dword [ebp - 0x10]
mov ebx, dword [ebp - 4]
leave
ret