public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Fiddler.FiddlerApplication.OnNotification += FiddlerApplication_OnNotification; Fiddler.FiddlerApplication.Log.OnLogString += Log_OnLogString; Fiddler.FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest; Fiddler.FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse; Fiddler.FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete; Fiddler.CONFIG.IgnoreServerCertErrors = false; } void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession) { Console.WriteLine("Finished session:t" + oSession.fullUrl); } void FiddlerApplication_BeforeResponse(Fiddler.Session oSession) { Debug.WriteLine("{0}:HTTP {1} for {2}", oSession.id, oSession.responseCode, oSession.fullUrl); } void FiddlerApplication_BeforeRequest(Fiddler.Session oSession) { Debug.WriteLine("Before request for:t" + oSession.fullUrl); oSession.bBufferResponse = true; } void FiddlerApplication_OnNotification(object sender, Fiddler.NotificationEventArgs e) { Debug.WriteLine("** NotifyUser: " + e.NotifyString); } void Log_OnLogString(object sender, Fiddler.LogEventArgs e) { Debug.WriteLine("** LogString: " + e.LogString); } /// <summary> /// キャプチャ開始 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { Fiddler.FiddlerApplication.Startup(8877, true, true); } /// <summary> /// キャプチャ終了 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { Debug.WriteLine("Shutting down..."); Fiddler.FiddlerApplication.Shutdown(); } }
时间: 2024-11-06 09:52:24