Function at 0x406700
Capabilities:
Check http status code
Connect to http server
Create http request
Download and write a file
Get file size
Read data from internet
Receive and write data from server to client
Receive data
Send data
Send http request
Write file on windows

Disassembly:
mov eax, 0x10a4c
call fcn.0041e170
push ebx
push ebp
mov ebp, ecx
push edi
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x151]
mov byte [esp + 0x150], 0
rep stosd dword es:[edi], eax
mov ecx, 0x20
lea edi, [esp + 0x49]
mov byte [esp + 0x48], al
mov byte [esp + 0xcc], al
rep stosd dword es:[edi], eax
mov ecx, 0x20
lea edi, [esp + 0xcd]
rep stosd dword es:[edi], eax
mov ecx, 0x200
lea edi, [esp + 0x255]
mov byte [esp + 0x254], al
xor ebx, ebx
rep stosd dword es:[edi], eax
mov eax, dword [ebp + 0x14]
mov dword [esp + 0x28], ebx
cmp eax, ebx
mov dword [esp + 0x18], 0x2710
mov dword [esp + 0x40], 0x424074
mov dword [esp + 0x44], ebx
mov dword [esp + 0x10], 0xffffffff
mov dword [esp + 0x34], ebx
je 0x406af6
lea ecx, [esp + 0x28]
lea edx, [esp + 0xcc]
push ecx
lea ecx, [esp + 0x4c]
push edx
push ecx
lea edx, [esp + 0x260]
lea ecx, [esp + 0x15c]
push edx
push ecx
push eax
call fcn.0041d860
add esp, 0x18
test eax, eax
je 0x406af6
push ebx
push ebx
push ebx
push ebx
push 0x420488
call dword [sym.imp.WININET.dll_InternetOpenA]
mov edi, eax
cmp edi, ebx
mov dword [esp + 0x3c], edi
je 0x406acb
push esi
mov esi, dword [sym.imp.WININET.dll_InternetSetOptionA]
lea edx, [esp + 0x1c]
push 4
push edx
push 2
push edi
call esi
lea eax, [esp + 0x1c]
push 4
push eax
push 5
push edi
call esi
lea ecx, [esp + 0x1c]
push 4
push ecx
push 6
push edi
call esi
mov ecx, dword [esp + 0x2c]
push ebx
push ebx
lea edx, [esp + 0xd8]
push 3
lea eax, [esp + 0x58]
push edx
push eax
lea edx, [esp + 0x168]
push ecx
push edx
push edi
call dword [sym.imp.WININET.dll_InternetConnectA]
mov esi, eax
cmp esi, ebx
mov dword [esp + 0x3c], esi
je 0x406aac
push ebx
lea eax, [esp + 0x48]
push 0x80400200
push eax
push ebx
lea ecx, [esp + 0x268]
push ebx
push ecx
push 0x424070
push esi
call dword [sym.imp.WININET.dll_HttpOpenRequestA]
mov ebx, eax
xor eax, eax
cmp ebx, eax
mov dword [esp + 0x28], ebx
je 0x406aa3
push eax
push eax
push eax
push eax
push ebx
mov dword [esp + 0x44], eax
mov dword [esp + 0x38], eax
mov byte [esp + 0x27], al
call dword [sym.imp.WININET.dll_HttpSendRequestA]
test eax, eax
je 0x406a9c
lea edx, [esp + 0x30]
push edx
push 0x13
push ebx
call fcn.0041da70
add esp, 0xc
test eax, eax
je 0x406a9c
cmp dword [esp + 0x30], 0xc8
jne 0x406a9c
lea eax, [esp + 0x24]
push eax
push 5
push ebx
call fcn.0041da70
add esp, 0xc
test eax, eax
je 0x406a9c
mov eax, dword [esp + 0x24]
test eax, eax
je 0x406a9c
mov ecx, dword [ebp + 0x14]
push 0
push 0x80
push 2
mov dword [ecx + 0x244], eax
mov edx, dword [ebp + 0x14]
push 0
push 1
mov dword [edx + 0x248], 0
mov eax, dword [ebp + 0x14]
add eax, 0x140
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
mov dword [esp + 0x34], esi
je 0x406a98
xor eax, eax
mov ecx, 0x3fff
lea edi, [esp + 0xa5d]
mov dword [esp + 0x18], eax
mov dword [esp + 0x20], eax
mov byte [esp + 0xa5c], al
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x18]
lea edx, [esp + 0xa5c]
stosw word es:[edi], ax
push ecx
push 0x10000
push edx
push ebx
stosb byte es:[edi], al
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
je 0x406a8d
mov eax, dword [esp + 0x18]
test eax, eax
je 0x406a6e
mov cl, byte [ebp + 0xc]
test cl, cl
jne 0x406a6e
lea ecx, [esp + 0x20]
push 0
push ecx
lea edx, [esp + 0xa64]
push eax
push edx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x406a85
mov ecx, dword [esp + 0x20]
mov eax, dword [esp + 0x18]
cmp ecx, eax
jne 0x406a85
mov eax, dword [ebp + 0x14]
mov byte [esp + 0x13], 1
mov edx, dword [eax + 0x248]
add edx, ecx
mov dword [eax + 0x248], edx
mov esi, dword [ebp + 0x10]
test esi, esi
je 0x406a40
mov eax, dword [ebp + 0x14]
cmp dword [eax + 0x38c], 3
je 0x406a40
mov ecx, dword [esp + 0x20]
lea ebx, [esi + 8]
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
cmp dword [esi], 0
je 0x406a3c
mov edi, dword [ebp + 0x14]
mov eax, dword [edi + 0x244]
test eax, eax
mov dword [esp + 0x14], eax
jle 0x406a0f
fild dword [edi + 0x248]
fidiv dword [esp + 0x14]
fmul qword [0x420500]
call sub.MSVCRT.dll__ftol
mov dword [esp + 0x38], eax
mov edx, dword [esp + 0x38]
mov eax, dword [edi + 0x390]
mov edi, dword [sym.imp.USER32.dll_PostMessageA]
push edx
push eax
mov eax, dword [esi]
push 0x4cc
push eax
call edi
mov ecx, dword [esi + 4]
mov edx, dword [ebx]
mov eax, dword [esi]
push ecx
push edx
push 0x4ee
push eax
call edi
mov ebx, dword [esp + 0x28]
lea ecx, [esp + 0x18]
lea edx, [esp + 0xa5c]
push ecx
push 0x10000
push edx
push ebx
mov dword [esp + 0x24], 0
call dword [sym.imp.WININET.dll_InternetReadFile]
mov esi, dword [esp + 0x34]
test eax, eax
je 0x406a76
jmp 0x406962
mov al, byte [esp + 0x13]
test al, al
je 0x406a8d
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, dword [esp + 0x24]
je 0x406a8d
mov dword [esp + 0x14], 0xfffffffe
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edi, dword [esp + 0x40]
mov esi, dword [esp + 0x3c]
push ebx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
push esi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
xor ebx, ebx
push edi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
mov eax, dword [esp + 0x14]
pop esi
cmp eax, ebx
jne 0x406acb
mov eax, dword [ebp + 0x14]
mov dword [eax + 0x394], 2
jmp 0x406ad8
mov ecx, dword [ebp + 0x14]
mov dword [ecx + 0x394], 3
mov eax, dword [ebp + 0x10]
cmp eax, ebx
je 0x406af6
mov eax, dword [eax]
cmp eax, ebx
je 0x406af6
mov edx, dword [ebp + 0x14]
push edx
push ebx
push 0x4dd
push eax
call dword [sym.imp.USER32.dll_SendMessageA]
pop edi
pop ebp
pop ebx
add esp, 0x10a4c
ret