【转载】fiddler 插件开发二
来源:互联网 发布:酷宝数据 编辑:程序博客网 时间:2024/05/17 18:46
在路上
本文是转载来的,感谢原作者
本篇主要讲解Fildder插件开发中的涉及到的主要接口与类。
1.IFiddlerExtension 接口
如果要开发的自定义插件有UI界面,则需要实现IFiddlerExtension 接口。你程序集中的实现了IFiddlerExtension接口的公有类(public class)将会在Fiddler启动时加载。
public interface IFiddlerExtension { // Called when Fiddler User Interface is fully available void OnLoad(); // Called when Fiddler is shutting down void OnBeforeUnload(); }
- OnLoad 方法将会在Fiddler加载完成并且她的UI完全可用时调用,在这个方法中,你可以安全地添加菜单项,选项卡页或者其他UI元素到FiddlerUI。
- OnBeforeUnload 方法将会在Fiddler 关闭和卸载所有插件时执行。
2.IAutoTamper 接口
IAutoTamper 接口继承了IFiddlerExtension接口,所有实现了IAutoTamper 接口的插件将会在每一个http/https 请求或响应时被调用,所以可以用来劫持或修改http/https 请求响应数据。
注意:这个接口的方法是在后台被调用,非UI线程,如果想要更新UI,可以使用Invoke 或者 BeginInvoke 方法来更新UI。IAutoTamper 的所有方法可能会在OnLoad事件之前就执行。
public interface IAutoTamper : IFiddlerExtension{ // Called before the user can edit a request using the Fiddler Inspectors void AutoTamperRequestBefore(Session oSession); // Called after the user has had the chance to edit the request using the Fiddler Inspectors, but before the request is sent void AutoTamperRequestAfter(Session oSession); // Called before the user can edit a response using the Fiddler Inspectors, unless streaming. void AutoTamperResponseBefore(Session oSession); // Called after the user edited a response using the Fiddler Inspectors. Not called when streaming. void AutoTamperResponseAfter(Session oSession); // Called Fiddler returns a self-generated HTTP error (for instance DNS lookup failed, etc) void OnBeforeReturningError(Session oSession);}
3.IAutoTamper2 接口
所有实现了IAutoTamper2 接口(继承自IAutoTamper接口)的扩展将会在响应头(Response Headers)可用时被调用。
/// <summary>/// Interface for AutoTamper extensions that want to "peek" at response headers/// </summary>public interface IAutoTamper2 : IAutoTamper{ /// <summary> /// Called when the response headers become available /// </summary> /// <param name="oSession">The Session object for which the response headers are available</param> void OnPeekAtResponseHeaders(Session oSession);}
4.IAutoTamper3 接口
所有实现了IAutoTamper3接口(继承自IAutoTamper2接口)的扩展将会在请求头(Request Headers)可用时被调用。
/// <summary>/// Interface for AutoTamper extensions that want to "peek" at request headers/// </summary>public interface IAutoTamper3 : IAutoTamper2{ /// <summary> /// Called when the request headers become available /// </summary> /// <param name="oSession">The Session object for which the request headers are available</param> void OnPeekAtRequestHeaders(Session oSession);}
5.IHandleExecAction接口
所有实现了IHandleExecAction接口的扩展将在用户执行QuickExec命令时被调用。OnExecAction方法中返回 true 表示命令执行成功,不用再处理其他Action。
public interface IHandleExecAction{ // return TRUE if handled. bool OnExecAction(string sCommand); }
例如:
public bool OnExecAction(string sCommand){ if (sCommand == "clearcache") { //检测到用户在quickexec中输入的命令是clearcache时,调用Fiddler的清缓存方法 FiddlerApplication.UI.actClearWinINETCache(); return true; //表示命令处理成功,不用继续其他的处理 } return false; //表示命令没有被处理,允许其他 ExecAction handlers继续处理}
6.参考资料
Fiddler插件开发原文档: http://www.fiddlerbook.com/Fiddler/dev/IFiddlerExtension.asp
阅读全文
0 0
- 【转载】fiddler 插件开发二
- 【转载】fiddler插件开发step by step 1
- Fiddler插件开发
- Fiddler插件开发
- Fiddler插件开发
- Fiddler插件开发
- 【转载】自己动手打造Fiddler挖洞插件
- jQuery插件开发(转载)
- 【转载】idea 开发插件
- firefox NPAPI 插件开发(c++)(二)-为插件添加和脚本交互的能力(转载)
- Fiddler(二)
- Rosin-移动端页面开发调试Fiddler插件
- 转载 Maven2插件开发详解
- jQuery插件开发二
- jQuery插件开发二
- Fiddler中文版插件 0.1
- fiddler stave插件
- 如何开发Discuz插件(二):文库插件
- Google账户 手机号无法验证
- Hive安装
- iOS音频流媒体播放方案(边下载边播放)
- C#之ArrayList 的用法
- Android5.1关机充电界面尺寸修改
- 【转载】fiddler 插件开发二
- Java代码块执行顺序
- Python3之装饰器
- Linux基础 标准教程(3)-常用文件处理命令
- Hadoop中的Python框架的使用指南
- 【UWP开发】uwp应用安装失败
- js substr和substring的位置
- Golang, 教会我们的一件事: 提升生产力 (Productivity)
- 1017.A Mathematical Curiosity