如何编写Filter

 
  注册 Filter
      AX 文件的一个对外接口 DllRegisterServer ,由外部调用,比如注册 AX 的时候: regsvr32 xxx.ax
 
       通常情况下,我们的 filter 可能注册在 ”Direct Show” 目录下,那么直接调用
       // Creates registry entries for the DLL
STDAPI DllRegisterServer ()
return AMovieDllRegisterServer2(TRUE) ;
}
 
AMovieDllRegisterServer2 DX 的帮助文档内的说明如下:
The AMovieDllRegisterServer2 function creates registry entries for every component in the g_Templates array. However, this function has some limitations. First, it assigns every filter to the "DirectShow Filters" category (CLSID_LegacyAmFilterCategory), but not every filter belongs in this category. Capture filters and compression filters, for example, have their own categories. Second, if your filter supports a hardware device, you might need to register two additional pieces of information that AMovieDLLRegisterServer2 does not handle: the medium and the pin category. A medium defines a method of communication in a hardware device, such as a bus. The pin category defines the function of a pin. For information on mediums, see KSPIN_MEDIUM in the Microsoft Windows Driver Development Kit (DDK). For a list of pin categories, see Pin Property Set.
      
       如果我们的引擎需要注册到 DirectShow 之外的目录,又该如何做?
       // 注册 Filter Video Compressor
REGFILTER2 rf2FilterReg =
{
    1,                                    // Version 1 (no pin mediums or pin category).
    MERIT_NORMAL,       // Merit.
    1,                                   // Number of pins.
    &sudPins                     // Pointer to pin information.
};
 
//Creates registry entries for the DLL
STDAPI DllRegisterServer( void)
{
    HRESULT hr = E_FAIL;
    IFilterMapper2 *pFM2 = NULL;
 
    hr = AMovieDllRegisterServer2(TRUE);                // 这个还是要调用的
    if (FAILED(hr))       return hr;
hr = CoCreateInstance( CLSID_FilterMapper2, NULL,
                                           CLSCTX_INPROC_SERVER,
                                                     IID_IFilterMapper2, (void **)& pFM2);
 
    if (FAILED(hr))       return hr;
 
    hr = pFM2-> RegisterFilter( CLSID_SomeFilter,                        // Filter CLSID.
                                                    g_wszName,                                   // Filter name.
                                                    NULL,                                               // Device moniker.
                                           
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在HTTP中间人攻击实验中,通过编写filter文件,可以对网页内容进行替换。如果您想替换百度网页的图片,可以按照以下步骤操作: 1. 编写filter文件,使用sed命令将网页中的图片链接替换成攻击者指定的图片链接。具体来说,可以将filter文件中的内容写成以下形式: ``` s/http:\/\/www\.baidu\.com\/img\//http:\/\/attackersite.com\/img\//g ``` 其中,`http:\/\/www\.baidu\.com\/img\/`表示百度网页图片的链接,`http:\/\/attackersite.com\/img\/`表示攻击者准备好的图片的链接。这个命令会将百度网页中所有的图片链接都替换成攻击者准备好的图片链接。 2. 在中间人攻击实验中,使用ettercap工具进行攻击。具体来说,可以使用以下命令启动ettercap工具: ``` ettercap -T -q -M arp:remote /网关IP/ /受害者IP/ ``` 其中,`/网关IP/`表示本地网络的网关IP地址,`/受害者IP/`表示受害者的IP地址。这个命令会将中间人攻击程序启动起来,并且将流量转发到目标主机上。 3. 在ettercap工具中,加载filter文件。具体来说,在ettercap的命令行界面中,可以使用以下命令加载filter文件: ``` etterfilter /path/to/filter/file ``` 其中,`/path/to/filter/file`表示filter文件的路径。这个命令会将filter文件加载到ettercap工具中,并且启用filter规则。 4. 在受害者主机上,打开浏览器并访问百度网站。此时,ettercap工具会拦截并篡改网页中的图片链接,将其替换成攻击者指定的图片链接。 需要注意的是,进行这种操作可能会侵犯他人的网络安全和个人隐私等问题,需要遵守相关法律法规。同时,这种操作也可能会影响网页的完整性和可用性,需要仔细考虑替换的内容和替换的方式,以免对网页造成不必要的影响。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值