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

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>
            久久久久久久精| 久久亚裔精品欧美| 黄色成人小视频| 国产日产欧美一区| 国产精品一区二区女厕厕| 欧美午夜电影一区| 国产欧美日韩综合一区在线观看| 国产色视频一区| 一色屋精品视频在线看| 亚洲人成网站在线播| 宅男噜噜噜66一区二区66| 午夜日韩av| 欧美激情网站在线观看| 在线综合欧美| 久久视频在线看| 欧美午夜片在线免费观看| 国产婷婷色一区二区三区四区| 激情小说亚洲一区| 一区二区三区免费看| 久久久精品一品道一区| 亚洲黄色精品| 99riav国产精品| 久久青草久久| 国产精品夜夜夜一区二区三区尤| 在线观看欧美激情| 亚洲欧美国产制服动漫| 美日韩精品视频| 亚洲私拍自拍| 欧美激情在线免费观看| 国产亚洲激情视频在线| 亚洲毛片视频| 免费不卡在线视频| 亚洲在线观看免费视频| 欧美大成色www永久网站婷| 国产麻豆视频精品| 亚洲视频欧美视频| 欧美成年网站| 久久精品国产综合| 国产精品网红福利| 亚洲国产精品va在线看黑人动漫| 亚洲一区免费视频| 亚洲国产精品专区久久| 久久精品一区二区三区不卡| 国产精品wwwwww| 夜夜嗨av一区二区三区| 麻豆精品一区二区av白丝在线| 在线一区二区三区四区| 欧美激情精品久久久久久变态| 国产一区二区精品| 午夜在线精品偷拍| 中日韩在线视频| 亚洲韩国青草视频| 欧美在线观看视频一区二区三区| 亚洲视频axxx| 午夜在线观看欧美| 亚洲午夜影视影院在线观看| 亚洲综合三区| 欧美成人午夜剧场免费观看| 亚洲激情女人| 久久精品国产77777蜜臀| 欧美日韩国产在线一区| 影音先锋亚洲一区| 午夜精品美女久久久久av福利| 久久亚洲不卡| 久久丁香综合五月国产三级网站| 欧美区日韩区| 亚洲国产中文字幕在线观看| 免费欧美在线| 欧美激情在线有限公司| 在线中文字幕日韩| 亚洲网站在线播放| 韩国三级在线一区| 亚洲国产三级| 激情婷婷欧美| 日韩亚洲不卡在线| 国产日韩欧美日韩| 欧美大片91| 国产精品久久久久91| 欧美影院在线播放| 欧美怡红院视频| 国产一区在线看| 亚洲国产一二三| 欧美日本久久| 久久久99免费视频| 欧美日韩精品一区二区三区| 亚洲男人的天堂在线aⅴ视频| 欧美另类videos死尸| 亚洲深夜激情| 免费久久99精品国产| 久久久亚洲高清| 国产欧美一区二区三区在线老狼 | 久久亚洲一区二区三区四区| 欧美午夜宅男影院| 亚洲国产婷婷香蕉久久久久久| 精品69视频一区二区三区| 亚洲第一免费播放区| 亚洲国产乱码最新视频| 欧美成人有码| 亚洲日本欧美日韩高观看| 在线视频一区二区| 欧美视频精品一区| 亚洲一区久久| 欧美电影免费| 性久久久久久| 亚洲图片在线| 91久久精品一区| 国产日韩精品视频一区二区三区| 久久亚洲视频| 午夜精品久久久久久久99樱桃 | 久久久久欧美| 亚洲一区二区动漫| 亚洲精品在线观| 91久久国产综合久久91精品网站| 久久嫩草精品久久久精品一| 久久精品久久综合| 亚洲第一在线综合在线| 欧美一区二区三区精品| 国产裸体写真av一区二区| 一本久久综合| 欧美成人午夜| 久久亚洲欧美| 亚洲欧美日韩成人| 亚洲国产cao| 在线欧美电影| 国产精品免费在线| 欧美精品一区在线观看| 亚洲精品一区二区三区婷婷月| 亚洲欧美影院| 99riav1国产精品视频| 国产伊人精品| 国产在线一区二区三区四区| 免费人成网站在线观看欧美高清| 日韩视频一区二区在线观看 | 一区二区精品国产| 黄色日韩在线| 国产精品一区2区| 欧美日韩成人综合在线一区二区 | 亚洲精品视频在线| 欧美电影免费观看网站| 久久中文久久字幕| 久久成人综合网| 亚洲欧美成人网| 午夜精品福利一区二区三区av| 99国产精品99久久久久久| 日韩午夜一区| 午夜国产欧美理论在线播放| 欧美在线观看视频| 亚洲欧美日韩精品久久久久| 欧美亚洲一区| 欧美天天影院| 欧美日韩国产小视频| 国产精品一二三| 欧美日韩国产综合新一区| 欧美午夜国产| 在线欧美福利| 久久精品成人一区二区三区| 葵司免费一区二区三区四区五区| 亚洲激情婷婷| 久久高清福利视频| 欧美日韩在线播放一区二区| 国产精品午夜电影| 日韩一二三在线视频播| 亚洲综合日韩中文字幕v在线| 欧美成人午夜激情| 亚洲网站视频| 欧美日韩在线播放三区四区| 国产亚洲精品久久久久久| 在线视频精品一区| 蜜臀99久久精品久久久久久软件| 99精品国产高清一区二区| 欧美在线观看网址综合| 国产日韩欧美一区二区三区在线观看 | 久久久久国产一区二区三区| 国产午夜精品久久久久久久| 亚洲视频一二| 在线亚洲+欧美+日本专区| 久久综合久久久| 精品白丝av| 欧美一区二区三区四区高清 | 亚洲国产一二三| 午夜欧美大片免费观看| 亚洲欧美第一页| 极品裸体白嫩激情啪啪国产精品| 亚洲你懂的在线视频| 亚洲欧美日韩国产成人| 欧美日本成人| 欧美日韩国产在线| 99人久久精品视频最新地址| 美女91精品| 欧美人成网站| 欧美一二三区在线观看| 欧美一区二区三区喷汁尤物| 国内揄拍国内精品久久| 中文在线资源观看视频网站免费不卡| 欧美国产三级| 欧美中文在线观看| 欧美极品欧美精品欧美视频| 99re国产精品| 久久久精品国产99久久精品芒果| av成人黄色|