0

フィドラーをプロキシとして設定せずにアプリをデバッグしようとしています。

これを行うために、ネットワーク内の他のコンピューターに常駐する fiddler.core ベースのアプリをセットアップし、hosts ファイルにエントリを追加しました。

アプリのコードは次のとおりです。

    private static Proxy googleEndpoint;

    static void Main(string[] args)
    {
        List<Fiddler.Session> oAllSessions =new List<Session>();

        Fiddler.FiddlerApplication.BeforeRequest += (i) => Console.WriteLine("Before request: "+i.fullUrl);
        FiddlerApplication.AfterSessionComplete += (i) =>
        {
            Console.WriteLine("After request: "+i.fullUrl);
            lock (oAllSessions)
            {
                oAllSessions.Add(i);
            }
        };

        //https://www.google.com.ua/

        googleEndpoint = FiddlerApplication.CreateProxyEndpoint(443, true, "www.google.com.ua");
        if (null != googleEndpoint)
        {
            Console.WriteLine("google.com.ua endpoint mounted");
        }
        else
        {
            Console.WriteLine("failed to mount google.com.ua endpoint");
        }

        Console.ReadKey();
        SaveSessionsToDesktop(oAllSessions);
    }

    private static void SaveSessionsToDesktop(List<Fiddler.Session> oAllSessions)
    {
        bool bSuccess = false;
        string sFilename = DateTime.Now.ToString("hh-mm-ss") + ".saz";
        try
        {
            try
            {
                Monitor.Enter(oAllSessions);
                TranscoderTuple oExporter = FiddlerApplication.oTranscoders.GetExporter("SAZ");

                if (null != oExporter)
                {
                    Dictionary<string, object> dictOptions = new Dictionary<string, object>();
                    dictOptions.Add("Filename", sFilename);
                    // dictOptions.Add("Password", "pencil");

                    bSuccess = FiddlerApplication.DoExport("SAZ", oAllSessions.ToArray(), dictOptions, null);
                }
                else
                {
                    Console.WriteLine("Save failed because the SAZ Format Exporter was not available.");
                }
            }
            finally
            {
                Monitor.Exit(oAllSessions);
            }

            WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
        }
        catch (Exception eX)
        {
            Console.WriteLine("Save failed: " + eX.Message);
        }
    }

    public static void WriteCommandResponse(string s)
    {
        ConsoleColor oldColor = Console.ForegroundColor;
        Console.ForegroundColor = ConsoleColor.Yellow;
        Console.WriteLine(s);
        Console.ForegroundColor = oldColor;
    }

しかし、ターゲットマシンからアクセスしようとするとhttps://www.google.com.ua、リクエストがタイムアウトします。

Fiddler アプリは、BeforeRequestイベントで要求を受信したことを示していますが、応答を送信しません (AfterSessionComplete呼び出されません)。

なぜこれが起こり、どうすれば修正できますか?

ポート 80 に対して同じことを行うにはどうすればよいですか?

4

1 に答える 1

1

FiddlerServer のルート証明書を信頼するようにクライアントを再構成しない限り、クライアントは FiddlerCore に HTTPS 要求を発行しないという事実を念頭に置いていると思います。代わりに、傍受証明書を取得するとすぐに接続を閉じます。

BeforeResponse イベント ハンドラーをアタッチするとどうなりますか? 発火しますか?

于 2013-01-29T20:48:13.370 に答える