Function at 0x401591
Capabilities:
Connect to http server
Create http request
Download and write a file
Print debug messages
Read data from internet
Receive and write data from server to client
Receive data
Reference http user-agent string
Write file on windows

Disassembly:
jmp 0x407bd5
push ebp
lea ebp, [esp - 0x17ec]
mov eax, 0x17ec
call fcn.0040c150
push 0xffffffffffffffff
push 0x439f12
mov eax, dword fs:[0]
push eax
sub esp, 0x14
mov eax, dword [0x4481f4]
xor eax, ebp
mov dword [ebp + 0x17e8], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, dword [ebp + 0x1814]
push edi
mov dword [ebp - 4], 4
call fcn.0040da41
pop ecx
xor ebx, ebx
push ebx
push ebx
push ebx
push ebx
push 0x440218
mov esi, eax
call dword [sym.imp.WININET.dll_InternetOpenW]
cmp eax, ebx
mov dword [ebp - 0x20], eax
jne 0x407cb0
push 0x440198
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
push ebx
push 1
lea ecx, [ebp + 0x17f4]
call fcn.0040142e
mov ecx, dword [ebp + 0x1810]
add ecx, 0xfffffff0
call fcn.00401050
lea ecx, [edi - 0x10]
call fcn.00401050
mov ecx, dword [ebp + 0x1818]
add ecx, 0xfffffff0
call fcn.00401050
mov ecx, dword [ebp + 0x181c]
add ecx, 0xfffffff0
call fcn.00401050
xor al, al
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x17e8]
xor ecx, ebp
call fcn.0040bc38
add ebp, 0x17ec
leave
ret
push ebx
push ebx
push 3
push ebx
push ebx
push esi
mov esi, dword [ebp + 0x1810]
push esi
push eax
call dword [sym.imp.WININET.dll_InternetConnectW]
cmp eax, ebx
mov dword [ebp - 0x1c], eax
jne 0x407ced
push 0x440118
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
push ebx
push 1
lea ecx, [ebp + 0x17f4]
call fcn.0040142e
lea ecx, [esi - 0x10]
jmp 0x407c62
push ebx
push ebx
push ebx
push ebx
push ebx
push dword [ebp + 0x1818]
push 0x44010c
push eax
call dword [sym.imp.WININET.dll_HttpOpenRequestW]
cmp eax, ebx
mov dword [ebp - 0x14], eax
jne 0x407d1e
push 0x440090
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
mov byte [ebp - 0xd], bl
jmp 0x407e9c
mov esi, dword [sym.imp.WININET.dll_HttpAddRequestHeadersW]
mov edi, 0xa0000000
push edi
push 0xffffffffffffffff
push 0x440018
push eax
call esi
push edi
push 0xffffffffffffffff
push 0x43fff8
push dword [ebp - 0x14]
call esi
push edi
push 0xffffffffffffffff
push 0x43ffc0
push dword [ebp - 0x14]
call esi
push edi
mov edi, dword [ebp - 0x14]
push 0xffffffffffffffff
push 0x43ff84
push edi
call esi
sub esp, 0x1c
lea eax, [ebp + 0x17f4]
mov ecx, esp
mov dword [ebp - 0x18], esp
push eax
call fcn.00401627
push ebx
push edi
call fcn.00401410
add esp, 0x24
cmp al, bl
je 0x407e7a
mov eax, dword [ebp + 0x181c]
cmp dword [eax - 0xc], ebx
mov byte [ebp - 0xd], 1
je 0x407e16
push ebx
push 0x80
push 2
push ebx
push ebx
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x407e7d
mov dword [ebp - 0x14], ebx
mov dword [ebp - 0x18], ebx
push 0x3e7
lea eax, [ebp + 0x1401]
push ebx
push eax
mov byte [ebp + 0x1400], bl
call fcn.0040d8b0
add esp, 0xc
lea eax, [ebp - 0x14]
push eax
push 0x3e8
lea eax, [ebp + 0x1400]
push eax
push edi
call dword [sym.imp.WININET.dll_InternetReadFile]
cmp eax, ebx
je 0x407e08
push ebx
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0x14]
lea eax, [ebp + 0x1400]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
cmp dword [ebp - 0x14], ebx
jne 0x407dbc
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x407e7d
push 0x13ff
lea eax, [ebp + 1]
push ebx
push eax
mov dword [ebp - 0x14], ebx
mov byte [ebp], bl
call fcn.0040d8b0
add esp, 0xc
lea eax, [ebp - 0x14]
push eax
push 0x1400
lea eax, [ebp]
push eax
push edi
call dword [sym.imp.WININET.dll_InternetReadFile]
cmp eax, ebx
je 0x407e7d
cmp dword [ebp - 0x14], ebx
jbe 0x407e7d
lea eax, [ebp]
push eax
lea ecx, [ebp - 0x18]
call fcn.00401267
push ebx
push 0x43ff78
lea ecx, [ebp - 0x18]
call fcn.0040137f
cmp eax, 0xffffffff
jne 0x407e6d
mov byte [ebp - 0xd], bl
mov ecx, dword [ebp - 0x18]
add ecx, 0xfffffff0
call fcn.00401050
jmp 0x407e7d
mov byte [ebp - 0xd], bl
push edi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
test eax, eax
jne 0x407e96
push 0x43fef8
mov byte [ebp - 0xd], bl
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
mov edi, dword [ebp + 0x1814]
push dword [ebp - 0x1c]
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
call esi
test eax, eax
jne 0x407eb9
push 0x43fe78
mov byte [ebp - 0xd], bl
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
push dword [ebp - 0x20]
call esi
test eax, eax
jne 0x407f18
push 0x43fdf8
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
mov byte [ebp - 0xd], bl
push ebx
push 1
lea ecx, [ebp + 0x17f4]
call fcn.0040142e
mov ecx, dword [ebp + 0x1810]
add ecx, 0xfffffff0
call fcn.00401050
lea ecx, [edi - 0x10]
call fcn.00401050
mov ecx, dword [ebp + 0x1818]
add ecx, 0xfffffff0
call fcn.00401050
mov ecx, dword [ebp + 0x181c]
add ecx, 0xfffffff0
call fcn.00401050
mov al, byte [ebp - 0xd]
jmp 0x407c8d
push 0x44988c
lea ecx, [ebp - 0x18]
call fcn.0040147e
movzx eax, byte [ebp - 0xd]
push eax
lea eax, [ebp - 0x18]
push 0x43fda0
push eax
mov byte [ebp - 4], 5
call fcn.00401249
mov esi, dword [ebp - 0x18]
add esp, 0xc
push esi
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
lea ecx, [esi - 0x10]
call fcn.00401050
mov al, byte [ebp - 0xd]
mov byte [ebp - 0xd], al
jmp 0x407ed0