Function at 0x51e010
Capabilities:
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x174
mov eax, dword [0x5ca1c8]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
push ebx
push esi
push edi
mov edi, dword [ebp + 0x10]
mov ebx, edx
mov dword [ebp - 0x160], ecx
xor edx, edx
mov ecx, dword [ebp + 0x14]
mov dword [ebp - 0x168], ecx
mov esi, dword [edi]
mov ecx, esi
mov eax, dword [edi + eax*4 + 0x130]
push 1
mov dword [ebp - 0x170], ebx
mov dword [ebp - 0x16c], edi
mov dword [ebp - 0x164], eax
call fcn.00510e54
pop ecx
test eax, eax
jns 0x51e07c
push str.Connection_time_out
push esi
call fcn.005129bc
pop ecx
pop ecx
push 0x1c
jmp 0x51e470
and dword [ebp - 0x15c], 0
lea eax, [ebp - 0x15c]
push eax
push 0x8004667e
push dword [ebp - 0x164]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov ecx, dword [ebp + 8]
mov eax, ecx
sar eax, 8
cmp dword [ebp - 0x168], 0
mov word [ebp - 0x118], 0x104
mov byte [ebp - 0x116], al
mov byte [ebp - 0x115], cl
jne 0x51e18f
lea eax, [ebp - 0x15c]
mov edx, ebx
push eax
push ecx
mov ecx, edi
call fcn.00511ff6
pop ecx
pop ecx
cmp eax, 0xffffffff
jne 0x51e0e4
push 5
jmp 0x51e470
cmp eax, 1
jne 0x51e0f6
lea edx, [ebp - 0x15c]
mov ecx, edi
call fcn.005126cf
mov eax, dword [ebp - 0x15c]
test eax, eax
je 0x51e179
mov edi, dword [eax]
test edi, edi
je 0x51e179
push 0x40
lea edx, [ebp - 0x158]
mov ecx, edi
call fcn.00511db1
pop ecx
lea eax, [ebp - 6]
push eax
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0xa]
push eax
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 0x158]
push str._hu._hu._hu._hu
push eax
call dword [sym.imp.MSVCR120.dll_sscanf]
add esp, 0x18
cmp eax, 4
jne 0x51e166
mov al, byte [ebp - 0xc]
mov byte [ebp - 0x114], al
mov al, byte [ebp - 0xa]
mov byte [ebp - 0x113], al
mov al, byte [ebp - 8]
mov byte [ebp - 0x112], al
mov al, byte [ebp - 6]
mov byte [ebp - 0x111], al
jmp 0x51e168
xor edi, edi
mov edx, dword [ebp - 0x15c]
mov ecx, esi
call fcn.00512155
test edi, edi
jne 0x51e18f
push ebx
push str.Failed_to_resolve___s__for_SOCKS4_connect.
push esi
call fcn.005129bc
add esp, 0xc
push 6
jmp 0x51e470
mov eax, dword [ebp - 0x160]
mov byte [ebp - 0x110], 0
test eax, eax
je 0x51e1af
push ecx
mov edx, eax
lea ecx, [ebp - 0x110]
call fcn.005235af
pop ecx
lea ecx, [ebp - 0x110]
xor edi, edi
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x51e1ba
sub ecx, edx
cmp dword [ebp - 0x168], edi
je 0x51e211
mov edx, ebx
mov dword [ebp - 0x114], 0x1000000
lea edi, [edx + 1]
mov al, byte [edx]
inc edx
test al, al
jne 0x51e1da
sub edx, edi
lea edi, [edx + 1]
lea eax, [edi + 9]
add eax, ecx
cmp eax, 0x106
jg 0x51e20f
mov edx, ebx
lea ebx, [ebp + ecx - 0x10f]
sub ebx, edx
mov al, byte [edx]
mov byte [ebx + edx], al
inc edx
test al, al
jne 0x51e1fd
mov ebx, dword [ebp - 0x170]
jmp 0x51e211
xor edi, edi
mov edx, dword [ebp - 0x164]
lea eax, [ecx + 9]
add eax, edi
lea ecx, [ebp - 0x15c]
push ecx
mov ecx, dword [ebp - 0x16c]
push eax
mov dword [ebp - 0x160], eax
lea eax, [ebp - 0x118]
push eax
call fcn.00512bd9
add esp, 0xc
test eax, eax
jne 0x51e461
mov eax, dword [ebp - 0x160]
cmp dword [ebp - 0x15c], eax
jne 0x51e461
cmp dword [ebp - 0x168], 0
je 0x51e2a8
test edi, edi
jne 0x51e2a8
mov ecx, ebx
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x51e26b
sub ecx, edx
lea eax, [ebp - 0x15c]
mov edx, dword [ebp - 0x164]
push eax
lea edi, [ecx + 1]
mov ecx, dword [ebp - 0x16c]
push edi
push ebx
call fcn.00512bd9
add esp, 0xc
test eax, eax
jne 0x51e461
cmp dword [ebp - 0x15c], edi
jne 0x51e461
mov edi, dword [ebp - 0x164]
lea eax, [ebp - 0x160]
mov ecx, dword [ebp - 0x16c]
mov edx, edi
push eax
lea eax, [ebp - 0x118]
push 8
push eax
call fcn.0051df76
add esp, 0xc
test eax, eax
jne 0x51e45a
cmp dword [ebp - 0x160], 8
jne 0x51e45a
cmp byte [ebp - 0x118], al
je 0x51e2f5
push str.SOCKS4_reply_has_wrong_version__version_should_be_4.
jmp 0x51e466
movzx ecx, byte [ebp - 0x117]
mov eax, ecx
sub eax, 0x5a
je 0x51e416
dec eax
je 0x51e3d6
dec eax
je 0x51e396
dec eax
movzx eax, byte [ebp - 0x10f]
je 0x51e360
push ecx
movzx ecx, byte [ebp - 0x110]
shl ecx, 8
or ecx, eax
movzx eax, byte [ebp - 0x111]
push ecx
push eax
movzx eax, byte [ebp - 0x112]
push eax
movzx eax, byte [ebp - 0x113]
push eax
movzx eax, byte [ebp - 0x114]
push eax
push str.Cant_complete_SOCKS4_connection_to__d._d._d._d:_d.___d___Unknown.
push esi
call fcn.005129bc
add esp, 0x20
jmp 0x51e46e
movzx ecx, byte [ebp - 0x110]
push 0x5d
shl ecx, 8
or ecx, eax
movzx eax, byte [ebp - 0x111]
push ecx
push eax
movzx eax, byte [ebp - 0x112]
push eax
movzx eax, byte [ebp - 0x113]
push eax
movzx eax, byte [ebp - 0x114]
push eax
push str.Cant_complete_SOCKS4_connection_to__d._d._d._d:_d.___d___request_rejected_because_the_client_program_and_identd_report_different_user_ids.
jmp 0x51e352
movzx ecx, byte [ebp - 0x110]
movzx eax, byte [ebp - 0x10f]
push 0x5c
shl ecx, 8
or ecx, eax
movzx eax, byte [ebp - 0x111]
push ecx
push eax
movzx eax, byte [ebp - 0x112]
push eax
movzx eax, byte [ebp - 0x113]
push eax
movzx eax, byte [ebp - 0x114]
push eax
push str.Cant_complete_SOCKS4_connection_to__d._d._d._d:_d.___d___request_rejected_because_SOCKS_server_cannot_connect_to_identd_on_the_client.
jmp 0x51e352
movzx ecx, byte [ebp - 0x110]
movzx eax, byte [ebp - 0x10f]
push 0x5b
shl ecx, 8
or ecx, eax
movzx eax, byte [ebp - 0x111]
push ecx
push eax
movzx eax, byte [ebp - 0x112]
push eax
movzx eax, byte [ebp - 0x113]
push eax
movzx eax, byte [ebp - 0x114]
push eax
push str.Cant_complete_SOCKS4_connection_to__d._d._d._d:_d.___d___request_rejected_or_failed.
jmp 0x51e352
cmp dword [ebp - 0x168], 0
mov ecx, 0x583988
mov eax, 0x59f7e8
cmove eax, ecx
push eax
push str.SOCKS4_s_request_granted._n
push esi
call fcn.00512948
add esp, 0xc
mov dword [ebp - 0x160], 1
lea eax, [ebp - 0x160]
push eax
push 0x8004667e
push edi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
xor eax, eax
jmp 0x51e471
push str.Failed_to_receive_SOCKS4_connect_request_ack.
jmp 0x51e466
push str.Failed_to_send_SOCKS4_connect_request.
push esi
call fcn.005129bc
pop ecx
pop ecx
push 7
pop eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0055fedc
mov esp, ebp
pop ebp
ret