Function at 0x40a8d0
Capabilities:
Create tcp socket
Create udp socket
Get local ipv4 addresses
Get socket information

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x40
mov dword [ebp - 0x30], 0
cmp eax, 2
je 0x40ab98
mov dword [esp + 4], str.AF_INET6
mov ebx, eax
mov dword [esp], 0x41412e
call fcn.004012c0
mov dword [esp + 8], 6
mov dword [esp + 4], 1
mov dword [esp], ebx
call dword [sym.imp.ws2_32.dll_socket]
sub esp, 0xc
mov edi, eax
call fcn.0040f800
mov esi, dword [sym.imp.ws2_32.dll_WSAGetLastError]
mov dword [eax], 0x4141a7
mov dword [eax + 4], 0x793
call esi
mov dword [esp + 4], str.socket_error__d_n
mov dword [esp + 8], eax
xor eax, eax
cmp edi, 0xffffffff
setne al
mov dword [esp], eax
call fcn.00402000
mov dword [ebp - 0x26], 0
xor ecx, ecx
xor eax, eax
mov dword [ebp - 0x10], 0
mov edx, 0x18
mov dword [ebp + eax - 0x24], ecx
add eax, 4
cmp eax, edx
jb 0x40a96a
mov eax, 0x17
mov dword [ebp - 0x2c], 0x1c
mov word [ebp - 0x28], ax
mov eax, dword [0x417ee8]
mov dword [ebp - 0x20], eax
mov eax, dword [0x417eec]
mov dword [ebp - 0x1c], eax
mov eax, dword [0x417ef0]
mov dword [ebp - 0x18], eax
mov eax, dword [0x417ef4]
mov dword [ebp - 0x14], eax
mov eax, 0x7ac
call fcn.00401820
call esi
lea edx, [ebp - 0x28]
mov dword [ebp - 0x34], eax
mov eax, dword [ebp - 0x2c]
mov dword [esp + 4], edx
mov dword [esp + 8], eax
mov dword [esp], edi
call dword [sym.imp.ws2_32.dll_bind]
mov ecx, dword [ebp - 0x34]
sub esp, 0xc
test eax, eax
sete al
mov dword [esp + 8], ecx
movzx eax, al
mov dword [esp + 4], str.bind_error__d_n
mov dword [esp], eax
call fcn.00402000
mov eax, 0x7ad
call fcn.00401820
call esi
lea edx, [ebp - 0x28]
mov dword [esp], edi
mov esi, eax
lea eax, [ebp - 0x2c]
mov dword [esp + 4], edx
mov dword [esp + 8], eax
call dword [sym.imp.ws2_32.dll_getsockname]
sub esp, 0xc
test eax, eax
sete al
mov dword [esp + 8], esi
movzx eax, al
mov dword [esp + 4], str.getsockname_error__d_n
mov dword [esp], eax
call fcn.00402000
movzx esi, word [ebp - 0x26]
mov dword [esp], edi
mov dword [esp + 4], 1
call dword [sym.imp.ws2_32.dll_listen]
mov eax, ebx
lea ecx, [ebp - 0x30]
mov edx, 5
sub esp, 8
call fcn.00401420
mov ebx, eax
test eax, eax
jne 0x40ade8
mov edx, dword [ebp - 0x30]
mov ecx, dword [edx]
test ecx, ecx
je 0x40ab38
lea eax, [edx + 4]
jmp 0x40aa86
add ebx, 1
add eax, 0x38
cmp ebx, ecx
je 0x40ab38
cmp dword [eax + 0x14], esi
jne 0x40aa78
cmp word [eax], 0
jne 0x40aa78
cmp word [eax + 2], 0
jne 0x40aa78
cmp word [eax + 4], 0
jne 0x40aa78
cmp word [eax + 6], 0
jne 0x40aa78
cmp word [eax + 8], 0
jne 0x40aa78
cmp word [eax + 0xa], 0
jne 0x40aa78
cmp word [eax + 0xc], 0
jne 0x40aa78
cmp word [eax + 0xe], 0x100
jne 0x40aa78
imul ebx, ebx, 0x38
mov eax, 0x7d5
mov dword [ebp - 0x34], edx
call fcn.00401820
mov edx, dword [ebp - 0x34]
add ebx, edx
mov eax, dword [ebx + 0x34]
mov dword [esp + 4], str.unexpected_socket_state__ld_n
cmp eax, 2
mov dword [esp + 8], eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00402000
mov eax, 0x7d6
call fcn.00401820
mov eax, dword [ebx + 0x38]
mov dword [esp + 4], str.unexpected_socket_owner__04lx_n
mov ebx, 1
mov ecx, dword fs:[0x18]
mov dword [esp + 8], eax
cmp dword [ecx + 0x20], eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00402000
mov edx, dword [ebp - 0x34]
jmp 0x40ab3a
xor ebx, ebx
mov dword [ebp - 0x34], edx
mov eax, 0x7db
call fcn.00401820
mov dword [esp + 4], str.no_table_entry_for_socket_n
mov dword [esp], ebx
call fcn.00402000
mov edx, dword [ebp - 0x34]
mov dword [ebp - 0x34], edx
mov dword [esp], edi
call dword [sym.imp.ws2_32.dll_closesocket]
mov edx, dword [ebp - 0x34]
sub esp, 4
mov dword [esp], edx
call dword [sym.imp.msvcrt.dll_free]
call fcn.0040f800
mov edx, dword [eax + 0xbec]
test edx, edx
je 0x40ab8d
sub edx, 1
mov dword [eax + 0xbec], edx
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 4], str.AF_INET
mov dword [esp], 0x41412e
call fcn.004012c0
mov dword [esp + 8], 6
mov dword [esp + 4], 1
mov dword [esp], 2
call dword [sym.imp.ws2_32.dll_socket]
sub esp, 0xc
mov edi, eax
call fcn.0040f800
mov ebx, dword [sym.imp.ws2_32.dll_WSAGetLastError]
mov dword [eax], 0x4141a7
mov dword [eax + 4], 0x793
call ebx
mov dword [esp + 4], str.socket_error__d_n
mov dword [esp + 8], eax
xor eax, eax
cmp edi, 0xffffffff
setne al
xor esi, esi
mov dword [esp], eax
call fcn.00402000
mov eax, dword [sym.imp.ws2_32.dll_htonl]
xor edx, edx
mov ecx, 2
mov word [ebp - 0x28], cx
mov word [ebp - 0x1a], dx
mov dword [ebp - 0x26], 0
mov dword [ebp - 0x22], 0
mov dword [ebp - 0x1e], 0
mov dword [ebp - 0x2c], 0x10
mov dword [esp], 0x7f000001
mov dword [ebp - 0x3c], eax
call eax
mov word [ebp - 0x26], si
lea esi, [ebp - 0x28]
mov dword [ebp - 0x24], eax
sub esp, 4
mov eax, 0x79e
call fcn.00401820
call ebx
mov dword [ebp - 0x34], eax
mov eax, dword [ebp - 0x2c]
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov dword [esp], edi
call dword [sym.imp.ws2_32.dll_bind]
mov edx, dword [ebp - 0x34]
sub esp, 0xc
test eax, eax
sete al
mov dword [esp + 8], edx
movzx eax, al
mov dword [esp + 4], str.bind_error__d_n
mov dword [esp], eax
call fcn.00402000
mov eax, 0x79f
call fcn.00401820
call ebx
mov dword [esp + 4], esi
mov ebx, eax
lea eax, [ebp - 0x2c]
mov dword [esp], edi
mov dword [esp + 8], eax
call dword [sym.imp.ws2_32.dll_getsockname]
sub esp, 0xc
test eax, eax
sete al
mov dword [esp + 8], ebx
movzx eax, al
mov dword [esp + 4], str.getsockname_error__d_n
mov dword [esp], eax
call fcn.00402000
movzx esi, word [ebp - 0x26]
mov dword [esp], edi
mov dword [esp + 4], 1
call dword [sym.imp.ws2_32.dll_listen]
lea ecx, [ebp - 0x30]
mov edx, 5
mov eax, 2
sub esp, 8
call fcn.00401420
mov ebx, eax
test eax, eax
jne 0x40ade8
mov edx, dword [ebp - 0x30]
movzx ecx, si
mov eax, dword [edx]
lea esi, [edx + 8]
test eax, eax
je 0x40add5
mov dword [ebp - 0x40], edi
mov edi, edx
jmp 0x40ad36
add ebx, 1
add esi, 0x18
cmp ebx, dword [edi]
jae 0x40add0
cmp dword [esi + 4], ecx
jne 0x40ad28
mov eax, dword [esi]
mov dword [ebp - 0x38], ecx
mov dword [ebp - 0x34], eax
mov dword [esp], 0x7f000001
mov ecx, dword [ebp - 0x3c]
call ecx
mov ecx, dword [ebp - 0x38]
sub esp, 4
cmp dword [ebp - 0x34], eax
jne 0x40ad28
mov eax, 0x7c4
mov dword [ebp - 0x34], edi
mov edi, dword [ebp - 0x40]
call fcn.00401820
mov edx, dword [ebp - 0x34]
lea eax, [ebx + ebx*2]
lea ebx, [edx + eax*8]
mov eax, dword [ebx + 4]
mov dword [esp + 4], str.unexpected_socket_state__ld_n
cmp eax, 2
mov dword [esp + 8], eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00402000
mov eax, 0x7c5
call fcn.00401820
mov eax, dword [ebx + 0x18]
mov dword [esp + 4], str.unexpected_socket_owner__04lx_n
mov ebx, 1
mov ecx, dword fs:[0x18]
mov dword [esp + 8], eax
cmp dword [ecx + 0x20], eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00402000
mov edx, dword [ebp - 0x34]
jmp 0x40add7
mov edx, edi
mov edi, dword [ebp - 0x40]
xor ebx, ebx
mov dword [ebp - 0x34], edx
mov eax, 0x7ca
jmp 0x40ab42
mov eax, 0x7b7
call fcn.00401820
mov dword [esp + 4], ebx
mov dword [esp], str.error__lu_getting_TCP_table_n
call fcn.00401b20
mov edx, dword [ebp - 0x30]
jmp 0x40ab5a