Function at 0x51c316
Capabilities:
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x174
mov eax, dword [0x5c31c8]
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.0050f15a
pop ecx
test eax, eax
jns 0x51c382
push str.Connection_time_out
push esi
call fcn.00510cc2
pop ecx
pop ecx
push 0x1c
jmp 0x51c776
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 0x51c495
lea eax, [ebp - 0x15c]
mov edx, ebx
push eax
push ecx
mov ecx, edi
call fcn.005102fc
pop ecx
pop ecx
cmp eax, 0xffffffff
jne 0x51c3ea
push 5
jmp 0x51c776
cmp eax, 1
jne 0x51c3fc
lea edx, [ebp - 0x15c]
mov ecx, edi
call fcn.005109d5
mov eax, dword [ebp - 0x15c]
test eax, eax
je 0x51c47f
mov edi, dword [eax]
test edi, edi
je 0x51c47f
push 0x40
lea edx, [ebp - 0x158]
mov ecx, edi
call fcn.005100b7
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 0x51c46c
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 0x51c46e
xor edi, edi
mov edx, dword [ebp - 0x15c]
mov ecx, esi
call fcn.0051045b
test edi, edi
jne 0x51c495
push ebx
push str.Failed_to_resolve___s__for_SOCKS4_connect.
push esi
call fcn.00510cc2
add esp, 0xc
push 6
jmp 0x51c776
mov eax, dword [ebp - 0x160]
mov byte [ebp - 0x110], 0
test eax, eax
je 0x51c4b5
push ecx
mov edx, eax
lea ecx, [ebp - 0x110]
call fcn.005218b5
pop ecx
lea ecx, [ebp - 0x110]
xor edi, edi
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x51c4c0
sub ecx, edx
cmp dword [ebp - 0x168], edi
je 0x51c517
mov edx, ebx
mov dword [ebp - 0x114], 0x1000000
lea edi, [edx + 1]
mov al, byte [edx]
inc edx
test al, al
jne 0x51c4e0
sub edx, edi
lea edi, [edx + 1]
lea eax, [edi + 9]
add eax, ecx
cmp eax, 0x106
jg 0x51c515
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 0x51c503
mov ebx, dword [ebp - 0x170]
jmp 0x51c517
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.00510edf
add esp, 0xc
test eax, eax
jne 0x51c767
mov eax, dword [ebp - 0x160]
cmp dword [ebp - 0x15c], eax
jne 0x51c767
cmp dword [ebp - 0x168], 0
je 0x51c5ae
test edi, edi
jne 0x51c5ae
mov ecx, ebx
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x51c571
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.00510edf
add esp, 0xc
test eax, eax
jne 0x51c767
cmp dword [ebp - 0x15c], edi
jne 0x51c767
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.0051c27c
add esp, 0xc
test eax, eax
jne 0x51c760
cmp dword [ebp - 0x160], 8
jne 0x51c760
cmp byte [ebp - 0x118], al
je 0x51c5fb
push str.SOCKS4_reply_has_wrong_version__version_should_be_4.
jmp 0x51c76c
movzx ecx, byte [ebp - 0x117]
mov eax, ecx
sub eax, 0x5a
je 0x51c71c
dec eax
je 0x51c6dc
dec eax
je 0x51c69c
dec eax
movzx eax, byte [ebp - 0x10f]
je 0x51c666
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.00510cc2
add esp, 0x20
jmp 0x51c774
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 0x51c658
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 0x51c658
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 0x51c658
cmp dword [ebp - 0x168], 0
mov ecx, 0x57f98c
mov eax, 0x59c19c
cmove eax, ecx
push eax
push str.SOCKS4_s_request_granted._n
push esi
call fcn.00510c4e
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 0x51c777
push str.Failed_to_receive_SOCKS4_connect_request_ack.
jmp 0x51c76c
push str.Failed_to_send_SOCKS4_connect_request.
push esi
call fcn.00510cc2
pop ecx
pop ecx
push 7
pop eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0055daac
mov esp, ebp
pop ebp
ret