Function at 0x401660
Capabilities:
Check internet connectivity via wininet
Create http request
Download and write a file
Get http content length
Read data from internet
Receive and write data from server to client
Receive data
Write file on windows

Disassembly:
mov eax, 0x1006c
call fcn.00402b00
push ebx
push ebp
push esi
xor ebx, ebx
push edi
lea eax, [esp + 0x20]
push ebx
push eax
call dword [sym.imp.WININET.dll_InternetGetConnectedState]
test eax, eax
jne 0x40168d
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1006c
ret 8
mov ecx, dword [str.Agent]
mov dx, word [0x4042dc]
mov dword [esp + 0x24], ecx
mov word [esp + 0x28], dx
call dword [sym.imp.WINMM.dll_timeGetTime]
push eax
lea eax, [esp + 0x28]
push eax
lea ecx, [esp + 0x44]
push str._s_ld
push ecx
call dword [sym.imp.MSVCRT.dll_sprintf]
mov al, byte [esp + 0x30]
add esp, 0x10
test al, 4
push ebx
push ebx
push ebx
jne 0x4016e2
lea edx, [esp + 0x48]
push 4
push edx
call dword [sym.imp.WININET.dll_InternetOpenA]
mov ebp, eax
mov dword [esp + 0x10], ebp
jmp 0x4016f4
lea eax, [esp + 0x48]
push ebx
push eax
call dword [sym.imp.WININET.dll_InternetOpenA]
mov dword [esp + 0x10], eax
mov ebp, eax
cmp ebp, ebx
jne 0x401707
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1006c
ret 8
mov ecx, dword [str.Accept:___r_n_r_n]
mov eax, dword [0x4042c8]
mov edx, dword [0x4042c4]
mov dword [esp + 0x2c], ecx
mov ecx, dword [0x4042cc]
mov dword [esp + 0x34], eax
mov dword [esp + 0x38], ecx
lea edi, [esp + 0x2c]
or ecx, 0xffffffff
xor eax, eax
mov dword [esp + 0x30], edx
push ebx
repne scasb al, byte es:[edi]
mov eax, dword [esp + 0x10084]
push 0x84000100
not ecx
dec ecx
lea edx, [esp + 0x34]
push ecx
push edx
push eax
push ebp
call dword [sym.imp.WININET.dll_InternetOpenUrlA]
mov esi, eax
cmp esi, ebx
jne 0x40176c
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1006c
ret 8
mov ecx, dword [esp + 0x10084]
push 0x40428c
push ecx
call dword [sym.imp.MSVCRT.dll_fopen]
mov edi, eax
add esp, 8
cmp edi, ebx
jne 0x401797
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1006c
ret 8
lea edx, [esp + 0x1c]
push ebx
lea eax, [esp + 0x18]
push edx
push eax
push 0x20000005
push esi
mov dword [esp + 0x28], ebx
mov dword [esp + 0x30], 4
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
test eax, eax
jne 0x4017c2
mov dword [esp + 0x14], ebx
mov ebx, dword [sym.imp.WININET.dll_InternetReadFile]
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x80]
push 0x4000
push edx
push esi
call ebx
test eax, eax
je 0x40181a
mov ebp, dword [sym.imp.MSVCRT.dll_fwrite]
mov eax, dword [esp + 0x18]
push edi
test eax, eax
je 0x40183a
push 1
push eax
lea eax, [esp + 0x88]
push eax
call ebp
add esp, 0x10
lea ecx, [esp + 0x18]
lea edx, [esp + 0x7c]
push ecx
push 0x4000
push edx
push esi
call ebx
test eax, eax
jne 0x4017e7
mov ebp, dword [esp + 0x10]
push ebp
call dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1006c
ret 8
call dword [sym.imp.MSVCRT.dll_fclose]
mov eax, dword [esp + 0x14]
add esp, 4
push eax
call dword [sym.imp.WININET.dll_InternetCloseHandle]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x1006c
ret 8