Function at 0x40d390
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Create tcp socket

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
xor eax, eax
push edi
mov dword [ebp - 0x18], eax
push 6
mov dword [ebp - 0x14], eax
push 1
mov dword [ebp - 0x10], eax
push 2
mov dword [ebp - 0xc], eax
call dword [sym.imp.WS2_32.dll_socket]
mov edi, eax
cmp edi, 0xffffffff
jne 0x40d3bf
xor eax, eax
pop edi
mov esp, ebp
pop ebp
ret
mov al, byte [0x41ff5f]
mov ecx, dword [0x41ff58]
push ebx
xor ebx, ebx
cmp al, bl
push esi
mov esi, dword [sym.imp.WS2_32.dll_ntohs]
mov word [ebp - 0x18], 2
mov dword [ebp - 0x14], ecx
mov word [ebp - 0x16], bx
mov byte [ebp - 1], bl
je 0x40d3f8
mov edx, dword [ebp + 0xc]
push edx
call esi
cmp ax, 0x400
jae 0x40d3f8
mov byte [ebp - 1], 1
cmp byte [0x41ff5e], bl
mov byte [ebp - 2], bl
jbe 0x40d430
cmp byte [ebp - 1], bl
jne 0x40d439
mov eax, dword [ebp + 0x14]
push eax
call esi
mov cl, byte [ebp - 2]
movzx edx, cl
cmp ax, word [edx*2 + 0x420c00]
jne 0x40d422
mov byte [ebp - 1], 1
mov al, byte [0x41ff5e]
inc cl
cmp cl, al
mov byte [ebp - 2], cl
jb 0x40d403
cmp byte [ebp - 1], bl
je 0x40d526
mov esi, dword [sym.imp.WS2_32.dll_bind]
mov dword [ebp - 8], ebx
mov ax, word [0x41f340]
cmp ax, 0x100
ja 0x40d454
xor eax, eax
mov ax, 0x400
dec ax
mov word [0x41f340], ax
push eax
call dword [sym.imp.WS2_32.dll_htons]
mov word [ebp - 0x16], ax
push 0x10
lea eax, [ebp - 0x18]
push eax
push edi
call esi
cmp eax, ebx
jne 0x40d4bb
mov eax, dword [ebp - 0x14]
mov edx, dword [ebp + 0x10]
xor ecx, ecx
mov dword [ebp - 0x28], ecx
mov dword [ebp - 0x24], ecx
mov dword [ebp - 0x20], ecx
mov dword [ebp - 0x1c], ecx
cmp eax, dword [0x420c88]
mov word [ebp - 0x28], 2
mov dword [ebp - 0x24], edx
jne 0x40d4a2
mov ecx, dword [0x420c80]
mov dword [ebp - 0x14], ecx
mov dx, word [ebp + 0x14]
push 0x10
lea eax, [ebp - 0x28]
push eax
push edi
mov word [ebp - 0x26], dx
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, ebx
je 0x40d4fd
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2740
jne 0x40d702
push edi
call dword [sym.imp.WS2_32.dll_closesocket]
push 6
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov edi, eax
cmp edi, 0xffffffff
je 0x40d702
mov eax, dword [ebp - 8]
inc eax
cmp ax, 0x200
mov dword [ebp - 8], eax
jb 0x40d442
jmp 0x40d505
cmp word [ebp - 8], 0x200
jb 0x40d537
push 0x10
lea ecx, [ebp - 0x18]
push ecx
push edi
mov word [ebp - 0x16], bx
call esi
test eax, eax
je 0x40d537
push edi
call dword [sym.imp.WS2_32.dll_closesocket]
pop esi
pop ebx
xor eax, eax
pop edi
mov esp, ebp
pop ebp
ret
push 0x10
lea edx, [ebp - 0x18]
push edx
push edi
call dword [sym.imp.WS2_32.dll_bind]
test eax, eax
jne 0x40d516
push 0x150
call fcn.004028e0
mov esi, eax
add esp, 4
cmp esi, ebx
je 0x40d516
push fcn.0040c560
push 0x40d2d0
push esi
call fcn.004075c0
push esi
lea eax, [esi + 0x64]
push 0x40c890
push eax
call fcn.004096c0
push esi
lea ecx, [esi + 0x80]
push 0x40d170
push ecx
call fcn.004096c0
push esi
lea edx, [esi + 0x9c]
push 0x40c640
push edx
call fcn.004096c0
push esi
lea eax, [esi + 0xb8]
push 0x40c640
push eax
call fcn.004096c0
mov ecx, dword [ebp + 8]
mov eax, dword [ebp + 0x10]
mov dx, word [ebp + 0xc]
mov dword [esi + 0x44], eax
mov dword [esi + 0x3c], ecx
mov ecx, dword [ebp + 0x14]
mov word [esi + 0x40], dx
mov dword [esi + 0x13c], 0x40c1c0
mov dword [esi + 0x140], 0x40bce0
mov dword [esi + 0x14c], 0x40be50
mov dword [esi + 0x144], 0x40bd00
mov dword [esi + 0x148], 0x40b4f0
mov dword [esi + 0x138], ebx
mov word [esi + 0x48], cx
mov dword [esi + 0xd4], 0xa
mov dword [esi + 0x54], ebx
mov dword [esi + 0xd8], ebx
mov dword [esi + 0xdc], ebx
mov word [esi + 0x130], bx
mov dword [esi + 0x60], 0x5b4
mov dword [esi + 0x108], ebx
mov dword [esi + 0x104], ebx
mov dword [esi + 0x110], ebx
mov dword [esi + 0x118], ebx
mov dword [esi + 0x11c], ebx
mov dword [esi + 0x120], ebx
mov dword [esi + 0x128], ebx
mov dword [esi + 0x12c], ebx
mov eax, 1
mov dword [esi + 0x10c], eax
mov dword [esi + 0x124], eax
mov edx, 0xfaf0
mov dword [esi + 0x114], edx
lea eax, [esi + 0xf8]
mov dword [eax], eax
mov dword [esi + 0xfc], eax
mov dword [esi + 0xe8], ebx
mov dword [esi + 0xe0], ebx
mov dword [esi + 0xe4], edx
lea eax, [esi + 0xec]
mov dword [eax], eax
mov dword [esi + 0xf0], eax
mov dword [esi + 0x38], esi
mov edx, dword [0x41f334]
lea eax, [esi + 0x30]
mov dword [eax + 4], edx
mov dword [eax], 0x41f330
mov edx, dword [0x41f334]
add esp, 0x3c
mov dword [edx], eax
push ecx
mov dword [0x41f334], eax
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
cmp eax, 0x15
je 0x40d6d6
cmp eax, 0x6bb
jne 0x40d6df
push esi
call fcn.00412640
jmp 0x40d6dc
push esi
call fcn.00412460
add esp, 4
push edi
mov dword [esi + 0x20], edi
mov byte [esi + 0x1c], 1
call fcn.00405670
push esi
call fcn.004072b0
add esp, 8
test eax, eax
je 0x40d70b
push esi
call fcn.0040c560
add esp, 4
pop esi
pop ebx
xor eax, eax
pop edi
mov esp, ebp
pop ebp
ret
xor eax, eax
call fcn.00410a90
mov eax, esi
pop esi
pop ebx
pop edi
mov esp, ebp
pop ebp
ret