【问题标题】:Obtaining pictures from fiddler core从提琴手核心获取图片
【发布时间】:2015-09-16 06:48:33
【问题描述】:

我如何在提琴手核心中获取图片。

Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) {
                Console.WriteLine("{0}:HTTP {1} for {2}", oS.id, oS.responseCode, oS.fullUrl);
                oS.

                // Uncomment the following two statements to decompress/unchunk the
                // HTTP response and subsequently modify any HTTP responses to replace 
                // instances of the word "Microsoft" with "Bayden"
                //oS.utilDecodeResponse(); oS.utilReplaceInResponse("Microsoft", "Bayden");
            };

我希望这会出现在会话部分的这一部分中。我试图在代码中复制这种效果。

这段代码取自wiki中的demo代码

根据答案修改代码,这是输出

Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) {
                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    oS.utilDecodeResponse();
                    Console.WriteLine("writing bytes");
                    Console.WriteLine(oS.requestBodyBytes);
                    // oS.responseBodyBytes is a byte[] containing the image

                    Bitmap oBMP = new Bitmap(new MemoryStream(oS.responseBodyBytes));


                    // Now oBMP is an image object which contains the picture...
                }

我正在刷新的网址:

http://baike.baidu.com/link?url=n8LTFN1PKt2Wp_mQul4-2SAFAXQ5BD5hmxu6m7PiC56Ix7htWUtZg7YqMkzBNnmjaYZpbTGS7HG6Mw6Qss2c2qYYjrqQeAyV2lsL1MusvIe

【问题讨论】:

    标签: fiddler fiddlercore fiddler-dev


    【解决方案1】:

    “获取图片”具体是什么意思?像这样?

    if ((oS.responseCode == 200) && 
        oS.oResponse.headers.ExistsAndContains("Content-Type", "image/")) 
    {
      oS.utilDecodeResponse();
      // oS.responseBodyBytes is a byte[] containing the image
      Bitmap oBMP = new Bitmap(new MemoryStream(oS.responseBodyBytes));
      // Now oBMP is an image object which contains the picture...
    }
    

    【讨论】:

    • 是的,我想是的。我会尝试看看它是否有效。我想提取以下数据包,如我得到的屏幕截图所示
    • 参数无效。这是一个例外
    • 我在位图行有错误。我尝试使用 console.writeline 打印出字节,但字节字符串似乎为空。我纯粹是刷新百度页面抓图
    • 什么是确切 url?在您的代码示例中,您错误地使用了requestBodyBytes 而不是responseBodyBytes
    • 我在我的问题中添加了我的网址
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多