Showing posts with label Fiddler. Show all posts
Showing posts with label Fiddler. Show all posts

Monday, August 3, 2015

How to see websocket traffic in Chrome and Fiddler

Websocket是HTML5的一个重要功能,它让server和client端建立新的沟通channel, 让推送的功能更加快速。由于其省去每次发header这个步骤,测试表明websocket比Restful API要快三倍以上。不少网站已经开始使用websocket,比如six flags


这个网站可以测试websocket: https://www.websocket.org/echo.html

我们可以两个方法去看数据:
1. Google Chrome
Chrome在network tab可以看到这个websocket,frames可以看到data






2. Fiddler
在4.5版本中,可以加入额外的代码到custom js中:Rules > Customize Rules and add the following function inside your Handlers class,使得websocket数据显示在Log中:

static function OnWebSocketMessage(oMsg: WebSocketMessage) {
    // Log Message to the LOG tab
    FiddlerApplication.Log.LogString(oMsg.ToString());

    /*
    // Modify a message's content
    var sPayload = oMsg.PayloadAsString();
    if (sPayload.Contains("time")) {
        oMsg.SetPayload(sPayload + "... bazinga!");
    }
                          
    */
  }


Thursday, February 5, 2015

用Fiddler捕捉phone的traffic

具体细节参看官网:http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForiOS
1. phone & 电脑连接同一个wifi
2. 获取电脑的IP地址, 并且输入到phone的wifi设置中,port 8888是fiddler默认的。

























3. 在Fiddler中设置options->connections->Allow remote computers to connect以及安装Certificate Maker plugin。
4. 在Fiddler中设置options->HTTPS->Actions->Trust root certificate
5. iphone6以上还需要信任证书Settings -> General -> About -> Certificate Trust Settings。登录手机 浏览器,输入地址192.168.1.3:8888。如果看见Fiddler Echo Service说明成功。

6. 可选项:fiddler中设置或者HTTPS
此时我们可以见到fiddler开始捕捉手机上的traffic,当然电脑上的traffic也会捕捉,process可以区分出他们,chrome是来自电脑,空白的是来自phone















7. 如上图所示,有的traffic会显示tunnel to,表示这些request用了SSL,我们在手机安装一些证书来骗过这些网站从而获得细节
电脑中fiddler的网址是http://localhost:8888/     证书也位于这里
在手机我们输入电脑的IP,port是8888,就可以访问该网址,如上述例子,我们在手机浏览器输入http://192.168.1.3:8888/  我们见到一个hyperlink: you can download the Fiddler certificate
安装了之后,就可以看到这些traffic了,不过不是所有SSL都可以骗,比如twitter就不可以了。
要删除fiddler cert可以settting->general->profile(iphone)

重新安装Fiddler的话都要重新再手机上安装此证书,在iphone中,证书通过以上方法可能打开不了,可以在fiddler把证书下载下来Options->HTTPS->Actions->Export root cert to desktop然后通过邮件发到手机即可打开。

























Android的配置:
http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForAndroid

另一个Post

Wednesday, March 26, 2014

Fiddler简介与Firebug

Fiddler contains web sessions (left), request (right top) and response windows (right bottom).
Sometimes, it can only capture traffic in IE
   

           1. Build a POST request

HTTP method: POST
URL: http://www.choicehotels.com/ires/en-US/html/Availability
Request Header (Required for POST): Content-Type: application/x-www-form-urlencoded
Request Body (Post data):
month=3&day=28&depart_month=3&depart_day=30&srp=RACK&hotel=NY618&sid=&nadult=1&nchild=0&xtrabed=none&count=1&dates_rqd=true&createarrivalcookie=yes


/*Booking data range: 3/28-3/30*/

Then Click Execute and the result will show up in the web session


  2. Analyze a POST request

Click the web session (left in Fiddler)

Request (right top):
I.                    Check the request headers here:

II.                  Check the request body here:



Response (right bottom):



3. How to find out the HTTP request to get the info we want

Take choice hotels for example: http://www.choicehotels.com/. The target is to get the rates for specific hotels given a data range.
a)      Search the hotels by zipcode (07302) at homepage
b)      Click one hotel in the result page
c)       In the detail page for that hotel, click Rates tab
d)      Update the check-in & check-out dates

You will see the http://www.choicehotels.com/ires/en-US/html/Availability with POST data by Fiddler.

Fiddler还可以用于捕捉http request,具体参见Fiddler捕捉手机app的http request

Firebug

与Fiddler很类似的工具就是Firefox,步骤是
1. 安装插件Firebug
2. 按firebug钮
,出现firebug窗口





3. 按Net tab并且enable
4. 最后可以在搜索可能出现在para或者response中的关键字

Thursday, March 13, 2014

Fiddler捕捉手机app的http request

熟悉Fiddler的朋友都知道可以用Fiddler来捕捉电脑中的Http request. 但是Fiddler还可以用于捕捉手机上的request,而且还可以捕捉多台手机。原理其实很简单,只要设置proxy server并且与Fiddler配合就可,具体如下:

1. 打开cmd, type ipconfig得到电脑上的IP address,比如192.168.1.4
2. 然后在手机上设置proxy,IP与电脑一致,端口是8888(跟Fiddler默认的一致)
























可以在手机地址栏输入192.168.1.4(电脑IP地址)见到Fidder Echo service表示连接成功。

3. 打开Fiddler, Tools->Fiddler options->connections->allow remote computers to connect












有些路由器不支持此功能,可能需要打开bridge,即允许设备之间互通。如Motorala在advanced router->Options->Primary Network Bridged

关于Fiddler的简介,可以参见Fiddler简介

另一个Post: