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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffe98
push ebx
push esi
push edi
xor ecx, ecx
mov dword [ebp - 0x168], ecx
mov dword [ebp - 0x164], ecx
mov dword [ebp - 0x160], ecx
mov dword [ebp - 0x15c], ecx
mov dword [ebp - 0x158], ecx
mov dword [ebp - 0x10], edx
mov dword [ebp - 0xc], eax
xor eax, eax
push ebp
push 0x5007ba
push dword fs:[eax]
mov dword fs:[eax], esp
mov edx, dword [ebp - 0x10]
mov eax, dword [ebp - 0xc]
call fcn.004ffcb0
xor eax, eax
push ebp
push 0x500782
push dword fs:[eax]
mov dword fs:[eax], esp
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x1c1], 0
jne 0x5003eb
mov ecx, 0x5007d0
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x1c5], 0
jne 0x50040d
mov ecx, 0x5007ec
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
mov eax, dword [ebp - 0xc]
mov word [eax + 0x20], 2
mov eax, dword [ebp - 0xc]
mov edx, dword [eax + 0x1c1]
lea eax, [ebp - 0x40]
call fcn.0040db68
mov eax, 0x500804
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x18]
push eax
call sub.wsock32.dll_getprotobyname
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x18], eax
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x18], 0
jne 0x500483
mov eax, 0x500808
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x18]
push eax
call sub.wsock32.dll_getprotobyname
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x18], eax
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x18], 0
jne 0x500471
mov eax, dword [ebp - 0xc]
xor edx, edx
mov dword [eax + 0x1c], edx
jmp 0x500493
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
movsx eax, word [eax + 8]
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x1c], eax
jmp 0x500493
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x18]
movsx eax, word [eax + 8]
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x1c], eax
mov eax, dword [ebp - 0x18]
push eax
lea eax, [ebp - 0x40]
push eax
call sub.wsock32.dll_getservbyname
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x10], eax
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x10], 0
jne 0x5004d7
lea edx, [ebp - 0x158]
lea eax, [ebp - 0x40]
call fcn.0040dcd8
mov eax, dword [ebp - 0x158]
call fcn.0040c9e4
push eax
call sub.wsock32.dll_htons
mov edx, dword [ebp - 0xc]
mov word [edx + 0x22], ax
jmp 0x5004e8
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x10]
mov ax, word [eax + 8]
mov edx, dword [ebp - 0xc]
mov word [edx + 0x22], ax
mov eax, dword [ebp - 0xc]
mov edx, dword [eax + 0x1c5]
lea eax, [ebp - 0x141]
call fcn.0040db68
lea eax, [ebp - 0x141]
push eax
call sub.wsock32.dll_inet_addr
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x24], eax
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x24], 0xffffffff
jne 0x50055b
lea eax, [ebp - 0x141]
push eax
call sub.wsock32.dll_gethostbyname
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x14], eax
mov eax, dword [ebp - 0xc]
cmp dword [eax + 0x14], 0
jne 0x500548
mov ecx, 0x500814
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x14]
mov eax, dword [eax + 0xc]
mov eax, dword [eax]
mov eax, dword [eax]
mov edx, dword [ebp - 0xc]
mov dword [edx + 0x24], eax
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 0x1c]
push eax
push 1
push 2
call sub.wsock32.dll_socket
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
jge 0x5005a6
lea eax, [ebp - 0x15c]
push eax
call sub.wsock32.dll_WSAGetLastError
mov ecx, eax
mov edx, 2
mov eax, dword [ebp - 0xc]
call fcn.00500cf0
mov ecx, dword [ebp - 0x15c]
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
mov eax, dword [ebp - 0xc]
cmp byte [eax + 0x1c0], 1
jne 0x50063f
mov dword [ebp - 0x1c], 0x400
mov word [ebp - 0x154], 2
xor eax, eax
mov dword [ebp - 0x150], eax
mov ax, word [ebp - 0x1c]
push eax
call sub.wsock32.dll_htons
mov word [ebp - 0x152], ax
push 0x10
lea eax, [ebp - 0x154]
push eax
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_bind
test eax, eax
je 0x50063f
call sub.wsock32.dll_WSAGetLastError
cmp eax, 0x2740
je 0x500633
lea eax, [ebp - 0x160]
push eax
call sub.wsock32.dll_WSAGetLastError
mov ecx, eax
mov edx, 3
mov eax, dword [ebp - 0xc]
call fcn.00500cf0
mov ecx, dword [ebp - 0x160]
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
dec dword [ebp - 0x1c]
cmp dword [ebp - 0x1c], 0x200
jg 0x5005ce
push 0x33
push 0x400
mov eax, dword [ebp - 0xc]
call fcn.004ff6ec
push eax
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_WSAAsyncSelect
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
je 0x500693
lea eax, [ebp - 0x164]
push eax
call sub.wsock32.dll_WSAGetLastError
mov ecx, eax
mov edx, 4
mov eax, dword [ebp - 0xc]
call fcn.00500cf0
mov ecx, dword [ebp - 0x164]
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
mov eax, dword [ebp - 0xc]
call fcn.004ff754
push 0x10
mov eax, dword [ebp - 0xc]
add eax, 0x20
push eax
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_connect
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0xc]
call fcn.004ff72c
cmp dword [ebp - 0x14], 0
je 0x500701
call sub.wsock32.dll_WSAGetLastError
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0x2733
je 0x500701
lea eax, [ebp - 0x168]
push eax
call sub.wsock32.dll_WSAGetLastError
mov ecx, eax
mov edx, 5
mov eax, dword [ebp - 0xc]
call fcn.00500cf0
mov ecx, dword [ebp - 0x168]
mov dl, 1
mov eax, dword [0x40b6f8]
call fcn.004110b0
call fcn.00404cf0
mov dword [ebp - 4], 0xffffffff
push 4
lea eax, [ebp - 4]
push eax
push 1
push 6
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_setsockopt
mov dword [ebp - 4], 0xffffffff
push 4
lea eax, [ebp - 4]
push eax
push 8
push 0xffff
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_setsockopt
mov dword [ebp - 8], 0x2000
push 4
lea eax, [ebp - 8]
push eax
push 0x1001
push 0xffff
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_setsockopt
mov dword [ebp - 8], 0x2000
push 4
lea eax, [ebp - 8]
push eax
push 0x1002
push 0xffff
mov eax, dword [ebp - 0x20]
push eax
call sub.wsock32.dll_setsockopt
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x50079c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x5007c1
lea eax, [ebp - 0x168]
mov edx, 5
call fcn.004053c0
ret