代码改变世界

从Gmail的一个瑕疵谈HTTPRequst

2009-12-15 21:57  宗哥  阅读(3110)  评论(7编辑  收藏  举报

1.WEB访问到底怎么回事

   通常我们开发的asp.net应用程序无非就是把我们CLient端的Data/Request通过Net,借助HTTP协议Post或者Get到Server端。然后CLient的借助Explorer展示Server回发的Response数据。这个我们通过ieHttpHeaders工具“窥豹”一番。以Gmail的登陆界面为例:

注意ieHTTPHeaders的监控数据,黑色部分为Request的Post数据,蓝色部分为Server的Response的部分数据。这个网络的访问规程遵循什么规则那?

2.说说HTTP协议

    如果你从事WEB开发开发,最好了解下HTTP协议,对你开发健壮,安全的程序大有裨益。HTTP的全称是HyperText Transfer Protocol,即超文本传输协议超文本传输协议。作为一种应用层协议,HTTP在可靠的网络层协议(例如TCP/IP)的基础上提供了在Web服务器和客户之间传输信息的一种机制,并规定了客户与服务器之间交互的各种消息。下图可以形象说明他:

对于HTTP请求:

方法(method):表示客户端希望服务器如何处理该信封。有GET、POST、PUT、DELETE、HEAD、OPTION、TRACE和CONNECT八个方法。
路径(path):请求链接里主机名后面部分,即信封上的地址。
请求报头(request headers):一组起元数据作用的键值对,类似信封上贴的标签信息。HTTP除定义了一套标准报头外,程序也可以自己定义报头。
实体主体(entity-body):也称作文档或表示,即信封里的文档。一般情况下,请求实体主体可为空。

对于HTTP相应:

响应代码(response code):通知客户端请求成功或失败,以及如何处理信封里的内容。

响应报头(response header):类似请求报头。

实体主体(entity-body):同样是放在信封里的文档,但绝大多数情况它不会为空。

理解了以上部分,我们就如何进行HTTP的Request?

3.C#模拟HTTP的Requst

 System.Web 命名空间提供使得可以进行浏览器与服务器通信的类和接口。此命名空间包括 HttpRequest 类(用于提供有关当前 HTTP 请求的广泛信息)、HttpResponse 类(用于管理对客户端的 HTTP 输出)以及 HttpServerUtility 类(用于提供对服务器端实用工具与进程的访问)。

首先我们来Code模拟Requset并获得Response的类:

 1   public string SendRequest(string url, NameValueCollection parm, string sendData)
 2     {
 3         ASCIIEncoding encoding = new ASCIIEncoding();
 4         byte[] data = encoding.GetBytes(sendData);
 5         HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); 
 6         request.Method = "POST"
 7         request.ContentType = "application/x-www-form-urlencoded"
 8         request.ContentLength = data.Length;
 9 
10         request.Headers.Add(parm);
11         Stream sm = request.GetRequestStream(); 
12         sm.Write(data, 0, data.Length);
13         sm.Close();
14 
15         HttpWebResponse response = (HttpWebResponse)request.GetResponse();
16         StreamReader myreader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); 
17         string responseText = myreader.ReadToEnd(); 
18 
19         return responseText;
20     }
21 

 注意:参数url表示你请求的Server的,parm表示Request的Header的一些属性,SendData是用iehttpHeaders最后一行数据。

4.Gmail的一个瑕疵

 Gmail是很强大的,很多人都爱用。在注册Gmail时候的最后一步要求你填写手机进行Code验证,这个时候我们可以截取HTTP报数据,如下图:

好,接着我们模拟请求的代码如下:

 

代码
static void Main(string[] args)
        {
            Console.WriteLine(
"Please input your Mobile No:");

            
string mobileNo = Console.ReadLine();

            SimulateRequest s 
= new SimulateRequest();
            
            
string url = "https://www.google.com/accounts/IdvChallenge?service=mail&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-117f7fb74c714e689c89d9067dc9f296-0be8e3542e11fd77bbb126be7d2c99a5fb5f34e9&type=2";
            
string sendData = "MobileCountry=CN&MobileNumber="+mobileNo+"&idvToken=5cKRkSUBAAA.6CcHLTi-npLuqYaP8o2JIAwhDeco_kiaWKK_XQfRT_vSvvZFAHSKA13mQK-evK5CqzCRe9YvTHQHK4WuBBYyYQ.fSDlZa7qCyKcl5OtFcEcfg&sft=B9CQkSUBAAA.FloI_oy5zQi7SuEbWoI7rMOQZkngOpCmONWHXaq4HyMbDCNVoh-5PT1BVTqtUVSRUohZ3z9mZgd3WdDsKhXaR0B6aWzJ0l9FsTpuFRNWMbDJHx6uEQpiJ4o1Bt2zRkK8v7UlbOG-oHr_lW8CfK7DCYk_qV7J7_rxfHlNhFuicz3kPAPn0V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ZUyYG6sr9y48xJgggRLOFp-TcHaJWrypHo_Evp-xNWH14YnHVpy___QN2gZuA_q1ad3aGLeKh8HrNVVyHMlwkbKKAJfVIaJqyxqUm54sCQY6HosIbgTruty-Abm4dZSx5ZpdTzc_o-VPyxC9N6l4amftmOMXHgd4vszBKO7IyivfBd6OmRJ0bHvtMP5b5T2AsLtwx-tAH93y0rnRgMrSsLu-oKpfv-GQbjo4iPhyx_Wgv3p2BE3uRVWBbU-oiqVNsOkdQuBACP6Yz87mxksxI7X83hakJGsO0DhZmg6b8uZtPcumonfFur4Lfc09bh0KA1ETfHvRYMUiXXQu5Us7mjvw1D2W2VPR6f92UqoP3X9Yn-UNt8npAkhEtlZhcd67hPtAEBiYPH4AGTseEm0vX-OTmNggLCoL9UanwBJAeSOLxEo0nN2IOJkCxc6CQ.rE0rvLOa9Tw5C85Ws-sQ_w&idvContinueHandler=SIGNUP&idvContinueUrl=https%3A%2F%2Fwww.google.com%2Faccounts%2FCreateAccount%3Fservice%3Dmail%26continue%3Dhttp%253A%252F%252Fmail.google.com%252Fmail%252Fe-11-117f7fb74c714e689c89d9067dc9f296-0be8e3542e11fd77bbb126be7d2c99a5fb5f34e9%26type%3D2%26sft%3DB9CQkSUBAAA.FloI_oy5zQi7SuEbWoI7rMOQZkngOpCmONWHXaq4HyMbDCNVoh-5PT1BVTqtUVSRUohZ3z9mZgd3WdDsKhXaR0B6aWzJ0l9FsTpuFRNWMbDJHx6uEQpiJ4o1Bt2zRkK8v7UlbOG-oHr_lW8CfK7DCYk_qV7J7_rxfHlNhFuicz3kPAPn0VeyMnJFEKCAsXOlYdndYKGcnyfCg-lOYV0SbfLchEdlHzTLS2r71R9imUEHBaQOHF-oLTIrEkF62GMIuMrpjWG36olQcmJL-spE00RBQoEOegHEeeNE3XCs5URSRvxEzwozsgNlB4hmWhIRK4T7KLeWH6A2L5K6P6caADbLV4i0FlRtEKt270AAqYNNRVV9Vc39lQVKOfA_vKzch2yEUl0Y3GfwPdOjYRu_D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bjo4iPhyx_Wgv3p2BE3uRVWBbU-oiqVNsOkdQuBACP6Yz87mxksxI7X83hakJGsO0DhZmg6b8uZtPcumonfFur4Lfc09bh0KA1ETfHvRYMUiXXQu5Us7mjvw1D2W2VPR6f92UqoP3X9Yn-UNt8npAkhEtlZhcd67hPtAEBiYPH4AGTseEm0vX-OTmNggLCoL9UanwBJAeSOLxEo0nN2IOJkCxc6CQ.rE0rvLOa9Tw5C85Ws-sQ_w&submitbutton=Send+verification+code+to+my+mobile+phone";

            NameValueCollection n 
= new NameValueCollection();
            n.Add(
"Cookie""GoogleAccountsLocale_session=en; X=abc; __utma=173272373.539232304.1260866717.1260866717.1260866717.1; __utmb=173272373; __utmc=173272373; __utmz=173272373.1260866717.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); GALX=D9XEGbdYgyU; LSID=mail:DQAAAGkAAADZSnQGo1zk7456yPXVfo7NEbuLxcLRHLpatbNG9P058nIfeedZsDG1I-orHw2K6toTN16X9gW2bMSaPnuGWX3gc36yVKFbwWd0wKCNJj_UTi3miA5PIH8D7THXOWK05ALBemqut2Yjao4AmpnRIeaz; GAUSR=mail:zongruipeng@gmail.com; PREF=ID=d5bdfd81441dab2a:U=5158fc2ef9d4992c:LD=en:NW=1:CR=2:TM=1257654013:LM=1260864064:S=tf-oMVPlpRm2tHEG; NID=28=rFa-cCxbB1LEORLtfDhezcQLIBx-wA2NvVahuAqcdg2dsp7tvh1mIfxQLchwi84KtaCYFYih7TAC_w4tMywyCBdZK8r7d9VzuGXHsYQgGMM1nWnhtyfIFyqfJUqBUvL4; TZ=-480; GMAIL_RTT=641; SID=DQAAAGYAAAD72LgZOmCJH-vfBz-pDbKyZkbb5-7MUx9jo0Nrh1fbzBGl_cSjNElJ9mUJ2HAASYSpvTg77XzWwUR6FAJ_C1DwiVBU5euy6BtQJvr-7A0uvYBzECoai1F1e0nyybXCN19-QHbAg7BzKZJVdKk1Iplc; HSID=AJ4gpTsh8iUzCoH1l; SSID=AEhbLRi0nf9G1rQsK");

            s.SendRequest(url,n,sendData);

            Console.WriteLine(
"Please wating for minutes....,you will receive a message from google!");
            Console.ReadKey();

        }

 

注意SendData改成你自己监控到的。运行效果如下:

o(∩_∩)o...,你可以做个for循环了,别有用心的人就可以进行短信骚扰了。希望google加下验证码或者其他方式让一个手机号码最多发3次等。

由于Request后,根据不同的网络环境,获取Response的时间不同,阻塞了当前主线程,下文我用异步方式去实现模拟请求。

;