Function at 0x502810
Capabilities:
Get local ipv4 addresses
Get socket information

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x9b4
mov eax, dword [0x628960]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [ebp + 0xc]
lea eax, [ebp - 0x103]
push esi
mov esi, dword [ebp + 8]
push edi
push 0xff
push 0
mov edi, dword [esi]
push eax
mov dword [ebp - 0x9b4], esi
mov dword [ebp - 0x990], edi
mov dword [ebp - 0x98c], 0xffffffff
mov byte [ebp - 0x104], 0
call fcn.004a2440
mov ecx, dword [ebp - 0x990]
add esp, 0xc
mov edi, dword [edi + 0x3a4]
mov dword [ebp - 0x9b0], 0
mov dword [ebp - 0x9a4], 0
mov ecx, dword [ecx + 0x3a4]
mov dword [ebp - 0x9a0], 0
mov dword [ebp - 0x9ac], 1
test ecx, ecx
je 0x502a33
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x5028a6
sub ecx, edx
cmp ecx, 1
jbe 0x502a33
mov ecx, edi
lea edx, [ecx + 1]
lea ecx, [ecx]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x5028c0
sub ecx, edx
cmp ecx, 0x16
jae 0x5028d5
mov ecx, 0x16
jmp 0x5028e9
mov ecx, edi
lea edx, [ecx + 1]
lea ebx, [ebx]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x5028e0
sub ecx, edx
lea eax, [ecx + 1]
push 1
push eax
call dword [0x629b54]
add esp, 8
mov dword [ebp - 0x994], eax
test eax, eax
jne 0x502918
pop edi
pop esi
mov eax, 0x1b
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004a0676
mov esp, ebp
pop ebp
ret
cmp byte [edi], 0x3a
je 0x502951
push 0x3a
push edi
call fcn.004c0c20
add esp, 8
mov dword [ebp - 0x99c], eax
test eax, eax
je 0x5029e8
mov ecx, eax
mov eax, dword [ebp - 0x994]
sub ecx, edi
push ecx
push edi
push eax
call fcn.004da940
mov edi, dword [ebp - 0x99c]
add esp, 0xc
test edi, edi
je 0x5029fd
push 0x3a
push edi
call fcn.004c0c20
mov edi, eax
add esp, 8
test edi, edi
je 0x5029fd
push 0xa
lea ecx, [edi + 1]
push 0
push ecx
call fcn.004a115e
push eax
call fcn.004f45a0
movzx eax, ax
push 0x2d
push edi
mov dword [ebp - 0x9a4], eax
call fcn.004c0c20
add esp, 0x18
test eax, eax
je 0x5029d7
push 0xa
inc eax
push 0
push eax
call fcn.004a115e
push eax
call fcn.004f45a0
mov ecx, dword [ebp - 0x9a4]
add esp, 0x10
movzx eax, ax
mov dword [ebp - 0x9a0], eax
cmp cx, ax
jbe 0x5029fd
mov dword [ebp - 0x9a0], 0
mov dword [ebp - 0x9a4], 0
jmp 0x5029fd
mov ecx, dword [ebp - 0x9a4]
movzx eax, cx
mov dword [ebp - 0x9a0], eax
jmp 0x5029fd
mov ecx, dword [ebp - 0x994]
sub ecx, edi
mov al, byte [edi]
lea edi, [edi + 1]
mov byte [ecx + edi - 1], al
test al, al
jne 0x5029f0
mov edi, dword [ebp - 0x994]
cmp byte [edi], 0
je 0x502a35
push 0x401
lea eax, [ebp - 0x508]
push eax
mov eax, dword [esi + 0x3c]
push edi
push dword [eax + 4]
call fcn.00437230
add esp, 0x10
lea ecx, [ebp - 0x508]
test eax, eax
cmove ecx, edi
jmp 0x502ab6
xor edi, edi
lea eax, [ebp - 0x998]
mov dword [ebp - 0x998], 0x80
push eax
lea eax, [ebp - 0x988]
push eax
push dword [esi + 0x134]
call dword [sym.imp.WS2_32.dll_getsockname]
test eax, eax
je 0x502a83
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push esi
call fcn.004f7240
push eax
push str.getsockname___failed:__s
push dword [ebp - 0x990]
call fcn.004eb740
add esp, 0x14
jmp 0x502fcc
push 0x401
lea eax, [ebp - 0x508]
push eax
lea eax, [ebp - 0x984]
push eax
movzx eax, word [ebp - 0x988]
push eax
call fcn.004f7aa0
add esp, 0x10
mov dword [ebp - 0x9ac], 0
lea ecx, [ebp - 0x508]
lea eax, [ebp - 0x9b0]
mov dword [ebp - 0x99c], ecx
push eax
push 0
push ecx
push esi
call fcn.004e3840
add esp, 0x10
cmp eax, 1
jne 0x502ae4
lea eax, [ebp - 0x9b0]
push eax
push esi
call fcn.004e3090
add esp, 8
mov ecx, dword [ebp - 0x9b0]
test ecx, ecx
je 0x502fb3
mov eax, dword [ecx]
push ecx
push dword [ebp - 0x990]
mov dword [ebp - 0x994], eax
call fcn.004e3a00
add esp, 8
cmp dword [ebp - 0x994], 0
je 0x502fb3
test edi, edi
je 0x502b24
push edi
call dword [0x629b48]
add esp, 4
mov edi, dword [ebp - 0x994]
mov dword [ebp - 0x98c], 0xffffffff
mov dword [ebp - 0x9a8], 0
mov edi, edi
lea eax, [ebp - 0x98c]
push eax
push 0
push edi
push esi
call fcn.004ec580
add esp, 0x10
mov dword [ebp - 0x99c], eax
test eax, eax
je 0x502b78
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov edi, dword [edi + 0x1c]
mov dword [ebp - 0x9a8], eax
mov dword [ebp - 0x994], edi
test edi, edi
jne 0x502b40
jmp 0x502b82
test edi, edi
jne 0x502ba2
mov eax, dword [ebp - 0x9a8]
push eax
push esi
call fcn.004f7240
push eax
push str.socket_failure:__s
push dword [ebp - 0x990]
call fcn.004eb740
add esp, 0x14
jmp 0x502fda
push dword [edi + 0x10]
lea eax, [ebp - 0x988]
push dword [edi + 0x18]
push eax
call fcn.004abb00
mov eax, dword [edi + 0x10]
add esp, 0xc
mov dword [ebp - 0x998], eax
mov eax, dword [ebp - 0x9a4]
movzx edi, ax
cmp ax, word [ebp - 0x9a0]
ja 0x502c9c
cmp word [ebp - 0x988], 2
jne 0x502bee
push edi
call dword [sym.imp.WS2_32.dll_htons]
mov word [ebp - 0x986], ax
push dword [ebp - 0x998]
lea eax, [ebp - 0x988]
push eax
push dword [ebp - 0x98c]
call dword [sym.imp.WS2_32.dll_bind]
test eax, eax
je 0x502d1d
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp dword [ebp - 0x9ac], 0
je 0x502c82
cmp eax, 0x2741
jne 0x502c82
push eax
push esi
call fcn.004f7240
push eax
movzx eax, di
mov edi, dword [ebp - 0x990]
push eax
push str.bind_port_hu__on_non_local_address_failed:__s_n
push edi
call fcn.004eb850
add esp, 0x18
mov dword [ebp - 0x998], 0x80
lea eax, [ebp - 0x998]
push eax
lea eax, [ebp - 0x988]
push eax
push dword [esi + 0x134]
call dword [sym.imp.WS2_32.dll_getsockname]
test eax, eax
jne 0x502cc0
mov eax, dword [ebp - 0x9a4]
movzx edi, ax
mov dword [ebp - 0x9ac], 0
jmp 0x502c8f
cmp eax, 0x2740
je 0x502c8e
cmp eax, 0xd
jne 0x502ced
inc edi
cmp di, word [ebp - 0x9a0]
jbe 0x502bd6
push str.bind___failed__we_ran_out_of_ports_
push dword [ebp - 0x990]
call fcn.004eb740
push dword [ebp - 0x98c]
push esi
call fcn.004ebf10
add esp, 0x10
jmp 0x502fda
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push esi
call fcn.004f7240
push eax
push str.getsockname___failed:__s
push edi
call fcn.004eb740
push dword [ebp - 0x98c]
push esi
call fcn.004ebf10
add esp, 0x1c
jmp 0x502fda
push eax
push esi
call fcn.004f7240
push eax
movzx eax, di
push eax
push str.bind_port_hu__failed:__s
push dword [ebp - 0x990]
call fcn.004eb740
push dword [ebp - 0x98c]
push esi
call fcn.004ebf10
add esp, 0x20
jmp 0x502fda
cmp di, word [ebp - 0x9a0]
ja 0x502c9c
lea eax, [ebp - 0x998]
mov dword [ebp - 0x998], 0x80
push eax
lea eax, [ebp - 0x988]
push eax
push dword [ebp - 0x98c]
call dword [sym.imp.WS2_32.dll_getsockname]
test eax, eax
je 0x502d70
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push esi
call fcn.004f7240
push eax
push str.getsockname___failed:__s
push dword [ebp - 0x990]
jmp 0x502cd4
push 1
push dword [ebp - 0x98c]
call dword [sym.imp.WS2_32.dll_listen]
test eax, eax
je 0x502da0
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push esi
call fcn.004f7240
push eax
push str.socket_failure:__s
push dword [ebp - 0x990]
jmp 0x502cd4
push 0x100
lea eax, [ebp - 0x104]
push eax
push dword [ebp - 0x994]
call fcn.004e3810
add esp, 0xc
cmp ebx, 2
je 0x502e1b
mov edi, dword [sym.imp.WS2_32.dll_ntohs]
mov cx, word [ebp - 0x988]
lea esp, [esp]
cmp dword [esi + 0x210], 0
jne 0x502ddd
test ebx, ebx
je 0x502e15
cmp ebx, 1
jne 0x502de8
cmp cx, 2
jne 0x502e15
movzx eax, cx
sub eax, 2
jne 0x502e15
push dword [ebp - 0x986]
call edi
movzx eax, ax
mov dword [ebp - 0x9a8], eax
test ebx, ebx
je 0x502f29
cmp ebx, 1
je 0x502e6f
mov cx, word [ebp - 0x988]
inc ebx
cmp ebx, 2
jne 0x502dd0
mov edi, dword [ebp - 0x99c]
mov dword [esi + 0x468], ebx
mov eax, dword [esi + 0x138]
cmp eax, 0xffffffff
je 0x502e3c
push eax
push esi
call fcn.004ebf10
add esp, 8
mov eax, dword [ebp - 0x98c]
mov dword [esi + 0x138], eax
mov eax, edi
mov dword [esi + 0x1f4], 1
pop edi
mov dword [esi + 0x474], 0x1c
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004a0676
mov esp, ebp
pop ebp
ret
lea edx, [ebp - 0x908]
mov esi, 0x2c
lea edi, [ebp - 0x104]
mov cl, byte [edi]
test cl, cl
je 0x502e95
cmp cl, 0x2e
movzx eax, cl
cmove eax, esi
mov byte [edx], al
inc edx
inc edi
jne 0x502e80
mov eax, dword [ebp - 0x9a8]
movzx ecx, ax
movzx eax, cl
push eax
shr ecx, 8
push ecx
push 0x5ceb90
push 0x14
push edx
mov byte [edx], 0
call fcn.004f5370
mov esi, dword [ebp - 0x9b4]
lea eax, [ebp - 0x908]
push eax
push str.PORT
push 0x5ce498
lea eax, [esi + 0x400]
push eax
call fcn.0050de40
mov edi, eax
add esp, 0x24
test edi, edi
je 0x502e21
push edi
call fcn.004f7320
push eax
push str.Failure_sending_PORT_command:__s
push dword [ebp - 0x990]
call fcn.004eb740
push dword [ebp - 0x98c]
push esi
call fcn.004ebf10
add esp, 0x18
mov dword [esi + 0x474], 0
mov eax, edi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004a0676
mov esp, ebp
pop ebp
ret
movzx eax, ax
push eax
lea eax, [ebp - 0x104]
push eax
xor eax, eax
cmp word [ebp - 0x988], 2
setne al
inc eax
push eax
push str.EPRT
lea eax, [esi + 0x400]
push str._s__d_s_hu
push eax
call fcn.0050de40
mov edi, eax
add esp, 0x18
test edi, edi
je 0x502e21
push edi
call fcn.004f7320
push eax
push str.Failure_sending_EPRT_command:__s
push dword [ebp - 0x990]
call fcn.004eb740
push dword [ebp - 0x98c]
push esi
call fcn.004ebf10
add esp, 0x18
mov dword [esi + 0x468], 1
mov eax, edi
mov dword [esi + 0x474], 0
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004a0676
mov esp, ebp
pop ebp
ret
push dword [ebp - 0x99c]
push str.failed_to_resolve_the_address_provided_to_PORT:__s
push dword [ebp - 0x990]
call fcn.004eb740
add esp, 0xc
test edi, edi
je 0x502fda
push edi
call dword [0x629b48]
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, 0x1e
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004a0676
mov esp, ebp
pop ebp
ret