官方版
Implement Fiddler Interfaces
Implement Fiddler interfaces to load your assembly during Fiddler execution.
Load Extension During Startup
Public classes in your assembly that implement the IFiddlerExtension interface will be loaded by Fiddler during startup.
public interface IFiddlerExtension
{
// Called when Fiddler User Interface is fully available
void OnLoad();
// Called when Fiddler is shutting down
void OnBeforeUnload();
}
- The OnLoad function will be called when Fiddler has finished loading and its UI is fully available. At this point, you can safely add menu items, tabbed pages, or other elements to the Fiddler UI.
The OnBeforeUnload function will be called when Fiddler is shutting down and unloading all extensions.
Call Extension for Each Web Request
Extensions that implement the IAutoTamper interface (which extends IFiddlerExtension) are called for each HTTP/HTTPS request and response, enabling modifications, logging, or other operations.
Warning: Functions in this interface are called on background, non-UI threads. To update UI, use Invoke or BeginInvoke to update the UI. Also, note that the IAutoTamper:: functions may be called before the *OnLoad event is called— Fiddler allows traffic to flow before the UI is fully available.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);
}
Extensions that implement the IAutoTamper2 interface (which extends IAutoTamper) are called when the response headers become available.
/// <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);
}
Extensions that implement the IAutoTamper3 interface (which extends IAutoTamper2) are called when the request headers become available.
/// <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);
}
Call Extension When User Enters a QuickExec Command
Extensions that implement the IHandleExecAction interface are called when the user has entered a command into the QuickExec box. To react to the command (and prevent further processing by other extensions and Fiddler itself) return true from this method.
public interface IHandleExecAction
{
// return TRUE if handled.
bool OnExecAction(string sCommand);
}
The Fiddler.Utilities class includes a helper function Parameterize() which helps to interpret the sCommand parameter.
[CodeDescription("Tokenize a string into tokens. Delimits on whitespace; Quotation marks are dropped unless preceded by a \ character.")]
public static string[] Parameterize(string sCommand)
谷歌翻译版
实现Fiddler接口
实现Fiddler接口以在Fiddler执行期间加载程序集。
启动期间加载的扩展
在启动过程中,Fiddler将加载实现IFiddlerExtension接口的程序集中的公共类。
public interface IFiddlerExtension
{
// Called when Fiddler User Interface is fully available
void OnLoad();
// Called when Fiddler is shutting down
void OnBeforeUnload();
}
- 当Fiddler完成加载并且其UI完全可用时,将调用OnLoad函数。 此时,您可以安全地将菜单项,选项卡式页面或其他元素添加到Fiddler UI。
当Fiddler关闭并卸载所有扩展时,将调用OnBeforeUnload函数
为每个Web请求调用扩展
为每个HTTP / HTTPS请求和响应调用实现IAutoTamper接口的扩展(扩展IFiddlerExtension),从而启用修改,日志记录或其他操作。
警告:此接口中的函数在后台、非ui线程上调用。要更新UI,请使用Invoke或
BeginInvoke来更新UI。另外,请注意IAutoTamper::函数可以在函数之前调用
*OnLoad事件被调用——Fiddler允许流量在UI完全可用之前流动。
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);
}
当响应头变为可用时,将调用实现IAutoTamper2接口的扩展(扩展了IAutoTamper)。
/// <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);
}
当请求头文件可用时,将调用实现IAutoTamper3接口(扩展IAutoTamper2)的扩展。
/// <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);
}
当用户输入QuickExec命令时调用扩展
当用户在QuickExec框中输入命令时,将调用实现IHandleExecAction接口的扩展。 要对命令做出反应(并防止其他扩展和Fiddler本身进行进一步处理),从这个方法返回true。
public interface IHandleExecAction
{
// return TRUE if handled.
bool OnExecAction(string sCommand);
}
Fiddler.Utilities类包含一个辅助函数Parameter(),该函数有助于解释Command参数。
[CodeDescription("Tokenize a string into tokens. Delimits on whitespace; Quotation marks are dropped unless preceded by a \ character.")]
public static string[] Parameterize(string sCommand)