Function at 0x509210
Capabilities:
Check http status code
Encode data using xor
Get hostname
Receive data
Receive data on socket
Send data
Send data on socket
Send http request

Disassembly:
sub esp, 0x970
push ebx
push ebp
push esi
mov ebp, ecx
xor esi, esi
push edi
lea ecx, [esp + 0x10]
mov dword [esp + 0x14], esi
call sub.MFC42.DLL_CString::CString_2
mov dl, byte [0x5937a0]
mov ecx, 0x3f
xor eax, eax
lea edi, [esp + 0x381]
mov byte [esp + 0x380], dl
mov byte [esp + 0xc0], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0xf
xor eax, eax
lea edi, [esp + 0xc1]
mov byte [esp + 0x880], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x3f
xor eax, eax
lea edi, [esp + 0x881]
mov byte [esp + 0x100], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0xf
xor eax, eax
lea edi, [esp + 0x101]
mov ebx, dword [esp + 0x984]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x20
xor eax, eax
lea edi, [esp + 0x3d]
mov byte [esp + 0x1c], 0x4e
mov byte [esp + 0x1d], 0x54
mov byte [esp + 0x1e], 0x4c
mov byte [esp + 0x1f], 0x4d
mov byte [esp + 0x20], 0x53
mov byte [esp + 0x21], 0x53
mov byte [esp + 0x22], 0x50
mov byte [esp + 0x23], 0
mov dword [esp + 0x24], 1
mov dword [esp + 0x28], 0xb203
mov word [esp + 0x2c], si
mov word [esp + 0x2e], si
mov dword [esp + 0x30], esi
mov word [esp + 0x34], si
mov word [esp + 0x36], si
mov dword [esp + 0x38], ecx
mov byte [esp + 0x3c], 0
rep stosd dword es:[edi], eax
cmp ebx, esi
stosb byte es:[edi], al
je 0x509d8c
lea eax, [esp + 0x3c]
push 0x3f
push eax
call sub.WS2_32.dll_gethostname
mov esi, dword [sym.imp.MSVCRT.dll__strupr]
lea ecx, [esp + 0x3c]
push ecx
call esi
lea edi, [esp + 0x40]
or ecx, 0xffffffff
xor eax, eax
lea edx, [ebp + 0x10c]
repne scasb al, byte es:[edi]
not ecx
push 0xff
lea eax, [esp + 0x388]
dec ecx
push edx
push eax
mov word [esp + 0x46], cx
mov word [esp + 0x44], cx
call dword [sym.imp.MSVCRT.dll_strncpy]
lea ecx, [esp + 0x390]
push 0x581840
push ecx
mov byte [esp + 0x497], 0
call dword [sym.imp.MSVCRT.dll_strstr]
add esp, 0x18
test eax, eax
je 0x50939c
mov byte [eax], 0
inc eax
push 0x3f
lea edx, [esp + 0x104]
push eax
push edx
call dword [sym.imp.MSVCRT.dll_strncpy]
add esp, 0xc
mov byte [esp + 0x13f], 0
lea eax, [esp + 0x380]
push 0x58ea98
push eax
call dword [sym.imp.MSVCRT.dll_strstr]
add esp, 8
test eax, eax
je 0x5093d8
mov byte [eax], 0
inc eax
push 0x3f
lea ecx, [esp + 0xc4]
push eax
push ecx
call dword [sym.imp.MSVCRT.dll_strncpy]
add esp, 0xc
mov byte [esp + 0xff], 0
jmp 0x5093e0
mov byte [esp + 0x380], 0
lea edx, [esp + 0x380]
push edx
call esi
lea edi, [esp + 0x384]
or ecx, 0xffffffff
xor eax, eax
push 0x3f
repne scasb al, byte es:[edi]
movsx eax, word [esp + 0x3c]
not ecx
dec ecx
mov word [esp + 0x36], cx
mov word [esp + 0x34], cx
mov ecx, dword [esp + 0x40]
lea edx, [eax + ecx]
lea ecx, [esp + 0x388]
mov dword [esp + 0x38], edx
lea edx, [esp + eax + 0x44]
push ecx
push edx
call dword [sym.imp.MSVCRT.dll_strncpy]
movsx ecx, word [esp + 0x3c]
mov esi, dword [esp + 0x40]
add esp, 0x10
lea eax, [esp + 0x10]
add ecx, esi
push eax
lea edx, [esp + 0x20]
push ecx
push edx
mov ecx, ebp
call fcn.0050aa00
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x988]
push eax
push ecx
push ebx
push str.CONNECT__s:_d_HTTP_1.0_r_nProxy_Authorization:_NTLM__s_r_n_r_n
lea edx, [esp + 0x490]
push 0x3ff
push edx
call dword [sym.imp.MSVCRT.dll__snprintf]
lea edi, [esp + 0x498]
or ecx, 0xffffffff
xor eax, eax
add esp, 0x18
repne scasb al, byte es:[edi]
mov eax, dword [ebp + 4]
mov ebx, 0xa
not ecx
dec ecx
cmp eax, 0xffffffff
mov esi, ecx
lea edi, [esp + 0x480]
je 0x509d8c
lea eax, [esp + 0x480]
test eax, eax
je 0x509d8c
test esi, esi
jl 0x509d8c
jle 0x509500
mov ecx, dword [ebp + 4]
push 0
push esi
push edi
push ecx
call sub.WS2_32.dll_send
cmp eax, 1
jge 0x5094ec
call sub.WS2_32.dll_WSAGetLastError
cmp eax, 0x2733
jne 0x509d3f
dec ebx
test ebx, ebx
jle 0x509d3f
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x5094fc
push eax
push 0x5a1094
add edi, eax
sub esi, eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
test esi, esi
jg 0x5094b7
lea eax, [esp + 0x480]
push 0xfa
push eax
mov ecx, ebp
call fcn.0050abd0
test eax, eax
je 0x509d8c
mov ecx, 5
mov edi, str.HTTP_
lea esi, [esp + 0x480]
xor edx, edx
repe cmpsb byte [esi], byte es:[edi]
jne 0x509d49
mov esi, dword [sym.imp.MSVCRT.dll_strstr]
lea eax, [esp + 0x480]
push 0x5829dc
push eax
call esi
add esp, 8
test eax, eax
je 0x509d49
mov ebx, dword [sym.imp.MSVCRT.dll_atoi]
inc eax
push eax
call ebx
add esp, 4
cmp eax, 0x191
je 0x50958b
cmp eax, 0x197
je 0x50958b
lea ecx, [ebp + 0x8c]
lea edx, [esp + 0x480]
push ecx
push edx
push str.HTTP_Proxy:__s___s_
jmp 0x509b3c
lea ecx, [esp + 0x480]
push 0xfa
push ecx
mov ecx, ebp
call fcn.0050abd0
test eax, eax
je 0x509d8c
mov edi, dword [esp + 0x14]
mov al, byte [esp + 0x480]
test al, al
je 0x509630
lea edx, [esp + 0x480]
push str.Authenticate:_NTLM
push edx
call esi
add esp, 8
test eax, eax
je 0x5095ee
add eax, 0x13
push 0xff
push eax
lea eax, [esp + 0x888]
push eax
call dword [sym.imp.MSVCRT.dll_strncpy]
add esp, 0xc
mov byte [esp + 0x97f], 0
lea ecx, [esp + 0x480]
push str.Content_Length:
push ecx
call esi
add esp, 8
test eax, eax
je 0x50960f
add eax, 0x10
push eax
call ebx
add esp, 4
mov edi, eax
lea edx, [esp + 0x480]
push 0xfa
push edx
mov ecx, ebp
call fcn.0050abd0
test eax, eax
jne 0x5095ab
mov dword [esp + 0x14], edi
jmp 0x509d8c
mov al, byte [esp + 0x880]
mov dword [esp + 0x14], edi
test al, al
jne 0x509677
lea eax, [ebp + 0x8c]
push eax
push str.HTTP_Proxy:_invalid_NTLM_answer___s_
push 1
push 0x596558
call fcn.004aa400
mov eax, dword [ebp + 4]
add esp, 0x10
cmp eax, 0xffffffff
je 0x509d8c
push 2
push eax
call sub.WS2_32.dll_shutdown
mov ecx, dword [ebp + 4]
push ecx
jmp 0x509d80
test edi, edi
jle 0x509765
cmp edi, 0x400
mov ebx, 0x400
ja 0x509690
mov ebx, dword [esp + 0x14]
mov eax, dword [ebp + 4]
mov esi, ebx
cmp eax, 0xffffffff
mov dword [esp + 0x18], 0xa
lea edi, [esp + 0x480]
je 0x509cd8
test ebx, ebx
jl 0x509cd8
jle 0x509700
mov edx, dword [ebp + 4]
push 0
push esi
push edi
push edx
call sub.WS2_32.dll_recv
cmp eax, 1
jge 0x5096ec
call sub.WS2_32.dll_WSAGetLastError
cmp eax, 0x2733
jne 0x509754
mov eax, dword [esp + 0x18]
dec eax
test eax, eax
mov dword [esp + 0x18], eax
jle 0x509754
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x5096fc
push eax
push 0x5a1090
sub esi, eax
add edi, eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
test esi, esi
jg 0x5096b7
xor eax, eax
test ebx, ebx
jle 0x50973f
mov ecx, dword [ebp + 0x1b0]
mov edx, ecx
and edx, 0xf
mov dl, byte [edx + ebp + 0x18c]
add dl, byte [ebp + 0x1ac]
xor byte [esp + eax + 0x480], dl
inc ecx
movsx edx, byte [esp + eax + 0x480]
inc eax
mov dword [ebp + 0x1ac], edx
cmp eax, ebx
mov dword [ebp + 0x1b0], ecx
jl 0x509706
mov eax, dword [esp + 0x14]
sub eax, ebx
test eax, eax
mov dword [esp + 0x14], eax
jle 0x509765
mov edi, eax
jmp 0x50967f
mov eax, dword [ebp + 4]
cmp eax, 0xffffffff
je 0x509cd8
jmp 0x509cc0
lea eax, [esp + 0x880]
lea edx, [esp + 0x880]
mov dword [esp + 0x18], eax
xor ebx, ebx
xor ecx, ecx
xor edi, edi
xor eax, eax
lea esi, [esp + 0x480]
test edx, edx
je 0x5097d4
mov dl, byte [esp + 0x880]
test dl, dl
je 0x5097d4
movsx edx, dl
mov edx, dword [edx*4 + 0x579d64]
cmp edx, 0x40
jae 0x5097d4
shl eax, 6
add ecx, 6
or eax, edx
cmp ecx, 8
jl 0x5097c5
sub ecx, 8
mov edx, eax
shr edx, cl
inc esi
inc edi
cmp edi, 0x3ff
mov byte [esi - 1], dl
jge 0x5097d4
mov edx, dword [esp + 0x18]
inc edx
mov dword [esp + 0x18], edx
mov dl, byte [edx]
test dl, dl
jne 0x509795
mov ecx, 7
mov edi, str.NTLMSSP
lea esi, [esp + 0x480]
xor eax, eax
repe cmpsb byte [esi], byte es:[edi]
je 0x5097fc
lea ecx, [ebp + 0x8c]
push ecx
push str.HTTP_Proxy:_invalid_NTLM_response___s_
jmp 0x509ce4
mov eax, 0x18
mov ecx, 0x80
mov word [esp + 0x14c], ax
mov word [esp + 0x14e], ax
mov word [esp + 0x154], ax
mov word [esp + 0x156], ax
xor eax, eax
lea edi, [esp + 0x180]
mov byte [esp + 0x140], 0x4e
mov byte [esp + 0x141], 0x54
mov byte [esp + 0x142], 0x4c
mov byte [esp + 0x143], 0x4d
mov byte [esp + 0x144], 0x53
mov byte [esp + 0x145], 0x53
mov byte [esp + 0x146], 0x50
mov byte [esp + 0x147], 0
mov dword [esp + 0x148], 3
mov dword [esp + 0x150], ebx
mov dword [esp + 0x158], ebx
mov word [esp + 0x174], bx
mov word [esp + 0x176], bx
mov dword [esp + 0x178], ebx
mov dword [esp + 0x17c], ebx
rep stosd dword es:[edi], eax
lea edi, [esp + 0x380]
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov dword [esp + 0x160], 0x40
shl ecx, 1
cmp cx, bx
mov word [esp + 0x15e], cx
mov word [esp + 0x15c], cx
jle 0x5098fd
mov ecx, eax
add eax, 2
sar ecx, 1
mov dl, byte [esp + ecx + 0x380]
mov byte [esp + eax + 0x17e], dl
mov cx, word [esp + 0x15c]
movsx edx, cx
cmp eax, edx
jl 0x5098d9
mov edi, dword [esp + 0x160]
xor eax, eax
movsx edx, cx
add edx, edi
lea edi, [esp + 0xc0]
or ecx, 0xffffffff
mov dword [esp + 0x168], edx
repne scasb al, byte es:[edi]
not ecx
dec ecx
shl ecx, 1
cmp cx, bx
mov word [esp + 0x166], cx
mov word [esp + 0x164], cx
jle 0x509965
mov ecx, eax
add edx, eax
sar ecx, 1
add eax, 2
mov cl, byte [esp + ecx + 0xc0]
mov byte [esp + edx + 0x140], cl
mov cx, word [esp + 0x164]
movsx edx, cx
cmp eax, edx
mov edx, dword [esp + 0x168]
jl 0x509938
mov eax, dword [esp + 0x34]
movsx ecx, cx
add ecx, edx
lea edx, [eax + eax]
xor eax, eax
mov dword [esp + 0x170], ecx
test dx, dx
mov word [esp + 0x16e], dx
mov word [esp + 0x16c], dx
jle 0x5099b8
jmp 0x509998
mov ecx, dword [esp + 0x170]
mov edx, eax
add ecx, eax
sar edx, 1
add eax, 2
mov dl, byte [esp + edx + 0x3c]
mov byte [esp + ecx + 0x140], dl
movsx ecx, word [esp + 0x16c]
cmp eax, ecx
jl 0x509991
lea edx, [esp + 0x140]
lea eax, [esp + 0x498]
push edx
lea ecx, [esp + 0x104]
push eax
push ecx
mov ecx, ebp
call fcn.00509db0
movsx eax, word [esp + 0x154]
mov edi, dword [esp + 0x158]
lea edx, [esp + 0x10]
add eax, edi
push edx
mov dword [esp + 0x17c], eax
push eax
lea eax, [esp + 0x148]
mov ecx, ebp
push eax
mov dword [esp + 0x188], 0x8201
call fcn.0050aa00
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x988]
mov eax, dword [esp + 0x984]
push ecx
push edx
push eax
push str.CONNECT__s:_d_HTTP_1.0_r_nProxy_Authorization:_NTLM__s_r_n_r_n
lea ecx, [esp + 0x490]
push 0x3ff
push ecx
call dword [sym.imp.MSVCRT.dll__snprintf]
lea edi, [esp + 0x498]
or ecx, 0xffffffff
xor eax, eax
add esp, 0x18
repne scasb al, byte es:[edi]
mov eax, dword [ebp + 4]
mov ebx, 0xa
not ecx
dec ecx
cmp eax, 0xffffffff
mov esi, ecx
lea edi, [esp + 0x480]
je 0x509d8c
test esi, esi
jl 0x509d8c
jle 0x509abd
mov edx, dword [ebp + 4]
push 0
push esi
push edi
push edx
call sub.WS2_32.dll_send
cmp eax, 1
jge 0x509aa9
call sub.WS2_32.dll_WSAGetLastError
cmp eax, 0x2733
jne 0x509b4b
dec ebx
test ebx, ebx
jle 0x509b4b
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x509ab9
push eax
push 0x5a1094
add edi, eax
sub esi, eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
test esi, esi
jg 0x509a74
lea ecx, [esp + 0x480]
push 0xfa
push ecx
mov ecx, ebp
call fcn.0050abd0
test eax, eax
je 0x509d8c
mov ecx, 5
mov edi, str.HTTP_
lea esi, [esp + 0x480]
xor edx, edx
repe cmpsb byte [esi], byte es:[edi]
jne 0x509d1c
mov edi, dword [sym.imp.MSVCRT.dll_strstr]
lea eax, [esp + 0x480]
push 0x5829dc
push eax
call edi
add esp, 8
test eax, eax
je 0x509d1c
mov ebx, dword [sym.imp.MSVCRT.dll_atoi]
inc eax
push eax
call ebx
add esp, 4
cmp eax, 0xc8
je 0x509b68
lea ecx, [ebp + 0x8c]
lea edx, [esp + 0x480]
push ecx
push edx
push str.HTTP_Proxy:_NTLM_auth_failed__s___s_
push 1
push 0x596558
call fcn.004aa400
add esp, 0x14
mov eax, dword [ebp + 4]
cmp eax, 0xffffffff
je 0x509d8c
push 2
push eax
call sub.WS2_32.dll_shutdown
mov eax, dword [ebp + 4]
push eax
jmp 0x509d80
lea ecx, [esp + 0x480]
push 0xfa
xor esi, esi
push ecx
mov ecx, ebp
mov dword [esp + 0x1c], esi
call fcn.0050abd0
test eax, eax
je 0x509d8c
mov al, byte [esp + 0x480]
test al, al
je 0x509bd7
lea edx, [esp + 0x480]
push str.Content_Length:
push edx
call edi
add esp, 8
test eax, eax
je 0x509bb6
add eax, 0x10
push eax
call ebx
add esp, 4
mov esi, eax
lea eax, [esp + 0x480]
push 0xfa
push eax
mov ecx, ebp
call fcn.0050abd0
test eax, eax
jne 0x509b8a
mov dword [esp + 0x14], esi
jmp 0x509d8c
test esi, esi
mov dword [esp + 0x14], esi
jle 0x509d01
cmp esi, 0x400
mov ebx, 0x400
ja 0x509bf4
mov ebx, dword [esp + 0x14]
mov eax, dword [ebp + 4]
mov esi, ebx
cmp eax, 0xffffffff
mov dword [esp + 0x18], 0xa
lea edi, [esp + 0x480]
je 0x509cd8
test ebx, ebx
jl 0x509cd8
jle 0x509c64
mov ecx, dword [ebp + 4]
push 0
push esi
push edi
push ecx
call sub.WS2_32.dll_recv
cmp eax, 1
jge 0x509c50
call sub.WS2_32.dll_WSAGetLastError
cmp eax, 0x2733
jne 0x509cb8
mov eax, dword [esp + 0x18]
dec eax
test eax, eax
mov dword [esp + 0x18], eax
jle 0x509cb8
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x509c60
push eax
push 0x5a1090
sub esi, eax
add edi, eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
test esi, esi
jg 0x509c1b
xor eax, eax
test ebx, ebx
jle 0x509ca3
mov ecx, dword [ebp + 0x1b0]
mov edx, ecx
and edx, 0xf
mov dl, byte [edx + ebp + 0x18c]
add dl, byte [ebp + 0x1ac]
xor byte [esp + eax + 0x480], dl
inc ecx
movsx edx, byte [esp + eax + 0x480]
inc eax
mov dword [ebp + 0x1ac], edx
cmp eax, ebx
mov dword [ebp + 0x1b0], ecx
jl 0x509c6a
mov eax, dword [esp + 0x14]
sub eax, ebx
test eax, eax
mov dword [esp + 0x14], eax
jle 0x509d01
mov esi, eax
jmp 0x509be3
mov eax, dword [ebp + 4]
cmp eax, 0xffffffff
je 0x509cd8
push 2
push eax
call sub.WS2_32.dll_shutdown
mov eax, dword [ebp + 4]
push eax
call sub.WS2_32.dll_closesocket
mov dword [ebp + 4], 0xffffffff
lea ecx, [ebp + 0x8c]
push ecx
push str.HTTP_Proxy:_invalid_NTLM_answer_content___s_
push 1
push 0x596558
call fcn.004aa400
mov eax, dword [ebp + 4]
add esp, 0x10
cmp eax, 0xffffffff
je 0x509d8c
jmp 0x509d74
lea ecx, [esp + 0x10]
call sub.MFC42.DLL_CString::CString
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x970
ret 8
lea eax, [ebp + 0x8c]
lea ecx, [esp + 0x480]
push eax
push ecx
push str.HTTP_Proxy:_invalid_answer__s___s_
push 1
push 0x596558
call fcn.004aa400
add esp, 0x14
mov eax, dword [ebp + 4]
cmp eax, 0xffffffff
je 0x509d8c
jmp 0x509d74
lea eax, [ebp + 0x8c]
lea ecx, [esp + 0x480]
push eax
push ecx
push str.HTTP_Proxy:_invalid_answer__s___s_
push 1
push 0x596558
call fcn.004aa400
mov eax, dword [ebp + 4]
add esp, 0x14
cmp eax, 0xffffffff
je 0x509d8c
push 2
push eax
call sub.WS2_32.dll_shutdown
mov edx, dword [ebp + 4]
push edx
call sub.WS2_32.dll_closesocket
mov dword [ebp + 4], 0xffffffff
lea ecx, [esp + 0x10]
call sub.MFC42.DLL_CString::CString
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x970
ret 8