Function at 0x407e6f
Capabilities:
Connect socket
Receive data
Receive data on socket
Send data
Send data on socket

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x330
mov eax, dword [0x40d2a4]
xor eax, ebp
mov dword [ebp - 8], eax
mov eax, dword [ebp + 8]
push ebx
push esi
push edi
xor esi, esi
mov dword [ebp - 0x318], eax
push 0x100
lea eax, [ebp - 0x10c]
mov dword [ebp - 0x330], ecx
mov ebx, edx
mov dword [ebp - 0x314], esi
push esi
push eax
mov dword [ebp - 0x32c], ebx
mov dword [ebp - 0x31c], esi
mov dword [ebp - 0x324], esi
mov dword [ebp - 0x320], esi
call sub.msvcrt.dll_memset
add esp, 0xc
lea eax, [ebp - 0x30c]
mov edx, ebx
push 0x200
push eax
sub esp, 0xc
push 0xfc
push dword [0x40d3bc]
call fcn.0040af5c
mov ebx, eax
test ebx, ebx
jns 0x407f10
test byte [0x40d3c8], 2
je 0x408364
push 0xcd
push 2
call fcn.0040baef
pop ecx
jmp 0x407f60
mov eax, dword [0x410c38]
mov edi, dword [eax + 8]
test edi, edi
jne 0x407f24
mov eax, dword [eax + 0xc]
mov eax, dword [eax]
mov edi, dword [eax + 8]
add edi, 0x20
push 2
pop ecx
movzx eax, word [edi]
cmp ax, cx
je 0x407f37
cmp eax, 0x17
jne 0x407f40
mov ecx, 0x3500
mov word [edi + 2], cx
push 0
push 1
push eax
call dword [sym.imp.WS2_32.dll_socket]
mov dword [0x40d2b0], eax
cmp eax, 0xffffffff
jne 0x407f66
push 0x4031c8
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
jmp 0x408364
push dword [edi + 0x20]
push edi
push eax
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x407f9b
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x274d
jne 0x407f8a
push 0xfffffffffffffffb
jmp 0x408056
push 0x4031d4
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
jmp 0x408054
push ebx
call dword [sym.imp.WS2_32.dll_htons]
xor edi, edi
mov word [ebp - 0x310], ax
push edi
push 2
lea eax, [ebp - 0x310]
push eax
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_send]
cmp eax, 0xffffffff
je 0x408345
push edi
push ebx
lea eax, [ebp - 0x30c]
push eax
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_send]
cmp eax, 0xffffffff
je 0x408345
mov ecx, dword [0x410c38]
cmp dword [ecx + 8], edi
jne 0x407ff8
mov eax, dword [ecx + 0xc]
mov ecx, dword [eax]
push dword [ecx]
push 0x4031ec
push 1
call fcn.0040c9f9
pop ecx
push eax
call dword [sym.imp.msvcrt.dll_fprintf]
mov ebx, dword [ebp - 0x318]
add esp, 0xc
test ebx, ebx
jne 0x40802a
push 1
call fcn.0040c9f9
pop ecx
mov dword [0x4112a0], eax
jmp 0x4080a7
push ecx
lea edx, [ebp - 0x10c]
mov ecx, ebx
call fcn.0040bdd4
mov dword [0x4112a0], eax
test eax, eax
jne 0x408071
lea eax, [ebp - 0x10c]
push eax
push 0xc
push 2
call fcn.0040baef
add esp, 0xc
push 0xfffffffffffffffd
pop esi
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x40d2b0], 0xffffffff
mov eax, esi
jmp 0x408367
push ebx
push 0x4031f4
push eax
call dword [sym.imp.msvcrt.dll_fprintf]
mov ecx, dword [0x410c38]
add esp, 0xc
cmp dword [ecx + 8], edi
jne 0x408091
mov eax, dword [ecx + 0xc]
mov ecx, dword [eax]
push dword [ecx]
push 0x4031ec
push dword [0x4112a0]
call dword [sym.imp.msvcrt.dll_fprintf]
add esp, 0xc
mov ebx, 0x40289c
cmp dword [0x410c3c], esi
jne 0x408222
push 2
lea ebx, [ebp - 0x328]
pop edi
push 0
push edi
push ebx
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_recv]
test eax, eax
je 0x4082d9
sub edi, eax
add ebx, eax
test edi, edi
jg 0x4080c1
cmp eax, 0xffffffff
je 0x4082d9
cmp eax, 2
jb 0x4082d9
push dword [ebp - 0x328]
call dword [sym.imp.WS2_32.dll_htons]
mov di, ax
mov word [ebp - 0x310], di
test di, di
je 0x408235
mov ecx, dword [0x410c34]
movzx eax, di
cmp eax, ecx
jle 0x40814e
test ecx, ecx
je 0x408137
push dword [0x410c30]
call dword [sym.imp.msvcrt.dll_free]
mov di, word [ebp - 0x310]
pop ecx
movzx eax, di
push eax
mov dword [0x410c34], eax
call dword [sym.imp.msvcrt.dll_malloc]
pop ecx
mov dword [0x410c30], eax
jmp 0x408153
mov eax, dword [0x410c30]
movzx edi, di
mov ebx, eax
test edi, edi
je 0x408186
push 0
push edi
push ebx
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_recv]
test eax, eax
jle 0x408178
sub edi, eax
add ebx, eax
test edi, edi
jg 0x40815c
cmp eax, 0xffffffff
je 0x408232
mov eax, dword [0x410c30]
lea ecx, [ebp - 0x320]
mov edx, eax
push ecx
lea ecx, [ebp - 0x314]
push ecx
push dword [ebp - 0x32c]
mov ecx, dword [0x4112a0]
push dword [ebp - 0x330]
push ebx
call fcn.0040837e
mov dword [ebp - 0x324], eax
test eax, eax
jne 0x4082d2
cmp dword [ebp - 0x318], esi
je 0x408206
mov ecx, dword [ebp - 0x314]
sub ecx, dword [ebp - 0x31c]
cmp ecx, 0x32
jle 0x408206
mov eax, dword [ebp - 0x314]
push 0x4031fc
push 1
mov dword [ebp - 0x31c], eax
call fcn.0040c9f9
pop ecx
push eax
call dword [sym.imp.msvcrt.dll_fprintf]
push 1
call fcn.0040c9f9
push eax
call dword [sym.imp.msvcrt.dll_fflush]
add esp, 0x10
cmp dword [ebp - 0x320], 2
jge 0x408235
cmp dword [0x410c3c], esi
je 0x4080b8
mov ebx, 0x40289c
xor edi, edi
push ebx
mov dword [0x410c3c], edi
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
jmp 0x40823a
push 2
pop esi
mov ebx, 0x40289c
mov edi, dword [ebp - 0x318]
test edi, edi
je 0x408278
cmp dword [ebp - 0x314], 1
mov ecx, 0x4026cc
mov eax, 0x403200
jne 0x408259
mov eax, ecx
cmp dword [ebp - 0x314], 0x32
jge 0x408264
mov ebx, ecx
push eax
push dword [ebp - 0x314]
push ebx
push 0x21
push 1
call fcn.0040baef
add esp, 0x14
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x40d2b0], 0xffffffff
test edi, edi
je 0x4082a7
mov eax, dword [0x4112a0]
test eax, eax
je 0x4082a7
push eax
call dword [sym.imp.msvcrt.dll_fclose]
and dword [0x4112a0], 0
pop ecx
sub esi, 0
je 0x408341
sub esi, 1
je 0x408364
sub esi, 1
je 0x4082e1
sub esi, 1
jne 0x408364
mov eax, dword [ebp - 0x324]
jmp 0x408367
push 3
jmp 0x408234
xor esi, esi
inc esi
jmp 0x408235
mov esi, dword [0x410c30]
push 0xd0
push 2
call fcn.0040baef
movzx eax, word [esi + 0xa]
pop ecx
pop ecx
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
push eax
movzx eax, word [esi + 8]
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
push eax
movzx eax, word [esi + 6]
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
push eax
movzx eax, byte [esi + 3]
and eax, 0xf
push dword [eax*4 + 0x401050]
push 0xd1
push 2
call fcn.0040baef
add esp, 0x18
jmp 0x408364
xor eax, eax
jmp 0x408367
push 0x4031e0
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
push dword [0x40d2b0]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x40d2b0], 0xffffffff
push 0xfffffffffffffffd
pop eax
mov ecx, dword [ebp - 8]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0040c480
leave
ret 4