Function at 0x402840
Capabilities:
Check http status code
Connect to http server
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
Resolve function by parsing pe exports
Send data
Send http request
Write file on windows

Disassembly:
mov eax, 0x4864
call fcn.00413d30
mov eax, dword [0x423044]
xor eax, esp
mov dword [esp + 0x4860], eax
mov eax, dword [esp + 0x4868]
push ebx
push ebp
mov ebp, dword [esp + 0x4874]
push esi
xor ebx, ebx
push edi
push 0x4000
mov esi, ecx
lea ecx, [esp + 0x871]
push ebx
push ecx
mov dword [esp + 0x28], eax
mov dword [esp + 0x30], ebp
mov dword [esp + 0x44], ebx
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x50], ebx
mov dword [esp + 0x3c], 0x84400000
mov dword [esp + 0x40], ebx
mov byte [esp + 0x878], bl
call fcn.0040d460
push 0xff
lea edx, [esp + 0x175]
push ebx
push edx
mov byte [esp + 0x17c], bl
call fcn.0040d460
push 0x3ff
lea eax, [esp + 0x489]
push ebx
push eax
mov byte [esp + 0x490], bl
call fcn.0040d460
push 0x103
lea ecx, [esp + 0x89]
push ebx
push ecx
mov byte [esp + 0x90], bl
call fcn.0040d460
push 0x103
lea eax, [esp + 0x39d]
lea edx, [esp + 0x88]
push ebx
push eax
mov dword [esp + 0x68], ebx
mov dword [esp + 0x90], 0x2a2f2a
mov dword [esp + 0x98], ebx
mov dword [esp + 0x8c], 4
xor edi, edi
mov dword [esp + 0x88], ebx
mov dword [esp + 0x5c], ebx
mov dword [esp + 0x94], edx
mov dword [esp + 0x78], 0x1388
mov byte [esp + 0x3a4], bl
call fcn.0040d460
push 0x103
lea ecx, [esp + 0x2a5]
push ebx
push ecx
mov byte [esp + 0x2ac], bl
call fcn.0040d460
add esp, 0x48
push 7
push str.http:__
push esi
call fcn.0040bf06
add esp, 0xc
test eax, eax
jne 0x402f36
lea eax, [esi + 7]
push 0x2f
push eax
call fcn.0040aba0
mov ebp, eax
add esp, 8
cmp ebp, ebx
je 0x402f32
push 0x100
lea edx, [esp + 0x168]
push ebx
push edx
call fcn.0040d460
mov eax, ebp
lea ecx, [esi + 7]
sub eax, ecx
add esp, 0xc
cmp eax, 0x100
ja 0x402f32
push eax
push ecx
lea eax, [esp + 0x16c]
push 0x100
push eax
call fcn.0040ac5e
mov eax, ebp
add esp, 0x10
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
cmp cl, bl
jne 0x4029e5
sub eax, edx
cmp eax, 0x3fe
ja 0x402f32
push 0x400
lea ecx, [esp + 0x470]
push ebx
push ecx
call fcn.0040d460
mov eax, ebp
add esp, 0xc
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
cmp cl, bl
jne 0x402a16
sub eax, edx
push eax
push ebp
lea edx, [esp + 0x474]
push 0x400
push edx
call fcn.0040ac5e
lea eax, [esp + 0x70]
push eax
mov eax, esi
call fcn.00402730
add esp, 0x14
test eax, eax
je 0x402f32
push ebx
push ebx
push ebx
push ebx
push str.KANDownloadFile
call dword [sym.imp.WININET.dll_InternetOpenA]
cmp eax, ebx
mov dword [esp + 0x28], eax
je 0x402f32
mov ebp, dword [esp + 0x24]
cmp ebp, ebx
mov dword [esp + 0x18], 4
je 0x402a94
mov edx, dword [esp + 0x20]
lea ecx, [esp + 0x60]
push ecx
push 4
push ebx
push ebx
push edx
call ebp
mov edi, eax
neg edi
sbb edi, edi
inc edi
jne 0x402ec8
mov eax, dword [esp + 0x1c]
push ebx
push 0x80
push 4
push ebx
push 1
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, ebx
mov dword [esp + 0x2c], eax
je 0x402eb4
mov esi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
push ebx
push ebx
push eax
call esi
mov ecx, dword [esp + 0x2c]
push 2
push ebx
push ebx
push ecx
call esi
mov esi, eax
push esi
lea edx, [esp + 0x268]
push str.Range:bytes_u__n
push edx
mov eax, 0x104
mov dword [esp + 0x4c], esi
call fcn.00403060
add esp, 0xc
cmp ebp, ebx
je 0x402b10
lea eax, [esp + 0x60]
push eax
push 8
push ebx
push esi
push ebx
call ebp
mov edi, eax
neg edi
sbb edi, edi
inc edi
jne 0x402ec8
mov edx, dword [esp + 0x28]
mov esi, dword [sym.imp.WININET.dll_InternetSetOptionA]
push 4
lea ecx, [esp + 0x40]
push ecx
push 2
push edx
call esi
cmp eax, ebx
mov dword [esp + 0x18], eax
je 0x402eb4
mov ecx, dword [esp + 0x28]
push 4
lea eax, [esp + 0x40]
push eax
push 6
push ecx
call esi
cmp eax, ebx
mov dword [esp + 0x18], eax
je 0x402eb4
mov eax, dword [esp + 0x28]
push 4
lea edx, [esp + 0x40]
push edx
push 8
push eax
call esi
cmp eax, ebx
mov dword [esp + 0x18], eax
je 0x402eb4
lea ecx, [esp + 0x1c]
push ecx
lea eax, [esp + 0x36c]
lea esi, [esp + 0x168]
mov dword [esp + 0x20], ebx
call fcn.00402790
add esp, 4
test eax, eax
je 0x402eb4
mov edx, dword [esp + 0x1c]
mov ecx, dword [esp + 0x28]
push ebx
push ebx
push 3
push 0x420158
push 0x420158
push edx
lea eax, [esp + 0x380]
push eax
push ecx
call dword [sym.imp.WININET.dll_InternetConnectA]
cmp eax, ebx
mov dword [esp + 0x38], eax
je 0x402eb4
cmp ebp, ebx
mov dword [esp + 0x18], 2
je 0x402be8
lea edx, [esp + 0x60]
push edx
push 2
push ebx
push ebx
push ebx
call ebp
mov edi, eax
neg edi
sbb edi, edi
inc edi
jne 0x402ec8
mov eax, dword [esp + 0x30]
push ebx
push eax
mov eax, dword [esp + 0x40]
lea ecx, [esp + 0x60]
push ecx
push 0x420158
push str.HTTP_1.0
lea edx, [esp + 0x480]
push edx
push 0x4201bc
push eax
call dword [sym.imp.WININET.dll_HttpOpenRequestA]
mov esi, eax
cmp esi, ebx
je 0x402ebc
nop
push ebx
push ebx
push 0xffffffffffffffff
lea ecx, [esp + 0x270]
push ecx
push esi
call dword [sym.imp.WININET.dll_HttpSendRequestA]
test eax, eax
jne 0x402c71
or dword [esp + 0x30], 0xf180
push 4
lea edx, [esp + 0x34]
push edx
push 0x1f
push esi
call dword [sym.imp.WININET.dll_InternetSetOptionA]
test eax, eax
je 0x402ebc
push ebx
push ebx
push ebx
lea eax, [esp + 0x270]
push eax
push esi
call dword [sym.imp.WININET.dll_HttpSendRequestA]
test eax, eax
je 0x402ebc
cmp ebp, ebx
mov dword [esp + 0x18], 3
je 0x402c96
lea ecx, [esp + 0x60]
push ecx
push 3
push ebx
push ebx
push ebx
call ebp
mov edi, eax
neg edi
sbb edi, edi
inc edi
jne 0x402eca
push ebx
lea edx, [esp + 0x14]
push edx
lea eax, [esp + 0x4c]
push eax
push 0x20000013
push esi
mov dword [esp + 0x24], 4
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
test eax, eax
je 0x402ebc
mov eax, dword [esp + 0x44]
cmp eax, 0x191
je 0x402cd0
cmp eax, 0x197
jne 0x402d11
nop
lea ecx, [esp + 0x10]
push ecx
push 0x32
lea edx, [esp + 0x874]
push edx
push esi
call dword [sym.imp.WININET.dll_InternetReadFile]
cmp dword [esp + 0x10], ebx
jne 0x402cd0
push ebx
push 7
push 0x2eee
push esi
call dword [sym.imp.USER32.dll_GetDesktopWindow]
push eax
call dword [sym.imp.WININET.dll_InternetErrorDlg]
cmp eax, 0x2f00
je 0x402c20
mov eax, dword [esp + 0x44]
cmp eax, 0xc8
je 0x402d2f
cmp eax, 0xce
je 0x402d2f
cmp eax, 0x1a0
jne 0x402ebc
jmp 0x402e8a
cmp eax, 0x1a0
je 0x402e8a
push ebx
lea eax, [esp + 0x14]
push eax
push ebx
push 0x16
push esi
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
mov ecx, dword [esp + 0x10]
add ecx, 1
push ecx
call fcn.0040ab19
add esp, 4
cmp eax, ebx
mov dword [esp + 0x34], eax
je 0x402ebc
push ebx
lea edx, [esp + 0x14]
push edx
push eax
push 0x16
push esi
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
test eax, eax
je 0x402ebc
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x34]
push ebx
lea edx, [esp + 0x54]
push edx
mov byte [ecx + eax], bl
lea eax, [esp + 0x28]
push eax
push 0x20000005
push esi
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
test eax, eax
je 0x402ebc
call fcn.0040b246
lea ecx, [esp + 0x10]
push ecx
push 0x4000
lea edx, [esp + 0x874]
push edx
push esi
mov ebp, eax
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
je 0x402eb8
mov eax, dword [esp + 0x10]
cmp eax, ebx
je 0x402e86
push ebx
lea ecx, [esp + 0x20]
push ecx
push eax
mov eax, dword [esp + 0x38]
lea edx, [esp + 0x878]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402eb8
mov ecx, dword [esp + 0x1c]
add dword [esp + 0x40], ecx
call fcn.0040b246
sub eax, ebp
mov dword [esp + 0x14], eax
fild dword [esp + 0x14]
fdiv qword [0x420740]
fstp dword [esp + 0x14]
fldz
fld dword [esp + 0x14]
fucom st(1)
fnstsw ax
fstp st(1)
test ah, 0x44
jnp 0x402e4b
mov edx, dword [esp + 0x10]
fild dword [esp + 0x10]
test edx, edx
jge 0x402e42
fadd dword [0x420738]
fdivrp st(1)
call fcn.004192d0
jmp 0x402e4f
fstp st(0)
mov eax, ebx
mov ecx, dword [esp + 0x24]
cmp ecx, ebx
mov dword [esp + 0x18], 5
je 0x402e7c
lea edx, [esp + 0x60]
push edx
mov edx, dword [esp + 0x24]
push 5
push eax
mov eax, dword [esp + 0x28]
push eax
push edx
call ecx
mov edi, eax
neg edi
sbb edi, edi
inc edi
jne 0x402ec2
cmp dword [esp + 0x10], ebx
jne 0x402da8
mov ebp, dword [esp + 0x24]
cmp ebp, ebx
mov dword [esp + 0x18], 6
je 0x402eaa
mov ecx, dword [esp + 0x40]
mov edx, dword [esp + 0x20]
lea eax, [esp + 0x60]
push eax
push 6
push ebx
push ecx
push edx
call ebp
mov dword [esp + 0x4c], 1
jmp 0x402ebc
mov esi, ebx
jmp 0x402ebc
mov ebp, dword [esp + 0x24]
cmp edi, ebx
je 0x402ee6
jmp 0x402eca
mov ebp, dword [esp + 0x24]
jmp 0x402eca
mov esi, ebx
cmp ebp, ebx
mov dword [esp + 0x18], 7
je 0x402ee6
mov ecx, dword [esp + 0x20]
lea eax, [esp + 0x60]
push eax
push 7
push ebx
push ebx
push ecx
call ebp
cmp esi, ebx
mov edi, dword [sym.imp.WININET.dll_InternetCloseHandle]
je 0x402ef3
push esi
call edi
mov eax, dword [esp + 0x38]
cmp eax, ebx
je 0x402efe
push eax
call edi
mov edx, dword [esp + 0x28]
push edx
call edi
mov eax, dword [esp + 0x34]
cmp eax, ebx
je 0x402f16
push eax
call fcn.0040b241
add esp, 4
mov esi, dword [esp + 0x2c]
cmp esi, ebx
je 0x402f2c
push esi
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x4c], ebx
jne 0x402f4d
mov ebp, dword [esp + 0x24]
cmp ebp, ebx
je 0x402f49
mov ecx, dword [esp + 0x20]
lea eax, [esp + 0x60]
push eax
push ebx
push ebx
push ebx
push ecx
call ebp
mov eax, ebx
jmp 0x402f51
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x4870]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040af86
add esp, 0x4864
ret