Function at 0x4060c0
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Create tcp socket
Initialize winsock library
Resolve dns
Send data
Send data on socket
Set socket configuration
Terminate process

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c4
mov eax, dword [0x42c004]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x100000
mov edi, ecx
mov dword [ebp - 0x1b8], 0
mov dword [ebp - 0x1b4], 0
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov esi, eax
add esp, 4
test esi, esi
jne 0x406126
push str.fdr_handle_proxy_cmd
push str.ERROR:__s:_malloc_failed_n
call fcn.004035a0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x1b4]
push eax
push 0x100000
push esi
push dword [edi]
call dword [sym.imp.imobiledevice.dll_idevice_connection_receive]
add esp, 0x10
test eax, eax
je 0x40616e
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
push edi
push str.ERROR:_FDR__p_failed_to_read_data_for_proxy_command_n
call fcn.004035a0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push dword [ebp - 0x1b4]
push str.Got_proxy_command_with__u_bytes_n
call fcn.00403610
mov ebx, dword [sym.imp.imobiledevice.dll_idevice_connection_send]
lea eax, [ebp - 0x1b8]
push eax
push 2
lea eax, [ebp - 0xc]
mov dword [ebp - 0xc], 5
push eax
push dword [edi]
call ebx
add esp, 0x18
test eax, eax
jne 0x406692
cmp dword [ebp - 0x1b8], 2
jne 0x406692
mov eax, dword [ebp - 0x1b4]
cmp eax, 3
jae 0x4061e5
push edi
push str.FDR__p_proxy_command_data_too_short__retrying_n
call fcn.00403610
add esp, 8
mov ecx, edi
call fcn.00405370
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
lea ecx, [ebp - 0x1b8]
push ecx
push eax
push esi
push dword [edi]
call ebx
add esp, 0x10
test eax, eax
jne 0x406674
mov edx, dword [ebp - 0x1b4]
cmp dword [ebp - 0x1b8], edx
jne 0x406674
cmp byte [esi], al
jne 0x406657
cmp byte [esi + 1], 3
jne 0x406657
mov ax, word [edx + esi - 2]
movzx ecx, byte [edx + esi - 1]
shl ax, 8
or cx, ax
mov byte [edx + esi - 2], 0
movzx eax, cx
mov dword [ebp - 0x1bc], eax
lea eax, [esi + 3]
push eax
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__strdup]
add esp, 4
mov ebx, eax
mov eax, dword [ebp - 0x1bc]
movzx ecx, ax
push ecx
push ebx
push edi
push str.FDR__p_Proxy_connect_request_to__s:_u_n
call fcn.00403610
add esp, 0x10
test ebx, ebx
je 0x406657
cmp byte [esi + 2], 0
je 0x406657
cmp dword [0x42ca8c], 0
mov dword [ebp - 0x10], 1
jne 0x4062cb
lea eax, [ebp - 0x1b0]
push eax
push 0x202
call dword [sym.imp.WS2_32.dll_WSAStartup]
test eax, eax
je 0x4062c1
push str.WSAStartup_failed__n
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00406e70
add esp, 8
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov dword [0x42ca8c], 1
push ebx
call dword [sym.imp.WS2_32.dll_gethostbyname]
mov dword [ebp - 8], eax
test eax, eax
jne 0x40630a
cmp dword [0x42c754], 2
jl 0x4063e6
push ebx
push str.socket_connect
push str._s:_unknown_host__s_n
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00406e70
add esp, 0x10
jmp 0x4063e6
mov eax, dword [eax + 0xc]
cmp dword [eax], 0
jne 0x406342
cmp dword [0x42c754], 2
jl 0x4063e6
push str.socket_connect
push str._s:_gethostbyname_returned_NULL_address__n
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00406e70
add esp, 0xc
jmp 0x4063e6
push 6
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov dword [ebp - 0x1c0], eax
test eax, eax
jns 0x406368
push str.socket__
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
add esp, 4
jmp 0x4063e6
push 4
lea ecx, [ebp - 0x10]
push ecx
push 4
push 0xffff
push eax
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp eax, 0xffffffff
jne 0x406388
push str.setsockopt__
jmp 0x4063d1
push dword [ebp - 0x1bc]
mov eax, 2
xorps xmm0, xmm0
mov word [ebp - 0x20], ax
mov eax, dword [ebp - 8]
movlpd qword [ebp - 0x18], xmm0
mov eax, dword [eax + 0xc]
mov eax, dword [eax]
mov eax, dword [eax]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.WS2_32.dll_htons]
mov word [ebp - 0x1e], ax
lea eax, [ebp - 0x20]
push 0x10
push eax
push dword [ebp - 0x1c0]
call dword [sym.imp.WS2_32.dll_connect]
test eax, eax
jns 0x40642b
push str.connect
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
add esp, 4
push dword [ebp - 0x1c0]
call dword [sym.imp.WS2_32.dll_closesocket]
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
push ebx
call edi
add esp, 4
push esi
call edi
add esp, 4
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [eax]
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
add esp, 4
push eax
push str.ERROR:_Failed_to_connect_socket:__s_n
call fcn.004035a0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push ebx
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
mov dword [ebp - 0x1bc], 0
nop
push 0x64
lea eax, [ebp - 0x1b4]
mov dword [ebp - 0x1b4], 0
push eax
push 0x100000
push esi
push dword [edi]
call dword [sym.imp.imobiledevice.dll_idevice_connection_receive_timeout]
mov ebx, eax
add esp, 0x14
test ebx, ebx
jne 0x406611
mov ecx, dword [ebp - 0x1b4]
test ecx, ecx
je 0x4064f2
push ecx
push edi
push str.FDR__p_got_payload_of__u_bytes__now_try_to_proxy_it_n
call fcn.00403610
add esp, 0xc
push dword [ebp - 0x1b4]
push str.Sending__u_bytes_of_data_n
call fcn.00403610
mov ecx, dword [ebp - 0x1b4]
xor eax, eax
add esp, 8
mov dword [ebp - 0x1b8], eax
test ecx, ecx
je 0x4064ea
nop dword [eax]
push 0
sub ecx, eax
add eax, esi
push ecx
push eax
push dword [ebp - 0x1c0]
call dword [sym.imp.WS2_32.dll_send]
mov ecx, eax
mov eax, dword [ebp - 0x1b8]
test ecx, ecx
js 0x4064e4
add eax, ecx
mov ecx, dword [ebp - 0x1b4]
mov dword [ebp - 0x1b8], eax
cmp eax, ecx
jb 0x4064b0
jmp 0x4064ea
mov ecx, dword [ebp - 0x1b4]
cmp eax, ecx
jne 0x4065a1
mov ecx, dword [ebp - 0x1c0]
sub esp, 0xc
mov edx, esi
call fcn.00419590
add esp, 0xc
test eax, eax
js 0x4065da
mov dword [ebp - 0x1b4], eax
je 0x406596
push 0x41fe42
push eax
push edi
push str.FDR__p_Received__u_bytes_reply_data__s_sending_to_device_n
call fcn.00403610
mov ecx, dword [ebp - 0x1b4]
xor eax, eax
add esp, 0x10
mov dword [ebp - 0x1b8], eax
xor edx, edx
test ecx, ecx
je 0x406578
lea eax, [ebp - 8]
sub ecx, edx
push eax
push ecx
lea eax, [edx + esi]
push eax
push dword [edi]
call dword [sym.imp.imobiledevice.dll_idevice_connection_send]
mov ecx, dword [ebp - 0x1b4]
mov ebx, eax
mov eax, dword [ebp - 0x1b8]
add esp, 0x10
test ebx, ebx
jne 0x406580
add eax, dword [ebp - 8]
mov dword [ebp - 0x1b8], eax
mov edx, eax
cmp eax, ecx
jb 0x406541
cmp ecx, edx
je 0x406440
push ecx
push eax
push ebx
push edi
push str.ERROR:_FDR__p_unable_to_send_data___d_._Sent__u_of__u_bytes._n
call fcn.004035a0
add esp, 0x14
jmp 0x406620
inc dword [0x42c964]
jmp 0x406440
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [ebp - 0x1b4]
push dword [ebp - 0x1b8]
push dword [eax]
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
add esp, 4
push eax
push str.ERROR:_Sending_proxy_payload_failed:__s._Sent__u_of__u_bytes.__n
call fcn.004035a0
add esp, 0x10
push dword [ebp - 0x1c0]
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x406620
mov ebx, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
call ebx
cmp dword [eax], 0
je 0x406605
call ebx
push dword [eax]
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
add esp, 4
push eax
push edi
push str.ERROR:_FDR__p_receiving_proxy_payload_failed:__s_n
call fcn.004035a0
add esp, 0xc
jmp 0x40662a
mov dword [ebp - 0x1bc], 1
jmp 0x40662a
push ebx
push edi
push str.ERROR:_FDR__p_Unable_to_receive_proxy_payload___d__n
call fcn.004035a0
add esp, 0xc
mov dword [ebp - 0x1bc], 0xffffffff
push dword [ebp - 0x1c0]
call dword [sym.imp.WS2_32.dll_closesocket]
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov eax, dword [ebp - 0x1bc]
add esp, 4
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
push dword [ebp - 0x1b4]
push dword [ebp - 0x1b8]
push edi
push str.ERROR:_FDR__p_unable_to_send_data._Sent__u_of__u_bytes._n
jmp 0x4066aa
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
push 2
push dword [ebp - 0x1b8]
push edi
push str.ERROR:_FDR__p_unable_to_send_ack._Sent__u_of__u_bytes._n
call fcn.004035a0
mov ecx, dword [ebp - 4]
add esp, 0x10
xor ecx, ebp
or eax, 0xffffffff
pop edi
pop esi
pop ebx
call fcn.0041c84a
mov esp, ebp
pop ebp
ret