Function at 0x401980
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create thread
Create udp socket
Download and write a file
Get socket status
Receive and write data from server to client
Receive data
Receive data on socket
Resolve dns
Send data
Send data on socket
Set socket configuration
Terminate thread
Write file on windows

Disassembly:
mov eax, 0x22b0
call fcn.00404620
mov eax, dword [0x40909c]
xor eax, esp
mov dword [esp + 0x22ac], eax
cmp dword [esp + 0x22c4], 1
mov eax, dword [esp + 0x22b8]
mov ecx, dword [esp + 0x22bc]
push ebx
push ebp
mov ebp, dword [esp + 0x22bc]
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x22c8]
push esi
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], eax
mov dword [eax], 0xffffffff
jne 0x4019d9
mov dword [ecx], 0
push 0x406420
call fcn.00401830
mov ebx, dword [sym.imp.MSVCR90.dll_strstr]
push eax
push ebp
call ebx
mov esi, eax
add esp, 0xc
test esi, esi
jne 0x401a11
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
mov ecx, dword [esp + 0x22ac]
xor ecx, esp
call fcn.004045f8
add esp, 0x22b0
ret
push edi
push 0x406410
add esi, 7
call fcn.00401830
push eax
lea edi, [esi + 7]
push edi
call ebx
add esp, 0xc
test eax, eax
je 0x401a4e
mov edi, eax
sub edi, esi
push edi
lea ecx, [esp + 0x258]
push esi
push ecx
call dword [sym.imp.MSVCR90.dll_strncpy]
add esp, 0xc
mov byte [esp + edi + 0x254], 0
jmp 0x401a6a
lea edx, [esp + 0x254]
mov eax, edi
sub edx, edi
lea esp, [esp]
mov cl, byte [eax]
mov byte [edx + eax], cl
inc eax
test cl, cl
jne 0x401a60
push 0x406400
call fcn.00401830
push eax
lea edx, [esp + 0x25c]
push edx
call ebx
add esp, 0xc
test eax, eax
je 0x401a98
mov byte [eax], 0
inc eax
push eax
call dword [sym.imp.MSVCR90.dll_atoi]
add esp, 4
mov edi, eax
jmp 0x401a9d
mov edi, 0x50
push 0
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x401e9f
lea eax, [esp + 0x28]
push eax
push 0
lea ecx, [esp + 0x25c]
push ecx
push 0x401100
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
mov esi, eax
push 0x3e8
push esi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
jne 0x401aff
push 0
push esi
call dword [sym.imp.KERNEL32.dll_TerminateThread]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or eax, 0xffffffff
jmp 0x401ed0
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
mov dword [esp + 0x244], eax
mov dword [esp + 0x248], eax
mov dword [esp + 0x24c], eax
mov dword [esp + 0x250], eax
lea eax, [esp + 0x254]
mov edx, 2
push eax
mov word [esp + 0x248], dx
call dword [sym.imp.WS2_32.dll_gethostbyname]
test eax, eax
je 0x401b4a
mov ecx, dword [eax + 0xc]
mov edx, dword [ecx]
mov eax, dword [edx]
push edi
mov dword [esp + 0x24c], eax
call dword [sym.imp.WS2_32.dll_htons]
mov word [esp + 0x246], ax
lea eax, [esp + 0x24]
push eax
push 0x8004667e
mov esi, 1
push ebx
mov dword [esp + 0x30], esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
push 0x10
lea ecx, [esp + 0x248]
push ecx
push ebx
mov dword [esp + 0x4c], ebx
mov dword [esp + 0x48], esi
call dword [sym.imp.WS2_32.dll_connect]
mov edx, dword [esp + 0x22d8]
lea eax, [esp + 0x2c]
push eax
mov ecx, 0x41
lea esi, [esp + 0x40]
lea edi, [esp + 0x144]
push 0
rep movsd dword es:[edi], dword [esi]
lea ecx, [esp + 0x148]
push ecx
push 0
push 1
mov dword [esp + 0x40], 0
mov dword [esp + 0x44], edx
call dword [sym.imp.WS2_32.dll_select]
lea edx, [esp + 0x140]
push edx
push ebx
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x401e98
lea eax, [esp + 0x254]
push eax
push ebp
push 0x406380
call fcn.00401830
add esp, 4
push eax
lea ecx, [esp + 0x12c8]
push ecx
call dword [sym.imp.MSVCR90.dll_sprintf]
lea eax, [esp + 0x12cc]
add esp, 0x10
lea edx, [eax + 1]
lea esp, [esp]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x401c20
sub eax, edx
push 0
mov esi, eax
push esi
lea edx, [esp + 0x12c4]
push edx
push ebx
call dword [sym.imp.WS2_32.dll_send]
cmp eax, esi
jne 0x401e98
cmp dword [esp + 0x22d4], 0
mov dword [esp + 0x14], 0
mov byte [esp + 0x13], 0
jne 0x401c81
push 0x406368
call fcn.00401830
push eax
mov eax, dword [esp + 0x20]
push eax
call dword [sym.imp.MSVCR90.dll_fopen]
add esp, 0xc
mov dword [esp + 0x18], eax
test eax, eax
je 0x401e98
mov ebp, dword [esp + 0x28]
jmp 0x401c90
mov ecx, dword [esp + 0x22dc]
lea edx, [esp + 0x34]
push edx
push 0
push 0
lea eax, [esp + 0x48]
push eax
push 1
mov dword [esp + 0x48], 0
mov dword [esp + 0x4c], ecx
mov dword [esp + 0x54], ebx
mov dword [esp + 0x50], 1
call dword [sym.imp.WS2_32.dll_select]
lea ecx, [esp + 0x3c]
push ecx
push ebx
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x401e7c
push 0
push 0x1000
lea edx, [esp + 0x2c0]
push edx
push ebx
call dword [sym.imp.WS2_32.dll_recv]
mov edi, eax
mov byte [esp + edi + 0x2b8], 0
test edi, edi
jle 0x401e8a
cmp byte [esp + 0x13], 0
je 0x401d5e
mov esi, dword [esp + 0x22d4]
test esi, esi
jne 0x401d34
mov eax, dword [esp + 0x18]
push eax
push 1
lea ecx, [esp + 0x2c0]
push edi
push ecx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
add dword [esp + 0x14], edi
jmp 0x401e57
cmp esi, 1
jne 0x401d55
mov eax, dword [esp + 0x1c]
mov ecx, dword [eax]
add ecx, dword [esp + 0x14]
push edi
lea edx, [esp + 0x2bc]
push edx
push ecx
call sub.MSVCR90.dll_memcpy
add esp, 0xc
add dword [esp + 0x14], edi
jmp 0x401e57
push 0x40632c
call fcn.00401830
mov esi, dword [sym.imp.MSVCR90.dll_strstr]
push eax
lea edx, [esp + 0x2c0]
push edx
call esi
add esp, 0xc
test eax, eax
jne 0x401e98
push 0x4062f0
call fcn.00401830
push eax
lea eax, [esp + 0x2c0]
push eax
call esi
add esp, 0xc
test eax, eax
je 0x401e98
push 0x4062a8
call fcn.00401830
push eax
lea ecx, [esp + 0x2c0]
push ecx
call esi
add esp, 0xc
test eax, eax
je 0x401e98
add eax, 0x10
push eax
call dword [sym.imp.MSVCR90.dll_atoi]
push 0x406288
mov ebp, eax
call fcn.00401830
push eax
lea edx, [esp + 0x2c4]
push edx
call esi
mov esi, eax
add esp, 0x10
test esi, esi
je 0x401e98
add esi, 4
lea eax, [esp + 0x2b8]
sub eax, esi
add edi, eax
mov eax, dword [esp + 0x22d4]
mov byte [esp + 0x13], 1
test eax, eax
jne 0x401e27
mov ecx, dword [esp + 0x18]
push ecx
push 1
push edi
push esi
call dword [sym.imp.MSVCR90.dll_fwrite]
mov edx, dword [esp + 0x30]
mov dword [edx], ebp
jmp 0x401e49
cmp eax, 1
jne 0x401e4c
mov eax, dword [esp + 0x20]
lea ecx, [ebp + 1]
push ecx
mov dword [eax], ebp
call fcn.00404583
mov edx, dword [esp + 0x20]
push edi
push esi
push eax
mov dword [edx], eax
call sub.MSVCR90.dll_memcpy
add esp, 0x10
mov esi, dword [esp + 0x22d4]
mov dword [esp + 0x14], edi
cmp ebp, dword [esp + 0x14]
jg 0x401c90
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
test esi, esi
jne 0x401ea4
mov eax, dword [esp + 0x18]
push eax
call dword [sym.imp.MSVCR90.dll_fclose]
add esp, 4
jmp 0x401ecb
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, 0xfffffffd
jmp 0x401ed0
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, 0xfffffffc
jmp 0x401ed0
push ebx
call dword [sym.imp.WS2_32.dll_closesocket]
or eax, 0xffffffff
jmp 0x401ed0
cmp esi, 1
jne 0x401ecb
mov eax, dword [esp + 0x1c]
mov ecx, dword [eax]
mov edx, dword [esp + 0x20]
mov byte [ecx + ebp], 0
cmp dword [edx], 0
jge 0x401ec1
lea eax, [esi - 6]
jmp 0x401ed0
cmp dword [eax], 0
mov eax, 0xfffffffb
je 0x401ed0
mov eax, 1
mov ecx, dword [esp + 0x22bc]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.004045f8
add esp, 0x22b0
ret