Function at 0x405698
Capabilities:
Connect to http server
Create http request
Download and write a file
Parse url
Read data from internet
Receive and write data from server to client
Receive data
Send data
Send http request
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x887c
call fcn.0041c400
mov eax, dword [0x436504]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x14]
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
mov dword [ebp - 0x8828], eax
mov eax, dword [0x53a04c]
xor edi, edi
cmp eax, edi
mov esi, ecx
je 0x4056f6
push eax
push ebx
call fcn.004190c0
test eax, eax
pop ecx
pop ecx
je 0x4056f6
push ebx
push str._HttpDownloader____s__Skipping_for_debug_purposes._n
call fcn.004083fe
pop ecx
pop ecx
xor eax, eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00416e34
leave
ret
push ebx
push str._HttpDownloader____s___1__Starting_download..._n
call fcn.004083fe
cmp dword [ebp + 0x10], edi
pop ecx
pop ecx
mov dword [ebp - 0x881c], edi
push edi
je 0x405723
mov eax, dword [ebp - 0x8828]
cmp eax, edi
jne 0x40571c
mov eax, dword [esi + 0x18]
push dword [eax + 4]
push dword [eax]
jmp 0x405725
push edi
push edi
push dword [ebp + 0xc]
push str.JWrapperDownloader
call dword [sym.imp.WININET.dll_InternetOpenA]
cmp eax, edi
mov dword [ebp - 0x8810], eax
push ebx
jne 0x405757
push str._HttpDownloader____s__Unable_initialise_HTTP_connection_n
call fcn.004083fe
push str.InternetOpen
call fcn.004053dc
add esp, 0xc
jmp 0x4056e5
push str._HttpDownloader____s__Attempting_to_crack_URL_n
call fcn.004083fe
push 0x3c
lea eax, [ebp - 0x887c]
push edi
push eax
call fcn.00418dc0
xor eax, eax
inc eax
add esp, 0x14
mov dword [ebp - 0x8868], eax
mov dword [ebp - 0x884c], eax
lea eax, [ebp - 0x887c]
push eax
push edi
push edi
push dword [esi + 0x10]
mov dword [ebp - 0x887c], 0x3c
call dword [sym.imp.WININET.dll_InternetCrackUrlA]
push eax
push ebx
push str._HttpDownloader____s__Crack_result_is__d_n
mov dword [ebp - 0x8820], eax
call fcn.004083fe
add esp, 0xc
cmp dword [ebp - 0x8820], edi
je 0x4058cf
push 0x400
lea eax, [ebp - 0x808]
push edi
push eax
call fcn.00418dc0
add esp, 0xc
push 0x400
lea eax, [ebp - 0x408]
push edi
push eax
call fcn.00418dc0
add esp, 0xc
cmp dword [ebp - 0x8868], edi
jbe 0x40580c
push dword [ebp - 0x8868]
lea eax, [ebp - 0x808]
push dword [ebp - 0x886c]
push eax
call fcn.00418b10
add esp, 0xc
cmp dword [ebp - 0x884c], edi
jbe 0x40582f
push dword [ebp - 0x884c]
lea eax, [ebp - 0x408]
push dword [ebp - 0x8850]
push eax
call fcn.00418b10
add esp, 0xc
lea eax, [ebp - 0x808]
push eax
push str._HttpDownloader__Hostname___s_n
call fcn.004083fe
movzx eax, word [ebp - 0x8864]
push eax
push str._HttpDownloader__nPort___d_n
call fcn.004083fe
lea eax, [ebp - 0x408]
push eax
push str._HttpDownloader__lpszUrlPath___s_n
call fcn.004083fe
add esp, 0x18
push edi
push edi
push 3
push edi
push edi
push dword [ebp - 0x8864]
lea eax, [ebp - 0x808]
push eax
push dword [ebp - 0x8810]
call dword [sym.imp.WININET.dll_InternetConnectA]
cmp eax, edi
mov dword [ebp - 0x881c], eax
jne 0x4058b1
push str.InternetConnect
call fcn.004053dc
pop ecx
push dword [ebp - 0x881c]
push edi
mov edi, dword [ebp - 0x8810]
call fcn.00405558
jmp 0x4056e3
push edi
push 0x400000
push edi
push edi
push edi
lea ecx, [ebp - 0x408]
push ecx
push 0x432c8c
push eax
call dword [sym.imp.WININET.dll_HttpOpenRequestA]
jmp 0x4058f1
push str.CrackURL
call fcn.004053dc
pop ecx
push edi
push 0x400800
push edi
push edi
push dword [esi + 0x10]
push dword [ebp - 0x8810]
call dword [sym.imp.WININET.dll_InternetOpenUrlA]
cmp eax, edi
mov dword [ebp - 0x880c], eax
jne 0x405902
push str.HttpOpenRequest_InternetOpenUrl
jmp 0x405894
push ebx
push str._HttpDownloader____s___3__Starting_download..._n
call fcn.004083fe
pop ecx
pop ecx
push edi
push edi
push edi
push edi
push dword [ebp - 0x880c]
call dword [sym.imp.WININET.dll_HttpSendRequestA]
push dword [ebp - 0x880c]
call fcn.004054c0
mov dword [ebp - 0x8818], eax
pop ecx
lea eax, [ebp - 0x8838]
push eax
call fcn.0041a8a1
pop ecx
push ebx
push str._HttpDownloader____s___4__Starting_download..._n
call fcn.004083fe
cmp dword [ebp - 0x8818], 0x197
pop ecx
pop ecx
mov dword [ebp - 0x8814], edi
jne 0x405a20
cmp dword [ebp - 0x8814], edi
jne 0x405987
push 0xffffffffffffffff
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp dword [esi + 0xc], edi
mov dword [ebp - 0x8814], 1
jne 0x405a75
push dword [ebp - 0x8818]
push ebx
push str._HttpDownloader____s__Status_code_is__d_n
call fcn.004083fe
add esp, 0xc
push edi
push 7
push 0x2eee
push dword [ebp - 0x880c]
call dword [sym.imp.USER32.dll_GetDesktopWindow]
push eax
call dword [sym.imp.WININET.dll_InternetErrorDlg]
push eax
push ebx
push str._HttpDownloader____s__InternetErrorDlg_return_code_is__d_n
mov dword [ebp - 0x8820], eax
call fcn.004083fe
add esp, 0xc
cmp dword [ebp - 0x8820], 0x2f00
jne 0x405aa8
push edi
push edi
push edi
push edi
push dword [ebp - 0x880c]
call dword [sym.imp.WININET.dll_HttpSendRequestA]
push dword [ebp - 0x880c]
call fcn.004054c0
cmp eax, 0x197
pop ecx
mov dword [ebp - 0x8818], eax
je 0x405961
cmp dword [ebp - 0x8814], edi
je 0x405a20
push dword [esi + 4]
mov dword [esi + 0xc], 1
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push ebx
push str._HttpDownloader____s__Connection_setup__querying_length_n
call fcn.004083fe
push dword [ebp - 0x880c]
call fcn.004054fd
add esp, 0xc
cmp eax, 0xffffffff
mov dword [ebp - 0x8814], eax
mov dword [ebp - 0x8830], edi
mov dword [ebp - 0x882c], edi
je 0x405ae2
push eax
push ebx
push str._HttpDownloader____s__Required_file_size_is__d_n
mov dword [ebp - 0x882c], 1
mov dword [ebp - 0x8830], eax
call fcn.004083fe
add esp, 0xc
jmp 0x405aef
push ebx
push str._HttpDownloader____s__Proxy_thread_returning_as_another_has_connected_to_the_proxy_n
call fcn.004083fe
push dword [ebp - 0x881c]
mov edi, dword [ebp - 0x8810]
push dword [ebp - 0x880c]
call fcn.00405558
add esp, 0x10
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
jmp 0x4056e5
push dword [esi + 4]
mov dword [esi + 0xc], 1
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push ebx
push str._HttpDownloader____s__Could_not_get_proxy_credentials._n
call fcn.004083fe
push dword [ebp - 0x881c]
mov edi, dword [ebp - 0x8810]
push dword [ebp - 0x880c]
call fcn.00405558
add esp, 0x10
jmp 0x4056e5
push ebx
push str._HttpDownloader____s__Required_file_size_is_unknown__n
call fcn.004083fe
pop ecx
pop ecx
push 0x8000
lea eax, [ebp - 0x8808]
push edi
push eax
mov dword [ebp - 0x8818], edi
call fcn.00418dc0
lea eax, [ebp - 0x8840]
add esp, 0xc
push eax
call fcn.0041a8a1
cmp dword [ebp - 0x882c], edi
pop ecx
mov dword [ebp - 0x8820], edi
je 0x405b31
cmp dword [ebp - 0x8814], edi
je 0x405e2c
push ebx
push str._HttpDownloader____s__Looping..._n
call fcn.004083fe
cmp dword [ebp - 0x882c], edi
pop ecx
pop ecx
je 0x405b5e
mov eax, dword [ebp - 0x8814]
imul eax, eax, 0x64
cdq
idiv dword [ebp - 0x8830]
push 0x64
pop ecx
sub ecx, eax
push ecx
jmp 0x405b60
push 0xffffffffffffffff
call fcn.00407991
lea eax, [ebp - 0x8824]
push eax
push 0x8000
lea eax, [ebp - 0x8808]
push eax
push dword [ebp - 0x880c]
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
je 0x405e10
push dword [ebp - 0x8824]
push ebx
push str._HttpDownloader____s__Read__d..._n
call fcn.004083fe
mov eax, dword [ebp - 0x8824]
sub dword [ebp - 0x8814], eax
add esp, 0xc
cmp eax, edi
jbe 0x405d53
cmp dword [ebp - 0x8818], edi
jne 0x405d34
push 0xffffffffffffffff
push dword [esi]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push ebx
push str._HttpDownloader____s__OutputFile_needs_initialising._n
call fcn.004083fe
cmp dword [esi + 8], edi
pop ecx
pop ecx
jne 0x405db8
push 0x432f78
push dword [esi + 0x14]
lea eax, [ebp - 0x8818]
push eax
call fcn.00418abc
add esp, 0xc
test eax, eax
jne 0x405de4
inc eax
push eax
push ebx
push str._HttpDownloader____s__Opened_file._Set_downloadWorked_to_TRUE___d__n
mov dword [esi + 8], eax
call fcn.004083fe
add esp, 0xc
cmp dword [ebp + 0x10], edi
push ebx
je 0x405caf
push str._HttpDownloader____s__Copying_proxy_settings._n
call fcn.004083fe
cmp dword [0x539fe4], edi
pop ecx
pop ecx
push ebx
je 0x405c41
push str._HttpDownloader____s__Proxy_settings_exist_already._n
call fcn.004083fe
pop ecx
jmp 0x405d1e
push str._HttpDownloader____s__No_existing_proxy_settings_found._n
call fcn.004083fe
push 8
call fcn.00416f20
add esp, 0xc
push 8
push edi
push eax
mov dword [0x539fe4], eax
call fcn.00418dc0
add esp, 0xc
cmp dword [ebp - 0x8828], edi
push ebx
jne 0x405c8c
push str._HttpDownloader____s__Copying_proxy_settings._n
call fcn.004083fe
mov eax, dword [esi + 0x18]
pop ecx
pop ecx
mov ecx, dword [eax]
mov eax, dword [0x539fe4]
mov dword [eax], ecx
mov ecx, dword [esi + 0x18]
jmp 0x405ca7
push str._HttpDownloader____s__Using_override_proxy_settings._n
call fcn.004083fe
mov eax, dword [0x539fe4]
pop ecx
pop ecx
mov ecx, dword [ebp - 0x8828]
mov edx, dword [ecx]
mov dword [eax], edx
mov ecx, dword [ecx + 4]
mov dword [eax + 4], ecx
jmp 0x405d1f
push str._HttpDownloader____s__No_proxy_settings_detected._n
call fcn.004083fe
push str.Proxy_Non_Auto
push ebx
call fcn.004190c0
add esp, 0x10
test eax, eax
jne 0x405d13
cmp dword [0x539fe4], edi
jne 0x405d13
cmp dword [esi + 0x18], edi
je 0x405d13
push ebx
push str._HttpDownloader____s___Special_Case__No_existing_proxy_settings_found._n
call fcn.004083fe
push 8
call fcn.00416f20
add esp, 0xc
push 8
push edi
push eax
mov dword [0x539fe4], eax
call fcn.00418dc0
mov eax, dword [esi + 0x18]
mov ecx, dword [eax]
mov eax, dword [0x539fe4]
mov dword [eax], ecx
mov ecx, dword [esi + 0x18]
mov ecx, dword [ecx + 4]
add esp, 0xc
mov dword [eax + 4], ecx
push dword [ebp - 0x8810]
call fcn.0040557c
pop ecx
push dword [esi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push ebx
push str._HttpDownloader____s__Starting_to_write_data_to_file..._n
call fcn.004083fe
pop ecx
pop ecx
push dword [ebp - 0x8818]
lea eax, [ebp - 0x8808]
push dword [ebp - 0x8824]
push 1
push eax
call fcn.00419e5c
add esp, 0x10
jmp 0x405d6a
push ebx
push str._HttpDownloader____s__Read_0_bytes_so_finishing._n
call fcn.004083fe
pop ecx
pop ecx
mov dword [ebp - 0x8820], 1
cmp dword [ebp - 0x8820], edi
je 0x405b31
cmp dword [ebp - 0x8814], edi
jle 0x405e2c
push dword [ebp - 0x8814]
push ebx
push str._HttpDownloader____s__Warning:_download_complete_but_required_length_is_still__d._n
call fcn.004083fe
add esp, 0xc
xor esi, esi
push dword [ebp - 0x881c]
mov edi, dword [ebp - 0x8810]
push dword [ebp - 0x880c]
call fcn.00405558
pop ecx
pop ecx
mov eax, esi
jmp 0x4056e7
push ebx
push str._HttpDownloader____s__Thread_returning_as_another_has_worked_n
call fcn.004083fe
push dword [ebp - 0x881c]
mov edi, dword [ebp - 0x8810]
push dword [ebp - 0x880c]
call fcn.00405558
add esp, 0x10
push dword [esi]
jmp 0x405a9d
push dword [esi + 0x14]
push ebx
push str._Error____s__The_file__s_was_not_opened_n
call fcn.004083fe
mov edi, dword [ebp - 0x8810]
add esp, 0xc
push dword [ebp - 0x881c]
push dword [ebp - 0x880c]
call fcn.00405558
pop ecx
pop ecx
jmp 0x405ddd
push 0x4331c8
call fcn.004053dc
pop ecx
push dword [ebp - 0x881c]
push dword [ebp - 0x880c]
jmp 0x4058a1
lea eax, [ebp - 0x8838]
push eax
call fcn.0041a8a1
cmp dword [ebp - 0x8818], edi
pop ecx
je 0x405e8c
push dword [ebp - 0x883c]
push dword [ebp - 0x8840]
push dword [ebp - 0x8834]
push dword [ebp - 0x8838]
call fcn.0041af33
pop ecx
pop ecx
fstp qword [esp]
push ebx
push str._HttpDownloader____s__Closing_file...__download_took__lf__n
call fcn.004083fe
push dword [ebp - 0x8818]
call fcn.0041a825
add esp, 0x14
push 0x64
call fcn.00407991
push dword [esi + 0x20]
call dword [sym.imp.KERNEL32.dll_SetEvent]
xor esi, esi
inc esi
jmp 0x405d98