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

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x54e75b
mov eax, dword fs:[0]
push eax
mov eax, 0x1370
call fcn.005380d0
mov eax, dword [0x5afec0]
xor eax, ebp
mov dword [ebp - 0x10], eax
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 4], 1
mov dword [ebp - 0x12f4], 0
push 0x55fdd9
lea eax, [ebp + 8]
push eax
call fcn.004041d0
add esp, 8
movzx ecx, al
test ecx, ecx
jne 0x4058e0
push 0x55fdd9
lea edx, [ebp + 0x20]
push edx
call fcn.004041d0
add esp, 8
movzx eax, al
test eax, eax
je 0x405910
mov dword [ebp - 0x1328], 0
mov byte [ebp - 4], 0
lea ecx, [ebp + 8]
call fcn.00403300
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp + 0x20]
call fcn.00403300
mov eax, dword [ebp - 0x1328]
jmp 0x405f18
push 0x55fdd9
lea ecx, [ebp - 0x12f0]
call fcn.00403290
mov byte [ebp - 4], 2
mov dword [ebp - 0x1304], 0
mov dword [ebp - 0x12fc], 0
mov dword [ebp - 0x130c], 0
mov dword [ebp - 0x1310], 0
mov dword [ebp - 0x1308], 0
mov dword [ebp - 0x12f8], 0
mov dword [ebp - 0x1320], 0xa
mov dword [ebp - 0x1300], 0
mov dword [ebp - 0x1314], 0
mov dword [ebp - 0x1338], 0
mov byte [ebp - 0x290], 0
push 0x7f
push 0
lea ecx, [ebp - 0x28f]
push ecx
call fcn.005370a0
add esp, 0xc
mov dword [ebp - 0x137c], 0x80
mov dword [ebp - 0x1378], 0
mov dword [ebp - 0x1318], 0
mov dword [ebp - 0x1324], 4
mov byte [ebp - 0x210], 0
push 0xff
push 0
lea edx, [ebp - 0x20f]
push edx
call fcn.005370a0
add esp, 0xc
mov byte [ebp - 0x90], 0
push 0x7f
push 0
lea eax, [ebp - 0x8f]
push eax
call fcn.005370a0
add esp, 0xc
mov byte [ebp - 0x110], 0
push 0x7f
push 0
lea ecx, [ebp - 0x10f]
push ecx
call fcn.005370a0
add esp, 0xc
mov byte [ebp - 0x12d8], 0
push 0x823
push 0
lea edx, [ebp - 0x12d7]
push edx
call fcn.005370a0
add esp, 0xc
mov byte [ebp - 0xab4], 0
push 0x823
push 0
lea eax, [ebp - 0xab3]
push eax
call fcn.005370a0
add esp, 0xc
mov dword [ebp - 0x1374], 0
push 0x38
push 0
lea ecx, [ebp - 0x1370]
push ecx
call fcn.005370a0
add esp, 0xc
mov dword [ebp - 0x1374], 0x3c
lea edx, [ebp - 0x210]
mov dword [ebp - 0x1364], edx
mov dword [ebp - 0x1360], 0x100
lea eax, [ebp - 0x90]
mov dword [ebp - 0x1358], eax
mov dword [ebp - 0x1354], 0x80
lea ecx, [ebp - 0x110]
mov dword [ebp - 0x1350], ecx
mov dword [ebp - 0x134c], 0x80
lea edx, [ebp - 0x12d8]
mov dword [ebp - 0x1348], edx
mov dword [ebp - 0x1344], 0x824
lea eax, [ebp - 0x1374]
push eax
push 0
push 0
lea ecx, [ebp + 8]
call fcn.004086a0
push eax
call dword [sym.imp.WININET.dll_InternetCrackUrlA]
mov dword [ebp - 0x12f4], eax
cmp dword [ebp - 0x12f4], 0
je 0x405b12
cmp dword [ebp - 0x1368], 3
jne 0x405b12
mov dword [ebp - 0x131c], 1
jmp 0x405b1c
mov dword [ebp - 0x131c], 0
mov ecx, dword [ebp - 0x131c]
mov dword [ebp - 0x12f4], ecx
cmp dword [ebp - 0x12f4], 0
jne 0x405b36
jmp 0x405e4a
push 0
push 0
push 0
push 0
push str.down
call dword [sym.imp.WININET.dll_InternetOpenA]
mov dword [ebp - 0x1304], eax
cmp dword [ebp - 0x1304], 0
jne 0x405b67
mov dword [ebp - 0x12f4], 0
jmp 0x405e4a
push 0
push 0
push 3
lea edx, [ebp - 0x110]
push edx
lea eax, [ebp - 0x90]
push eax
movzx ecx, word [ebp - 0x135c]
push ecx
lea edx, [ebp - 0x210]
push edx
mov eax, dword [ebp - 0x1304]
push eax
call dword [sym.imp.WININET.dll_InternetConnectA]
mov dword [ebp - 0x12fc], eax
cmp dword [ebp - 0x12fc], 0
jne 0x405bb5
mov dword [ebp - 0x12f4], 0
jmp 0x405e4a
cmp dword [ebp - 0x1344], 0
je 0x405bd6
mov ecx, dword [ebp - 0x1348]
push ecx
lea edx, [ebp - 0xab4]
push edx
call fcn.00537e10
add esp, 8
jmp 0x405bea
push 0x55ff44
lea eax, [ebp - 0xab4]
push eax
call fcn.00537e10
add esp, 8
push 0
push 0x80200000
push 0
push 0x55fdd9
push str.HTTP_1.1
lea ecx, [ebp - 0xab4]
push ecx
push str.HEAD
mov edx, dword [ebp - 0x12fc]
push edx
call dword [sym.imp.WININET.dll_HttpOpenRequestA]
mov dword [ebp - 0x130c], eax
mov eax, dword [ebp - 0x1320]
push eax
mov ecx, dword [ebp - 0x130c]
push ecx
call fcn.004082f0
add esp, 8
mov dword [ebp - 0x12f4], eax
cmp dword [ebp - 0x12f4], 0
jne 0x405c46
jmp 0x405e4a
mov dword [ebp - 0x1318], 0
mov dword [ebp - 0x1324], 4
push 0
lea edx, [ebp - 0x1324]
push edx
lea eax, [ebp - 0x1318]
push eax
push 0x20000005
mov ecx, dword [ebp - 0x130c]
push ecx
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
mov dword [ebp - 0x12f4], eax
cmp dword [ebp - 0x12f4], 0
je 0x405ca6
cmp dword [ebp - 0x1318], 0x3e800000
jbe 0x405ca6
mov dword [ebp - 0x12f4], 0
jmp 0x405e4a
push 0
push 0x80200000
push 0
push 0x55fdd9
push str.HTTP_1.1
lea edx, [ebp - 0xab4]
push edx
push 0x55ff5c
mov eax, dword [ebp - 0x12fc]
push eax
call dword [sym.imp.WININET.dll_HttpOpenRequestA]
mov dword [ebp - 0x1310], eax
mov ecx, dword [ebp - 0x1320]
push ecx
mov edx, dword [ebp - 0x1310]
push edx
call fcn.004082f0
add esp, 8
mov dword [ebp - 0x12f4], eax
cmp dword [ebp - 0x12f4], 0
jne 0x405d02
jmp 0x405e4a
push 0
push 0x80
push 2
push 0
push 1
push 0x40000000
lea ecx, [ebp + 0x20]
call fcn.004086a0
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x1308], eax
cmp dword [ebp - 0x1308], 0xffffffff
jne 0x405d41
mov dword [ebp - 0x12f4], 0
jmp 0x405e4a
push 0x2800
call fcn.0040ffe8
add esp, 4
mov dword [ebp - 0x1334], eax
mov eax, dword [ebp - 0x1334]
mov dword [ebp - 0x12f8], eax
cmp dword [ebp - 0x12f8], 0
jne 0x405d78
mov dword [ebp - 0x12f4], 0
jmp 0x405e4a
mov dword [ebp - 0x1314], 0
mov ecx, 1
test ecx, ecx
je 0x405e4a
mov dword [ebp - 0x1300], 0
push 0x2800
push 0
mov edx, dword [ebp - 0x12f8]
push edx
call fcn.005370a0
add esp, 0xc
lea eax, [ebp - 0x1300]
push eax
push 0x2800
mov ecx, dword [ebp - 0x12f8]
push ecx
mov edx, dword [ebp - 0x1310]
push edx
call dword [sym.imp.WININET.dll_InternetReadFile]
mov dword [ebp - 0x12f4], eax
cmp dword [ebp - 0x12f4], 0
je 0x405e45
cmp dword [ebp - 0x1300], 0
jbe 0x405e30
mov eax, dword [ebp - 0x1314]
add eax, dword [ebp - 0x1300]
mov dword [ebp - 0x1314], eax
push 0
lea ecx, [ebp - 0x1338]
push ecx
mov edx, dword [ebp - 0x1300]
push edx
mov eax, dword [ebp - 0x12f8]
push eax
mov ecx, dword [ebp - 0x1308]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [ebp - 0x12f4], eax
cmp dword [ebp - 0x12f4], 0
jne 0x405e2e
jmp 0x405e4a
jmp 0x405e45
cmp dword [ebp - 0x1300], 0
jne 0x405e45
mov dword [ebp - 0x12f4], 1
jmp 0x405e4a
jmp 0x405d82
cmp dword [ebp - 0x1308], 0xffffffff
je 0x405e60
mov edx, dword [ebp - 0x1308]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x12f8], 0
je 0x405e84
mov eax, dword [ebp - 0x12f8]
mov dword [ebp - 0x1330], eax
mov ecx, dword [ebp - 0x1330]
push ecx
call fcn.0040fff1
add esp, 4
cmp dword [ebp - 0x1310], 0
je 0x405e9a
mov edx, dword [ebp - 0x1310]
push edx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
cmp dword [ebp - 0x130c], 0
je 0x405eb0
mov eax, dword [ebp - 0x130c]
push eax
call dword [sym.imp.WININET.dll_InternetCloseHandle]
cmp dword [ebp - 0x12fc], 0
je 0x405ec6
mov ecx, dword [ebp - 0x12fc]
push ecx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
cmp dword [ebp - 0x1304], 0
je 0x405edc
mov edx, dword [ebp - 0x1304]
push edx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
mov eax, dword [ebp - 0x12f4]
mov dword [ebp - 0x132c], eax
mov byte [ebp - 4], 1
lea ecx, [ebp - 0x12f0]
call fcn.00403300
mov byte [ebp - 4], 0
lea ecx, [ebp + 8]
call fcn.00403300
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp + 0x20]
call fcn.00403300
mov eax, dword [ebp - 0x132c]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00535234
mov esp, ebp
pop ebp
ret