Using CONNECT method on a http proxy using telnet

The simplest way to connect to an external server using a proxyserver.

C:\Work>telnet proxyserver 8080
Trying 192.168.1.20...
Connected to proxyserver.
Escape character is '^]'.
CONNECT irc.freenode.org:6667 HTTP/1.1

HTTP/1.1 200 Connection established

:kornbluth.freenode.net NOTICE * :*** Looking up your hostname...
:kornbluth.freenode.net NOTICE * :*** Checking Ident
:kornbluth.freenode.net NOTICE * :*** Found your hostname
:kornbluth.freenode.net NOTICE * :*** No Ident response

In this case we are connecting to a proxyserver on port 8080. After that we open a http tunnel to irc.freenode.org on port 6667. Then you need to press enter twice to establish the connection. After that you have an open socket and you can send the commands accordingly based on the protocol being used. Here we connect to an IRC server.

We could do the same thing by connecting to a HTTP server. You can apply the logic by opening a socket to the proxy server and then sending and receiving over the socket if you are doing socket programming. The only extra things you need to take care is to open the tunnel the rest of the logic remains the same.
 
C:\Work>telnet proxyserver 8080
Trying 192.168.1.20...
Connected to proxyserver.
Escape character is '^]'.
CONNECT www.google.com:80 HTTP/1.0

HTTP/1.1 200 Connection established

GET / HTTP/1.0

HTTP/1.0 200 OK
Date: Tue, 24 Sep 2013 08:34:43 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: [a dozen cookies]
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic
.
.
.

Comments

hajikhatri said…
It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it! vpn free
Scott Romero said…
Great read, thank you.

Popular posts from this blog

The best mobile development platform for hobbyist programmer

Using Voicemail with Airtel Prepaid Karnataka

And yet more invites for joost