青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

elva

HTTP Tunneling

Introduction

HTTP Tunneling

HTTP is a text-based protocol to retrieve Web pages through a Web browser. Mostly, if you are on a LAN connection, you are behind a proxy server; this proxy server has one HTTP proxy running on some defined port. In your Internet Explorer's Connection option, you specify LAN settings as required. This proxy server is definitely running on a text-based protocol, and you can only get HTTP-related data from the outside network, right!! Well, there is a small loophole from which you can go through HTTP and connect to the outside world and get any data you want in binary protocol, or even your own protocol. It's through HTTPS.

HTTPS Explanation

In HTTPS, data is transferred from browser to server and server to browser in a secure manner. It's a binary protocol; when it goes through a proxy, the proxy doesn't understand anything. The proxy just allows a binary stream to open and lets both server and client exchange the data. Now, we can fool the proxy server and connect to any server and exchange data. The proxy server will think that we are doing some secure HTTP session.

For HTTPS, your browser connects to a proxy server and sends a command:

CONNECT neurospeech.com:443 HTTP/1.0 <CR><LF>
HOST neurospeech.com:443<CR><LF>
[... other HTTP header lines ending with <CR><LF> if required]>
<CR><LF>    // Last Empty Line

Then, the proxy server treats this as some HTTP Secure Session, and opens a binary stream to the required server and port as defined. If a connection is established, the proxy server returns the following response:

HTTP/1.0 200 Connection Established<CR><LF>
[.... other HTTP header lines ending with <CR><LF>..
ignore all of them]
<CR><LF>    // Last Empty Line

Now, the browser is connected to the end server and can exchange data in both a binary and secure form.

How 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.

Sample Source Code

Collapse
  // You need to connect to mail.yahoo.com on port 25
// Through a proxy on 192.0.1.1, on HTTP Proxy 4480
// CSocketClient is Socket wrapping class
// When you apply operator << on CString, it writes CString
// To Socket ending with CRLF
// When you apply operator >> on CString, it receives
// a Line of response from socket until CRLF
try
{
CString Request,Response;
CSocketClient Client;
Client.ConnectTo("192.0.1.1",4480);
// Issue CONNECT Command
Request = "CONNECT mail.yahoo.com:25 HTTP/1.0";
Client<<Request;
// Issue empty line
Request = "";
Client<<Request;
// Receive Response From Server
Client>>Response;
// Ignore HTTP Version
int n = Response.Find(' ');
Response = Response.Mid(n+1);
// Http Response Must be 200 only
if(Response.Left(3)!="200")
{
// Connection refused from HTTP Proxy Server
AfxMessageBox(Response);
}
// Read Response Lines until you receive an empty line.
do
{
Client>>Response;
if (Response.IsEmpty())
break;
}while (true);
// Coooooooool.... Now connected to mail.yahoo.com:25
// Do further SMTP Protocol here..
}
catch (CSocketException * pE)
{
pE->ReportError();
}

Library Source Code

The Dns.h file contains all DNS-related source code. It uses other libraries, as SocketEx.h, SocketClient.h, and NeuroBuffer.h.

CSocketEx

Socket functions as a wrapper class. (CSocket is very heavy and unreliable if you don't have the exact idea of how it works.) All the functions are of the same name as CSocket. You can use this class directly.

CSocketClient

Derived from CSocketEx and throws proper exceptions with details of Winsock errors. It defines two operators, >> and <<, for easy sending and receiving; it also changes network to host and host to network order of bytes if required.

CHttpProxySocketClient

Derived from CSocketClient, you can call the SetProxySettings(ProxyServer,Port) method and set proxy settings. Then, you can connect to the desired host and port as you need. The ConnectTo method is overridden, and it automatically implements an HTTP proxy protocol and gives you a connection without any hassle.

How to Use CHttpProxySocketClient

Collapse
  // e.g. You need to connect to mail.yahoo.com on port 25
// Through a proxy on 192.0.1.1, on HTTP Proxy 4480
// CSocketClient is Socket wrapping class
// When you apply operator << on CString, it writes CString
// To Socket ending with CRLF
// When you apply operator >> on CString, it receives
// Line of response from socket until CRLF
try
{
CHttpProxySocketClient Client;
Client.SetProxySettings("192.0.1.1",1979);
// Connect to server mail.yahoo.com on port 25
Client.ConnectTo("mail.yahoo.com",25);
// You now have access to mail.yahoo.com on port 25
// If you do not call SetProxySettings, then
// you are connected to mail.yahoo.com directly if
// you have direct access, so always use
// CHttpProxySocketClient and no need to do any
// extra coding.
}
catch(CSocketException * pE) {
pE->ReportError();
}

Note: I usually don't program in the form of .h and .cpp different files, because using them the next time somewhere else is a big problem because you must move both files here and there. So, I put all the code in my .h file only; I don't write to the .cpp file unless it's required. You need to copy only the SocketEx.h, SocketClient.h, and HttpProxySocket.h files into your project's directory, and add line:

#include "HttpProxySocket.h"

after your:

#if !defined(.....

and so forth code of your Visual Studio-generated file. If you put anything above this, you will get n number of errors.

 

posted on 2007-05-06 16:51 葉子 閱讀(709) 評論(0)  編輯 收藏 引用 所屬分類: 網絡安全

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲国产日韩一级| 亚洲国产日韩欧美在线图片| 欧美精品啪啪| 国产免费成人av| 亚洲精品看片| 一本色道久久综合亚洲91| 欧美sm视频| 亚洲国产精品国自产拍av秋霞| 麻豆精品视频在线观看| 精品福利电影| 久久偷窥视频| 欧美激情视频在线免费观看 欧美视频免费一 | 欧美女激情福利| 亚洲免费视频一区二区| 久久av红桃一区二区小说| 国产一区二区三区网站| 免费成人高清在线视频| 中文成人激情娱乐网| 久久精彩免费视频| 91久久线看在观草草青青| 欧美福利视频一区| 欧美一级成年大片在线观看| 久久婷婷影院| 在线亚洲高清视频| 亚洲第一成人在线| 欧美伦理91i| 欧美日韩在线一区二区| 欧美一区亚洲二区| 一区二区欧美在线观看| 亚洲福利视频在线| 亚洲国内欧美| 亚洲欧美日韩爽爽影院| 久久精品国产精品亚洲精品| 亚洲欧美久久久久一区二区三区| 牛牛国产精品| 欧美三级网址| 极品少妇一区二区三区| 99在线热播精品免费| 久久久久久久一区| 亚洲一区制服诱惑| 日韩视频在线观看免费| 欧美日韩ab| 午夜精品一区二区在线观看| 老司机一区二区| 亚洲欧美卡通另类91av | 亚洲一二三区精品| 亚洲欧美中日韩| 激情欧美日韩一区| 亚洲一区精品在线| 日韩一级黄色片| 亚洲国产三级网| 欧美二区在线| 欧美v日韩v国产v| 亚洲国产天堂久久国产91| 国产精品入口福利| 欧美成人性网| av成人免费观看| 亚洲破处大片| 午夜影院日韩| 亚洲巨乳在线| 欧美一区二区三区视频免费播放| 欧美日韩国产页| 亚洲精品国产视频| 亚洲精品久久久久中文字幕欢迎你| 欧美福利一区二区| 欧美高清在线一区二区| 欧美精品日韩三级| 欧美亚洲日本网站| 裸体丰满少妇做受久久99精品| 国内精品久久久久久久97牛牛| 国产日韩欧美黄色| 国产真实久久| 夜夜嗨av一区二区三区中文字幕 | 亚洲裸体在线观看| 国产精品高潮呻吟久久av黑人| 在线观看视频欧美| 亚洲乱码国产乱码精品精天堂| 亚洲精品之草原avav久久| 亚洲视屏一区| 亚洲美女淫视频| 欧美在线观看一区| 欧美亚洲综合网| 欧美本精品男人aⅴ天堂| 欧美在线观看你懂的| 欧美r片在线| 午夜国产精品影院在线观看| 在线视频亚洲欧美| 免费日韩成人| 欧美国产综合| 最新日韩av| 欧美揉bbbbb揉bbbbb| 一区二区在线观看视频在线观看 | 欧美成人黄色小视频| 国产精品青草久久久久福利99| 亚洲天堂av高清| 久久在精品线影院精品国产| 黄色亚洲在线| 免费在线看一区| 日韩西西人体444www| 国产精品高潮粉嫩av| 午夜一区在线| 亚洲高清在线| 亚洲欧美美女| 亚洲国产精品第一区二区三区| 日韩亚洲欧美成人| 欧美日韩成人一区二区| 免费成人av在线| 亚洲欧洲精品一区二区三区波多野1战4 | 在线日韩av片| 久久精品国产99| 欧美大片在线观看| 亚洲理伦电影| 国产精品一区毛片| 免费视频一区| 欧美国产亚洲另类动漫| 亚洲一本视频| 在线亚洲欧美| 91久久精品国产| 国产精品v欧美精品v日本精品动漫 | 在线看成人片| 欧美电影电视剧在线观看| 午夜精品久久久99热福利| 亚洲国产一区二区三区高清| 欧美日本一区| 欧美国产视频在线观看| 久久综合九色99| 欧美超级免费视 在线| 亚洲一区二区成人在线观看| 永久域名在线精品| 极品日韩久久| 亚洲午夜一二三区视频| 香蕉视频成人在线观看| 亚洲综合欧美日韩| 欧美在线播放| 亚洲国产一区二区三区在线播| 在线综合亚洲欧美在线视频| 亚洲欧洲视频在线| 亚洲视频在线观看视频| 99视频精品免费观看| 久久只有精品| 亚洲免费成人av| 一区二区高清在线| 久久伊伊香蕉| 国产精品视频一区二区高潮| 国产精品青草久久久久福利99| 欧美精品色综合| 国产精品美女久久久久久2018| 黄网站色欧美视频| 国产精品久久久久一区二区三区共| 欧美精品大片| 黄色成人在线网站| 欧美一级专区| 中文精品视频| 国产精品一区二区久激情瑜伽| 在线精品亚洲| 久久综合九色| 免费人成网站在线观看欧美高清 | 亚洲欧美另类久久久精品2019| 女女同性女同一区二区三区91| 亚洲人妖在线| 欧美色区777第一页| 一区二区视频欧美| 美国成人毛片| 久久人人爽国产| 日韩亚洲欧美成人| 亚洲美女黄网| 欧美日韩中文字幕精品| 亚洲尤物视频在线| 欧美精品日韩一本| 国产一区清纯| 久久男人av资源网站| 欧美亚洲一区二区在线观看| 裸体一区二区三区| 精品不卡一区| 亚洲图中文字幕| 亚洲国语精品自产拍在线观看| 99伊人成综合| 麻豆av一区二区三区久久| 欧美大片免费久久精品三p | 国产精品h在线观看| 亚洲欧美春色| 亚洲香蕉在线观看| 国产日产亚洲精品| 一本久久综合| 亚洲精品少妇30p| 久久久久久91香蕉国产| 性亚洲最疯狂xxxx高清| 亚洲人成网站777色婷婷| 午夜精品久久久99热福利| 亚洲电影有码| 一区二区三区.www| 韩国一区电影| 亚洲一区二区av电影| 亚洲国产综合视频在线观看| 在线视频欧美一区| 在线免费观看视频一区| 亚洲欧美视频在线观看| 99精品热视频| 欧美色视频日本高清在线观看| 欧美成人午夜激情视频|