after sending authentication and request how work through proxy?
http://tools.ietf.org/search/rfc1928
Quote
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\wsock32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wsock32.lib
.data
MessageBuffer db INTERNET_MAX_URL_LENGTH dup (0)
ProxyAddress db '127.0.0.1',0
szNOAUTH db 5h, 1h, 0h
szCONNECT db 5, 1, 0, 3, 14, 'smtp.yandex.ru', 0, 25, 0
szEHLO db 'HELO localhost', 13, 10
db 0
szSEND db 'HELO localhost', 13, 10
db 0
.data?
Buffer db 65536 dup(?)
String db 65536 dup(?)
wsaData WSADATA<>
s1 SOCKET ?
sin1 sockaddr_in <>
.code
start:
invoke WSAStartup, 0101h, ADDR wsaData
mov ax,0101h
cmp ax, wsaData.wVersion
jne NoTelnet
invoke socket,AF_INET,SOCK_STREAM,IPPROTO_TCP;0
mov s1,eax
mov ax,AF_INET
mov sin1.sin_family,ax
invoke htons,1080
mov sin1.sin_port,ax
invoke inet_addr, addr ProxyAddress
mov sin1.sin_addr,eax
invoke connect, s1, addr sin1, sizeof sockaddr_in
cmp eax, -1
je NoTelnet
invoke send, s1, addr szNOAUTH, 3, 0
invoke recv, s1, addr String, 65536,0
invoke send, s1, addr szCONNECT, sizeof szCONNECT, 0
invoke recv, s1, addr String, 65536,0
cmp byte ptr [String+1],0
jne ProxyFail
invoke recv, s1, addr String, 65536,0
lea ebx, String
add ebx, eax
mov byte ptr [ebx],0
invoke StdOut,ADDR String
invoke StdOut,ADDR szSEND ;???????????????????????????????????
invoke send, s1, addr szSEND, sizeof szSEND,0
invoke recv, s1, addr String, 65536,0
lea ebx, String
add ebx, eax
mov byte ptr [ebx],0
invoke StdOut,ADDR String
invoke StdOut,ADDR szEHLO
invoke send, s1, addr szEHLO, sizeof szEHLO,0
invoke recv, s1, addr String, 65536,0
lea ebx, String
add ebx, eax
mov byte ptr [ebx],0
invoke StdOut,ADDR String
ProxyFail:
invoke closesocket, s1
NoTelnet:
invoke WSACleanup
invoke Sleep, 5000
invoke ExitProcess,0
end start
(http://xmages.net/storage/10/1/0/6/d/upload/04201c77.png)
Quote
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\wsock32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wsock32.lib
.data
Message db 'GET / HTTP/1.1', 13, 10
db 'Accept: */*', 13, 10
db 'Accept-Language: ru', 13, 10
db 'Accept-Encoding: gzip, deflate', 13, 10
db 'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)', 13, 10
db 'Host: localhost', 13, 10
db 'Connection: Keep-Alive', 13, 10, 13, 10
db 0
ProxyAddress db '127.0.0.1',0
szNOAUTH db 5h, 1h, 0h
szCONNECT db 5, 1, 0, 1, 127, 0, 0, 1, 0, 80, 0
szEHLO db 'HELO localhost', 13, 10
db 0
szSEND db 13, 10
db 0
.data?
Buffer db 65536 dup(?)
String db 65536 dup(?)
wsaData WSADATA<>
s1 SOCKET ?
sin1 sockaddr_in <>
.code
start:
invoke WSAStartup, 0101h, ADDR wsaData
mov ax,0101h
cmp ax, wsaData.wVersion
jne NoTelnet
invoke socket,AF_INET,SOCK_STREAM,IPPROTO_TCP;0
mov s1,eax
mov ax,AF_INET
mov sin1.sin_family,ax
invoke htons,1080
mov sin1.sin_port,ax
invoke inet_addr, addr ProxyAddress
mov sin1.sin_addr,eax
invoke connect, s1, addr sin1, sizeof sockaddr_in
cmp eax, -1
je NoTelnet
invoke send, s1, addr szNOAUTH, 3, 0
invoke recv, s1, addr String, 65536,0
invoke send, s1, addr szCONNECT, sizeof szCONNECT, 0
invoke recv, s1, addr String, 65536,0
cmp byte ptr [String+1],0
jne ProxyFail
invoke StdOut,ADDR Message
invoke lstrlen, addr Message
invoke send, s1, addr Message, eax,0
invoke recv, s1, addr String, 65536,0
lea ebx, String
add ebx, eax
mov byte ptr [ebx],0
invoke StdOut,ADDR String
ProxyFail:
invoke closesocket, s1
NoTelnet:
invoke WSACleanup
invoke Sleep, 5000
invoke ExitProcess,0
end start
(http://xmages.net/storage/10/1/0/1/4/upload/886d06da.png)
It's telling you that you sending a bad request.... First off.. That zero char at the end of your headers is not needed.... Second, you don't send null terminated strings to the server... That is why you give send a length. Minus the null. So you are sending noauth and telling send it is 3 bytes... It is only 2
delirium
http://tools.ietf.org/search/rfc1928
zNOAUTH db 5h, 1h, 0h
szCONNECT db 5, 1, 0, 3, 14, 'smtp.yandex.ru', 0, 25, 0
5H, 1h, 5, 1, and ,0 are control characters... Sending them to a server is a good way to get your ip blocked from using the server... Be careful what you send to a server... If you are trying to send the numbers 5,1, and 0.... Enclose them in quotes...
(http://xmages.net/storage/10/1/0/5/6/upload/c72c40e3.png)
(http://xmages.net/storage/10/1/0/5/6/upload/910dc1b6.png)
Try without 0
the answer from server
(http://xmages.net/storage/10/1/0/6/d/upload/04201c77.png)
May be request must be modificate or something else must be send to proxy after authorization and connect request which not in rfc
you was partially wright
szCONNECT db 5, 1, 0, 3, 14, 'smtp.yandex.ru', 0, 25;, 0
This NULL was excess
(http://xmages.net/storage/10/1/0/3/8/upload/b30e9762.png)
somebody knows how with HTTP proxy work? Please help
with socks5 also workin not very correct sometimes application begin use 100% of processor (http://smiles.kolobok.us/light_skin/cray.gif)
QuoteHow to Do This
Now, it's your program's turn to fool the proxy server and behave as Internet Explorer behaves for Secure HTTP.
1. Connect to Proxy Server first.
2. Issue CONNECT Host:Port HTTP/1.1<CR><LF>.
3. Issue <CR><LF>.
4. Wait for a line of response. If it contains HTTP/1.X 200, the connection is successful.
5. Read further lines of response until you receive an empty line.
6. Now, you are connected to the outside world through a proxy. Do any data exchange you want.
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\wsock32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wsock32.lib
.data
ProxyAddress db '127.0.0.1',0 ; proxy address
szNOAUTH db 'CONNECT www.google.com HTTP/1.1',13,10,13,10
Message db 'GET http://www.google.ru/ HTTP/1.1', 13, 10
db 'Accept: */*', 13, 10
db 'Accept-Language: ru', 13, 10
db 'Accept-Encoding: text/html', 13, 10
db 'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)', 13, 10
db 'Host: www.google.ru', 13, 10
db 'Proxy-Connection: Keep-Alive', 13, 10, 13, 10
db 0
FName db 'noname.htm',0
Header db 13,10,13,10
.data?
String db 65536 dup(?)
wsaData WSADATA<>
s1 SOCKET ?
sin1 sockaddr_in <>
bytesRecieve dd ?
hFile dd ?
bytesWrite dd ?
MemoryEnd dd ?
HeaderEND dd ?
.code
start:
invoke WSAStartup, 0101h, ADDR wsaData
mov ax,0101h
cmp ax, wsaData.wVersion
jne NoTelnet
invoke socket,AF_INET,SOCK_STREAM,IPPROTO_TCP;0
mov s1,eax
mov ax,AF_INET
mov sin1.sin_family,ax
invoke htons,156 ;proxy port
mov sin1.sin_port,ax
invoke inet_addr, addr ProxyAddress
mov sin1.sin_addr,eax
invoke connect, s1, addr sin1, sizeof sockaddr_in
cmp eax, -1
je NoTelnet
invoke send, s1, addr szNOAUTH, sizeof szNOAUTH,0
invoke recv, s1, ADDR String, 65536,0
invoke StdOut,ADDR String
invoke lstrlen, addr Message
invoke send, s1, addr Message, eax,0
invoke recv, s1, addr String, 65536,0
mov bytesRecieve, eax
invoke CreateFile, addr FName, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ,\
NULL,CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN,NULL
mov hFile, eax
invoke WriteFile, hFile, addr String, bytesRecieve, addr bytesWrite,NULL
invoke CloseHandle, hFile
invoke closesocket, s1
NoTelnet:
invoke WSACleanup
invoke Sleep, 1000
invoke ExitProcess,0
end start
118.96.8.196:3128
I get the begin of page, but can't get all
form db 'bytesRecieve %u',13,10,0
----------------------------------------
invoke CreateFile, addr FName, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ,\
NULL,CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN,NULL
mov hFile, eax
----------------------------------------
lea ebx, String
xor eax, eax
@@:
invoke wsprintf,ADDR Buffer,ADDR form, eax
invoke StdOut,ADDR Buffer
invoke recv, s1, ebx, 65536,0
; cmp eax, -1
; jz @B
add bytesRecieve, eax
add ebx, eax
; test eax, eax
; jnz @B
invoke WriteFile, hFile, addr String, bytesRecieve, addr bytesWrite,NULL
invoke CloseHandle, hFile
request was wrong
Message db 'GET / HTTP/1.1', 13, 10
db 'Accept: */*', 13, 10
db 'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)', 13, 10
db 'Host: www.google.ru', 13, 10
db 'Connection: Keep-Alive', 13, 10
db 'Pragma: no-cache', 13, 10
db 'Cache-Control: no-cache', 13, 10, 13, 10
db 0
invoke recv, s1, ebx, 1024,0 and buffer