Function at 0x405821
Capabilities:
Connect socket
Download and write a file
Receive and write data from server to client
Receive data
Receive data on socket
Send data
Send data on socket
Send http request
Send http request with host header
Write file on windows

Disassembly:
mov eax, 0x41a704
call fcn.00410f20
sub esp, 0x294
mov eax, dword [0x4240b8]
push edi
mov edi, dword [ebp + 8]
mov dword [ebp - 0x10], eax
mov eax, dword [edi + 0x38]
cmp dword [edi + 0x3c], eax
jle 0x405851
cmp eax, 0xffffffff
jle 0x405851
xor eax, eax
jmp 0x406120
mov eax, dword [0x424e6c]
push ebx
push esi
mov esi, 0x424e6c
mov ecx, esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x290], eax
and dword [ebp - 4], 0
mov eax, dword [0x424e6c]
mov ecx, esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x294], eax
mov esi, dword [ebp + 0xc]
lea eax, [ebp - 0x294]
push eax
lea eax, [ebp - 0x288]
push eax
lea eax, [ebp - 0x290]
add esi, 0x34
push eax
push esi
mov byte [ebp - 4], 1
mov dword [ebp - 0x298], esi
call fcn.00406cfb
push str.127.0.0.1
push dword [ebp - 0x290]
call fcn.0040f570
push dword [esi]
mov ebx, eax
neg ebx
sbb ebx, ebx
inc ebx
push ebx
push str.CDownloadThread::DoMyTask_bLocalDes_d__des_S_n
call fcn.00409adb
xor esi, esi
add esp, 0x14
cmp ebx, esi
je 0x405923
push dword [ebp - 0x288]
mov word [ebp - 0x20], 2
call dword [sym.imp.WS2_32.dll_htons]
mov word [ebp - 0x1e], ax
push 0x10
lea eax, [ebp - 0x20]
mov dword [ebp - 0x1c], 0x100007f
mov dword [ebp - 0x18], esi
mov dword [ebp - 0x14], esi
push eax
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_connect]
test eax, eax
je 0x405ba2
mov eax, edi
call fcn.00405680
or esi, 0xffffffff
jmp 0x406100
mov eax, dword [0x425db8]
cmp eax, 1
je 0x405bfa
cmp eax, esi
je 0x405bfa
cmp eax, 2
jne 0x405952
push str.CDownloadThread::DoMyTask_NET_PROXYHTTP_n
call fcn.00409adb
pop ecx
push 0x10
push 0x4258e0
jmp 0x405903
cmp eax, 3
jne 0x405914
push str.CDownloadThread::DoMyTask_NET_PROXYSOCKS_n
call fcn.00409adb
pop ecx
push 0x10
push 0x4258e0
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_connect]
test eax, eax
jne 0x405914
push str.CDownloadThread::DoMyTask_NET_PROXYSOCKS_connect_proxy_server_OK._n
call fcn.00409adb
pop ecx
push esi
push 4
lea eax, [ebp - 0x278]
push eax
push dword [edi + 0x30]
mov byte [ebp - 0x278], 5
mov byte [ebp - 0x277], 2
mov byte [ebp - 0x276], 0
mov byte [ebp - 0x275], 2
call dword [sym.imp.WS2_32.dll_send]
mov esi, 0x258
push esi
lea eax, [ebp - 0x278]
push 0
push eax
call fcn.0040daa0
add esp, 0xc
push 0
push esi
lea eax, [ebp - 0x278]
push eax
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_recv]
cmp byte [ebp - 0x278], 5
jne 0x405914
cmp byte [ebp - 0x277], 0
je 0x4059fd
cmp byte [ebp - 0x277], 2
jne 0x405914
push 0x41e500
call fcn.00409adb
cmp byte [ebp - 0x277], 2
pop ecx
jne 0x405ade
push 0x425de0
call fcn.0040dbc0
mov dword [ebp - 0x288], eax
mov dword [esp], 0x425e20
call fcn.0040dbc0
mov dword [ebp - 0x28c], eax
mov al, byte [ebp - 0x288]
mov byte [ebp - 0x277], al
lea eax, [ebp - 0x276]
mov dword [esp], 0x425de0
push eax
mov byte [ebp - 0x278], 1
call fcn.0040dc50
mov al, byte [ebp - 0x28c]
mov byte [ebp - 0x177], al
lea eax, [ebp - 0x176]
push 0x425e20
push eax
call fcn.0040dc50
add esp, 0x10
push 0
push 0x201
lea eax, [ebp - 0x278]
push eax
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_send]
push esi
lea eax, [ebp - 0x278]
push 0
push eax
call fcn.0040daa0
add esp, 0xc
push 0
push esi
lea eax, [ebp - 0x278]
push eax
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_recv]
cmp byte [ebp - 0x278], 1
jne 0x405bea
cmp byte [ebp - 0x277], 0
jne 0x405bea
push str.CDownloadThread::DoMyTask_NET_PROXYSOCKS_Proxy_Authorization_OK._n
call fcn.00409adb
pop ecx
mov eax, dword [ebp + 0x14]
mov ecx, dword [eax + 4]
movzx eax, word [eax + 2]
push eax
mov byte [ebp - 0x278], 5
mov byte [ebp - 0x277], 1
mov byte [ebp - 0x276], 0
mov byte [ebp - 0x275], 1
mov dword [ebp - 0x2a0], ecx
call dword [sym.imp.WS2_32.dll_ntohs]
push 4
mov dword [ebp - 0x29c], eax
lea eax, [ebp - 0x2a0]
push eax
lea eax, [ebp - 0x274]
push eax
call fcn.0040e3b0
push 2
lea eax, [ebp - 0x29c]
push eax
lea eax, [ebp - 0x270]
push eax
call fcn.0040e3b0
add esp, 0x18
push 0
push 0xa
lea eax, [ebp - 0x278]
push eax
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_send]
push esi
lea eax, [ebp - 0x278]
push 0
push eax
call fcn.0040daa0
add esp, 0xc
push 0
push esi
lea eax, [ebp - 0x278]
push eax
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_recv]
cmp byte [ebp - 0x278], 5
jne 0x405914
cmp byte [ebp - 0x277], 0
jne 0x405914
push str.CDownloadThread::DoMyTask_NET_PROXYSOCKS_connect_site_OK._n
call fcn.00409adb
pop ecx
mov eax, dword [0x424e6c]
mov ecx, 0x424e6c
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x284], eax
mov edx, 0x10000
lea esi, [ebp - 0x284]
mov byte [ebp - 4], 2
call fcn.004053dd
mov dword [ebp - 0x288], eax
mov eax, dword [edi + 0x38]
cmp eax, 0xffffffff
jne 0x405c0c
mov eax, dword [ebp + 0xc]
cmp dword [eax + 0x40], 2
jge 0x405c04
mov eax, 0x7fff0000
jmp 0x405c0c
push 0x41e4e4
call fcn.00409adb
pop ecx
jmp 0x405914
push 0x10
push dword [ebp + 0x14]
jmp 0x405903
mov eax, dword [edi + 0x3c]
add eax, 0x1ffff
mov ecx, dword [edi + 0x3c]
test ecx, ecx
mov dword [ebp - 0x27c], eax
mov byte [ebp - 0x27d], 0
jne 0x405c32
mov esi, dword [ebp + 0xc]
lea edx, [eax + 1]
cmp edx, dword [esi + 0x30]
jne 0x405c32
mov byte [ebp - 0x27d], 1
cmp dword [0x425db8], 2
jne 0x405d6c
test ebx, ebx
jne 0x405d6c
mov esi, dword [ebp + 0x14]
cmp word [esi + 2], 0x50
jne 0x405c9c
cmp byte [ebp - 0x27d], bl
push dword [ebp + 0x18]
je 0x405c7b
push dword [ebp + 0x1c]
lea eax, [ebp - 0x284]
push dword [ebp + 0x18]
push str.GET_http:___s_s_HTTP_1.0_r_nAccept:___r_nAccept_Encoding:_identity_r_nUser_Agent:_HttpRange_r_nHost:__s_r_nProxy_Connection:_Keep_Alive_r_n
push eax
call fcn.0040523f
add esp, 0x14
jmp 0x405d20
push eax
push ecx
push dword [ebp + 0x1c]
lea eax, [ebp - 0x284]
push dword [ebp + 0x18]
push str.GET_http:___s_s_HTTP_1.1_r_nAccept:___r_nAccept_Encoding:_identity_r_nRange:_bytes_12d__12d_r_nUser_Agent:_HttpRange_r_nHost:__s_r_nProxy_Connection:_Keep_Alive_r_n
push eax
call fcn.0040523f
add esp, 0x1c
jmp 0x405d20
mov eax, dword [0x424e6c]
mov ecx, 0x424e6c
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp + 0x14], eax
mov byte [ebp - 4], 3
movzx eax, word [esi + 2]
push eax
push dword [ebp + 0x18]
lea eax, [ebp + 0x14]
push str._s:_d
push eax
call fcn.0040523f
add esp, 0x10
cmp byte [ebp - 0x27d], 0
push dword [ebp + 0x18]
lea eax, [ebp - 0x284]
je 0x405cf4
push dword [ebp + 0x1c]
push dword [ebp + 0x14]
push str.GET_http:___s_s_HTTP_1.0_r_nAccept:___r_nAccept_Encoding:_identity_r_nUser_Agent:_HttpRange_r_nHost:__s_r_nProxy_Connection:_Keep_Alive_r_n
push eax
call fcn.0040523f
add esp, 0x14
jmp 0x405d11
push dword [ebp - 0x27c]
push dword [edi + 0x3c]
push dword [ebp + 0x1c]
push dword [ebp + 0x14]
push str.GET_http:___s_s_HTTP_1.1_r_nAccept:___r_nAccept_Encoding:_identity_r_nRange:_bytes_12d__12d_r_nUser_Agent:_HttpRange_r_nHost:__s_r_nProxy_Connection:_Keep_Alive_r_n
push eax
call fcn.0040523f
add esp, 0x1c
mov byte [ebp - 4], 2
mov eax, dword [ebp + 0x14]
add eax, 0xfffffff0
call fcn.0040252d
cmp byte [0x425e60], 0
mov esi, 0x41e3bc
je 0x405d5d
push str.Proxy_Authorization:_Basic
lea eax, [ebp - 0x284]
push eax
call fcn.004066b8
push 0x425e60
lea eax, [ebp - 0x284]
push eax
call fcn.004066b8
push esi
lea eax, [ebp - 0x284]
push eax
call fcn.004066b8
push esi
lea eax, [ebp - 0x284]
push eax
call fcn.004066b8
jmp 0x405daa
cmp byte [ebp - 0x27d], 0
push dword [ebp + 0x18]
je 0x405d91
push dword [ebp + 0x1c]
lea eax, [ebp - 0x284]
push str.GET__s_HTTP_1.0_r_nAccept:___r_nAccept_Encoding:_identity_r_nUser_Agent:_HttpRange_r_nHost:__s_r_nConnection:_Keep_Alive_r_n_r_n
push eax
call fcn.0040523f
add esp, 0x10
jmp 0x405daa
push eax
push ecx
push dword [ebp + 0x1c]
lea eax, [ebp - 0x284]
push str.GET__s_HTTP_1.1_r_nAccept:___r_nAccept_Encoding:_identity_r_nRange:_bytes_d__d_r_nUser_Agent:_HttpRange_r_nHost:__s_r_nConnection:_Keep_Alive_r_n_r_n
push eax
call fcn.0040523f
add esp, 0x18
mov esi, dword [ebp - 0x284]
mov eax, dword [esi - 0xc]
push 0
push eax
push esi
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_send]
push esi
push str.CDownloadThread::DoMyTask_send_:_n_t_S_n
call fcn.00409adb
mov eax, dword [ebp - 0x288]
mov ebx, dword [edi + 0x30]
pop ecx
pop ecx
call fcn.004057cd
test eax, eax
mov dword [ebp - 0x27c], eax
jg 0x405ded
or esi, 0xffffffff
jmp 0x4060f2
lea esi, [ebp - 0x284]
call fcn.00406658
push dword [ebp - 0x284]
push str.CDownloadThread::DoMyTask_recv_header_:_n_t_S_n
call fcn.00409adb
pop ecx
pop ecx
mov ebx, str.Content_Range:_bytes
push ebx
xor ecx, ecx
call fcn.00406573
push eax
push str.CDownloadThread::DoMyTask_ContentRange_:_n_t_d_n
mov dword [ebp - 0x27c], eax
call fcn.00409adb
cmp dword [ebp - 0x27c], 0
pop ecx
pop ecx
jg 0x405e3c
cmp byte [ebp - 0x27d], 0
je 0x405de5
cmp dword [edi + 0x38], 0xffffffff
jne 0x405ef3
push ebx
xor ecx, ecx
lea esi, [ebp - 0x284]
call fcn.00406573
cmp eax, 0xffffffff
mov dword [ebp - 0x27c], eax
je 0x406059
push 0xa
lea ecx, [ebp - 0x28c]
push ecx
mov ecx, dword [ebp - 0x288]
lea eax, [eax + ecx + 0x15]
push eax
call fcn.0040e137
push 0xa
lea eax, [ebp - 0x28c]
push eax
mov eax, dword [ebp - 0x28c]
inc eax
push eax
call fcn.0040e137
mov dword [edi + 0x38], eax
push 0xa
lea eax, [ebp - 0x28c]
push eax
mov eax, dword [ebp - 0x28c]
inc eax
push eax
call fcn.0040e137
mov ebx, eax
mov eax, dword [ebp + 0xc]
mov dword [eax + 0x30], ebx
mov dword [eax + 0x3c], 0
mov ecx, dword [edi + 0x38]
lea esi, [ecx + 1]
add esp, 0x24
cmp esi, ebx
jge 0x405ef3
mov edx, dword [eax + 0x40]
cmp edx, 1
jle 0x405ef3
mov eax, ebx
sub eax, ecx
dec eax
lea ecx, [edx - 1]
xor edx, edx
div ecx
mov dword [ebp + 0x1c], esi
add eax, 0x1ffff
and eax, 0xfffe0000
cmp esi, ebx
mov dword [ebp + 0x14], eax
jb 0x405ff5
push 0
mov esi, edi
call fcn.00402ce1
test eax, eax
jne 0x4060ec
mov ebx, dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov esi, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea eax, [edi + 0x18]
push eax
mov dword [ebp + 0x18], eax
call esi
mov eax, dword [edi + 0x38]
sub eax, dword [edi + 0x3c]
push dword [ebp + 0x18]
inc eax
mov dword [ebp - 0x27c], eax
call ebx
xor ecx, ecx
cmp dword [ebp - 0x27c], ecx
jle 0x4060cd
mov eax, 0x10000
cmp dword [ebp - 0x27c], eax
jle 0x405f4c
mov dword [ebp - 0x27c], eax
push ecx
push dword [ebp - 0x27c]
push dword [ebp - 0x288]
push dword [edi + 0x30]
call dword [sym.imp.WS2_32.dll_recv]
test eax, eax
mov dword [ebp - 0x27c], eax
jle 0x4060d5
push dword [ebp + 0x18]
call esi
mov eax, dword [edi + 0x3c]
mov edx, dword [edi + 0x38]
mov ecx, dword [ebp - 0x27c]
sub edx, eax
cmp ecx, edx
jle 0x405f90
lea ecx, [edx + 1]
mov dword [ebp - 0x27c], ecx
xor esi, esi
cmp ecx, esi
jle 0x4060e1
add eax, ecx
mov dword [edi + 0x3c], eax
call dword [sym.imp.KERNEL32.dll_GetTickCount]
push dword [ebp + 0x18]
mov dword [edi + 0x40], eax
call ebx
push esi
lea eax, [ebp - 0x27c]
push eax
push dword [ebp - 0x27c]
push dword [ebp - 0x288]
push dword [ebp + 0x10]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [ebp - 0x27c]
mov eax, dword [ebp + 0xc]
add eax, 0x3c
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
push esi
mov esi, edi
call fcn.00402ce1
test eax, eax
je 0x405f0a
jmp 0x4060ec
mov eax, dword [ebp + 0x14]
mov ecx, dword [ebp + 0x1c]
lea eax, [ecx + eax - 1]
mov dword [ebp + 0x18], eax
add eax, 0x20000
cmp eax, ebx
jb 0x40600e
lea eax, [ebx - 1]
mov dword [ebp + 0x18], eax
push 0
mov esi, edi
call fcn.00402ce1
test eax, eax
jne 0x405ef3
push 0x44
call fcn.0040d90f
test eax, eax
pop ecx
je 0x40603d
push dword [ebp + 0x18]
mov edi, dword [ebp + 0x1c]
mov esi, eax
call fcn.00405603
mov edi, dword [ebp + 8]
jmp 0x40603f
xor eax, eax
push dword [ebp + 0xc]
mov esi, eax
call fcn.00402df2
mov eax, dword [ebp + 0x18]
inc eax
cmp eax, ebx
mov dword [ebp + 0x1c], eax
jb 0x405ff2
jmp 0x405ef3
push str.Location:
xor ecx, ecx
lea esi, [ebp - 0x284]
call fcn.00406573
cmp eax, 0xffffffff
mov dword [ebp - 0x27c], eax
je 0x4060be
add eax, 0xa
mov ecx, eax
mov dl, 0xd
mov dword [ebp - 0x27c], eax
call fcn.0040654f
mov edx, dword [ebp - 0x27c]
mov ecx, eax
lea eax, [ebp + 0x18]
push eax
sub ecx, edx
mov eax, esi
call fcn.004065a1
mov byte [ebp - 4], 4
push dword [eax]
mov eax, dword [ebp - 0x298]
call fcn.00405291
mov eax, dword [ebp + 0x18]
add eax, 0xfffffff0
call fcn.0040252d
xor esi, esi
inc esi
jmp 0x4060f2
mov esi, dword [ebp + 0xc]
xor eax, eax
call fcn.00402f8c
jmp 0x405de5
mov dword [ebp - 0x27c], ecx
jmp 0x4060ec
mov dword [ebp - 0x27c], 1
jmp 0x4060ec
push dword [ebp + 0x18]
call ebx
mov dword [ebp - 0x27c], esi
mov esi, dword [ebp - 0x27c]
mov eax, dword [ebp - 0x284]
add eax, 0xfffffff0
call fcn.0040252d
mov eax, dword [ebp - 0x294]
add eax, 0xfffffff0
call fcn.0040252d
mov eax, dword [ebp - 0x290]
add eax, 0xfffffff0
call fcn.0040252d
mov eax, esi
pop esi
pop ebx
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
mov ecx, dword [ebp - 0x10]
pop edi
call fcn.00410727
leave
ret 0x18