Function at 0x51c788
Capabilities:
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28c
mov eax, dword [0x5c31c8]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x10]
push ebx
push esi
push edi
mov edi, dword [ebp + 0x14]
mov ebx, ecx
mov ecx, dword [ebp + 8]
mov dword [ebp - 0x278], edx
mov dword [ebp - 0x288], ebx
mov eax, dword [edi + eax*4 + 0x130]
mov esi, dword [edi]
lea edx, [ecx + 1]
mov dword [ebp - 0x264], eax
xor eax, eax
cmp dword [edi + 0x114], 5
mov dword [ebp - 0x27c], ecx
sete al
mov dword [ebp - 0x280], edi
mov dword [ebp - 0x274], eax
mov al, byte [ecx]
inc ecx
test al, al
jne 0x51c7e5
sub ecx, edx
cmp dword [ebp - 0x274], 0
mov dword [ebp - 0x284], ecx
jne 0x51c81e
cmp ecx, 0xff
jbe 0x51c81e
push ecx
push str.SOCKS5:_server_resolving_disabled_for_hostnames_of_length___255__actual_len_zu__n
push esi
call fcn.00510c4e
add esp, 0xc
mov dword [ebp - 0x274], 1
push 1
xor edx, edx
mov ecx, esi
call fcn.0050f15a
mov dword [ebp - 0x268], eax
pop ecx
test eax, eax
jns 0x51c848
push str.Connection_time_out
push esi
call fcn.00510cc2
pop ecx
pop ecx
push 0x1c
jmp 0x51cf3b
lea eax, [ebp - 0x26c]
mov dword [ebp - 0x26c], 1
push eax
push 0x8004667e
push dword [ebp - 0x264]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
push dword [ebp - 0x268]
or edx, 0xffffffff
or ecx, 0xffffffff
push dword [ebp - 0x264]
call fcn.0051836a
pop ecx
pop ecx
cmp eax, 0xffffffff
jne 0x51c894
push str.SOCKS5:_no_connection_here
push dword [edi]
jmp 0x51cf32
test eax, eax
jne 0x51c8a1
push str.SOCKS5:_connection_timeout
push dword [edi]
jmp 0x51c83a
test al, 4
je 0x51c8ac
push str.SOCKS5:_error_occurred_during_connection
jmp 0x51c88d
test ebx, ebx
mov byte [ebp - 0x260], 5
mov word [ebp - 0x25e], 0x200
setne al
and dword [ebp - 0x26c], 0
inc al
mov byte [ebp - 0x25f], al
lea eax, [ebp - 0x26c]
push eax
push 0x8004667e
push dword [ebp - 0x264]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov edx, dword [ebp - 0x264]
lea eax, [ebp - 0x26c]
push eax
movzx eax, byte [ebp - 0x25f]
mov ecx, edi
add eax, 2
push eax
lea eax, [ebp - 0x260]
push eax
call fcn.00510edf
add esp, 0xc
test eax, eax
jne 0x51cf2c
movzx eax, byte [ebp - 0x25f]
add eax, 2
cmp dword [ebp - 0x26c], eax
jne 0x51cf2c
lea eax, [ebp - 0x270]
mov dword [ebp - 0x270], 1
push eax
push 0x8004667e
push dword [ebp - 0x264]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
push dword [ebp - 0x268]
mov ecx, dword [ebp - 0x264]
or edx, 0xffffffff
push 0xffffffffffffffff
call fcn.0051836a
pop ecx
pop ecx
cmp eax, 0xffffffff
jne 0x51c978
push str.SOCKS5_nothing_to_read
jmp 0x51c88d
test eax, eax
jne 0x51c986
push str.SOCKS5_read_timeout
jmp 0x51c89d
test al, 4
je 0x51c99f
push str.SOCKS5_read_error_occurred
push dword [edi]
call fcn.00510cc2
pop ecx
pop ecx
push 0x38
jmp 0x51cf3b
and dword [ebp - 0x268], 0
lea eax, [ebp - 0x268]
push eax
push 0x8004667e
push dword [ebp - 0x264]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov edx, dword [ebp - 0x264]
lea eax, [ebp - 0x270]
push eax
lea eax, [ebp - 0x260]
mov ecx, edi
push 2
push eax
call fcn.0051c27c
add esp, 0xc
test eax, eax
jne 0x51cf25
cmp dword [ebp - 0x270], 2
jne 0x51cf25
cmp byte [ebp - 0x260], 5
je 0x51ca06
push str.Received_invalid_version_in_initial_SOCKS5_response.
jmp 0x51cf31
mov al, byte [ebp - 0x25f]
test al, al
je 0x51cb97
cmp al, 2
jne 0x51cb5e
test ebx, ebx
je 0x51ca4c
mov edx, dword [ebp - 0x278]
test edx, edx
je 0x51ca4c
lea ecx, [ebx + 1]
mov al, byte [ebx]
inc ebx
test al, al
jne 0x51ca2d
sub ebx, ecx
mov ecx, edx
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x51ca3b
sub ecx, edx
mov dword [ebp - 0x268], ecx
jmp 0x51ca54
xor ebx, ebx
and dword [ebp - 0x268], ebx
mov eax, dword [ebp - 0x288]
mov byte [ebp - 0x260], 1
mov byte [ebp - 0x25f], bl
test eax, eax
je 0x51ca80
test ebx, ebx
je 0x51ca80
push ebx
push eax
lea eax, [ebp - 0x25e]
push eax
call sub.MSVCR120.dll_memcpy
add esp, 0xc
mov ecx, dword [ebp - 0x278]
lea eax, [ebx + 2]
mov ebx, dword [ebp - 0x268]
mov byte [ebp + eax - 0x260], bl
inc eax
mov dword [ebp - 0x268], eax
test ecx, ecx
je 0x51cabd
test ebx, ebx
je 0x51cabd
push ebx
push ecx
lea eax, [ebp + eax - 0x260]
push eax
call sub.MSVCR120.dll_memcpy
mov eax, dword [ebp - 0x268]
add esp, 0xc
add eax, ebx
lea ecx, [ebp - 0x26c]
mov ebx, dword [ebp - 0x264]
mov edx, ebx
push ecx
push eax
mov dword [ebp - 0x268], eax
mov ecx, edi
lea eax, [ebp - 0x260]
push eax
call fcn.00510edf
add esp, 0xc
test eax, eax
jne 0x51cb54
mov eax, dword [ebp - 0x268]
cmp eax, dword [ebp - 0x26c]
jne 0x51cb54
lea eax, [ebp - 0x270]
mov edx, ebx
push eax
lea eax, [ebp - 0x260]
mov ecx, edi
push 2
push eax
call fcn.0051c27c
add esp, 0xc
test eax, eax
jne 0x51cb4a
cmp dword [ebp - 0x270], 2
jne 0x51cb4a
mov al, byte [ebp - 0x25f]
test al, al
je 0x51cb97
movzx eax, al
push eax
movzx eax, byte [ebp - 0x260]
push eax
push str.User_was_rejected_by_the_SOCKS5_server___d__d_.
push esi
call fcn.00510cc2
add esp, 0x10
jmp 0x51cf39
push str.Unable_to_receive_SOCKS5_sub_negotiation_response.
jmp 0x51cf31
push str.Failed_to_send_SOCKS5_sub_negotiation_request.
jmp 0x51cf31
cmp al, 1
jne 0x51cb6c
push str.SOCKS5_GSSAPI_per_message_authentication_is_not_supported.
jmp 0x51cf31
cmp al, 0xff
jne 0x51cb8d
test ebx, ebx
je 0x51cb83
cmp byte [ebx], 0
je 0x51cb83
push str.No_authentication_method_was_acceptable.
jmp 0x51cf31
push str.No_authentication_method_was_acceptable.__It_is_quite_likely_that_the_SOCKS5_server_wanted_a_username_password__since_none_was_supplied_to_the_server_on_this_connection._
jmp 0x51cf31
push str.Undocumented_SOCKS5_mode_attempted_to_be_used_by_server.
jmp 0x51cf31
cmp dword [ebp - 0x274], 0
push 3
mov word [ebp - 0x260], 0x105
pop ebx
mov byte [ebp - 0x25e], 0
jne 0x51cbe3
mov byte [ebp - 0x25d], bl
lea eax, [ebp - 0x25b]
mov ebx, dword [ebp - 0x284]
push ebx
push dword [ebp - 0x27c]
mov byte [ebp - 0x25c], bl
push eax
call sub.MSVCR120.dll_memcpy
add esp, 0xc
add ebx, 5
jmp 0x51ccbb
mov edx, dword [ebp - 0x27c]
lea eax, [ebp - 0x274]
push eax
push dword [ebp + 0xc]
mov ecx, edi
call fcn.005102fc
pop ecx
pop ecx
cmp eax, 0xffffffff
jne 0x51cc08
push 6
jmp 0x51cf3b
cmp eax, 1
jne 0x51cc22
lea edx, [ebp - 0x274]
mov ecx, edi
call fcn.005109d5
test eax, eax
jne 0x51cf3c
mov eax, dword [ebp - 0x274]
test eax, eax
je 0x51cf0c
mov eax, dword [eax]
mov dword [ebp - 0x278], eax
test eax, eax
je 0x51cf0c
cmp dword [eax + 4], 2
jne 0x51cc9a
mov byte [ebp - 0x25d], 1
lea ecx, [ebp - 0x25d]
mov edi, dword [eax + 0x18]
lea eax, [ebp - 0x25c]
push 4
pop ebx
sub edi, eax
lea eax, [ebx + edi]
mov al, byte [ebp + eax - 0x25c]
mov byte [ebp + ebx - 0x260], al
inc ebx
movzx eax, byte [ebx + ecx - 4]
push eax
push 0x59c4d8
push esi
call fcn.00510c4e
add esp, 0xc
lea ecx, [ebp - 0x25d]
cmp ebx, 8
jl 0x51cc61
mov edi, dword [ebp - 0x280]
jmp 0x51cca1
and dword [ebp - 0x278], 0
mov edx, dword [ebp - 0x274]
mov ecx, esi
call fcn.0051045b
cmp dword [ebp - 0x278], 0
je 0x51cf0c
mov ecx, dword [ebp + 0xc]
mov eax, ecx
mov edx, dword [ebp - 0x264]
sar eax, 8
mov byte [ebp + ebx - 0x260], al
lea eax, [ebp - 0x26c]
mov byte [ebp + ebx - 0x25f], cl
add ebx, 2
push eax
lea eax, [ebp - 0x260]
mov ecx, edi
push ebx
push eax
call fcn.00510edf
add esp, 0xc
test eax, eax
jne 0x51cf05
cmp ebx, dword [ebp - 0x26c]
jne 0x51cf05
mov edx, dword [ebp - 0x264]
lea eax, [ebp - 0x270]
push eax
lea eax, [ebp - 0x260]
mov ecx, edi
push 0xa
push eax
call fcn.0051c27c
add esp, 0xc
test eax, eax
jne 0x51ced8
cmp dword [ebp - 0x270], 0xa
jne 0x51ced8
cmp byte [ebp - 0x260], 5
je 0x51cd4f
push str.SOCKS5_reply_has_wrong_version__version_should_be_5.
jmp 0x51cf31
mov bl, byte [ebp - 0x25f]
mov al, byte [ebp - 0x25d]
test bl, bl
je 0x51ce8e
cmp al, 1
jne 0x51cdb2
movzx ecx, byte [ebp - 0x258]
movzx eax, bl
push eax
movzx eax, byte [ebp - 0x257]
shl ecx, 8
or ecx, eax
movzx eax, byte [ebp - 0x259]
push ecx
push eax
movzx eax, byte [ebp - 0x25a]
push eax
movzx eax, byte [ebp - 0x25b]
push eax
movzx eax, byte [ebp - 0x25c]
push eax
push str.Cant_complete_SOCKS5_connection_to__d._d._d._d:_d.___d_
push esi
call fcn.00510cc2
add esp, 0x20
jmp 0x51cf39
cmp al, 3
jne 0x51cde7
movzx ecx, byte [ebp - 0x258]
movzx eax, bl
push eax
movzx eax, byte [ebp - 0x257]
shl ecx, 8
or ecx, eax
push ecx
push dword [ebp - 0x27c]
push str.Cant_complete_SOCKS5_connection_to__s:_d.___d_
push esi
call fcn.00510cc2
add esp, 0x14
jmp 0x51cf39
cmp al, 4
jne 0x51cf39
movzx edx, byte [ebp - 0x258]
movzx ecx, byte [ebp - 0x257]
movzx eax, bl
push eax
mov eax, edx
shl eax, 8
or eax, ecx
push eax
movzx eax, byte [ebp - 0x24d]
push eax
movzx eax, byte [ebp - 0x24e]
push eax
movzx eax, byte [ebp - 0x24f]
push eax
movzx eax, byte [ebp - 0x250]
push eax
movzx eax, byte [ebp - 0x251]
push eax
movzx eax, byte [ebp - 0x252]
push eax
movzx eax, byte [ebp - 0x253]
push eax
movzx eax, byte [ebp - 0x254]
push eax
movzx eax, byte [ebp - 0x255]
push eax
movzx eax, byte [ebp - 0x256]
push eax
movzx eax, byte [ebp - 0x259]
push ecx
push edx
push eax
movzx eax, byte [ebp - 0x25a]
push eax
movzx eax, byte [ebp - 0x25b]
push eax
movzx eax, byte [ebp - 0x25c]
push eax
push str.Cant_complete_SOCKS5_connection_to__02x_02x:_02x_02x:_02x_02x:_02x_02x:_02x_02x:_02x_02x:_02x_02x:_02x_02x:_d.___d_
push esi
call fcn.00510cc2
add esp, 0x50
jmp 0x51cf39
cmp al, 3
jne 0x51ce9e
movzx ebx, byte [ebp - 0x25c]
add ebx, 7
jmp 0x51cea5
cmp al, 4
jne 0x51cedf
push 0x16
pop ebx
cmp ebx, 0xa
jle 0x51cedf
mov edx, dword [ebp - 0x264]
lea eax, [ebp - 0x270]
push eax
sub ebx, 0xa
lea eax, [ebp - 0x256]
push ebx
push eax
mov ecx, edi
call fcn.0051c27c
add esp, 0xc
test eax, eax
jne 0x51ced8
cmp ebx, dword [ebp - 0x270]
je 0x51cedf
push str.Failed_to_receive_SOCKS5_connect_request_ack.
jmp 0x51cf31
lea eax, [ebp - 0x280]
mov dword [ebp - 0x280], 1
push eax
push 0x8004667e
push dword [ebp - 0x264]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
xor eax, eax
jmp 0x51cf3c
push str.Failed_to_send_SOCKS5_connect_request.
jmp 0x51cf31
push dword [ebp - 0x27c]
push str.Failed_to_resolve___s__for_SOCKS5_connect.
push esi
call fcn.00510cc2
add esp, 0xc
jmp 0x51cc01
push str.Unable_to_receive_initial_SOCKS5_response.
jmp 0x51cf31
push str.Unable_to_send_initial_SOCKS5_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