Page 1 of 1

请教关于$AV( )

Posted: Nov 10 2009, 13:20
by 不夜侯
我制定一个规则,目的是清除一些width与height值为0的网页木马iframe代码。规则如下:

Code: Select all

[Patterns]
Name = "kill iframe 木马"
Active = TRUE
Bounds = "$NEST(<iframe\s,</iframe>)"
Limit = 256
Match = "*width=$AV(0) & *height=$AV(0)*"
Replace = "<!---kill iframe 木马--->"
用$AV是想匹配有无引号皆行。但在实际应用中,不论width与height值为多少,都被过滤了。请问这个规则问题出在哪?谢谢!

Re: 请教关于$AV( )

Posted: Nov 10 2009, 14:49
by phoenix
不夜侯 wrote:但在实际应用中,不论width与height值为多少,都被过滤了。请问这个规则问题出在哪?谢谢!
请给出实际例子。

Re: 请教关于$AV( )

Posted: Nov 10 2009, 15:02
by 不夜侯
不好意思,是我没看清楚代码。这代码有点变态。
<iframe width="150" height="20" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="http://www.sina.com.cn/iframe/2008/weather/450301.html" style="background-color:#999999"></iframe>
加个括号应该可以避免这种情况吧?

Code: Select all

[Patterns]
Name = "kill iframe 木马"
Active = TRUE
Bounds = "$NEST(<iframe\s,</iframe>)"
Limit = 256
Match = "*(width=$AV(0) & *height=$AV(0))*"
Replace = "<!---kill iframe 木马--->"


Re: 请教关于$AV( )

Posted: Nov 10 2009, 15:23
by ddbb
一般我用 * 的时候

* 和前后的字符之间 我会放一个空格的 而不是紧紧贴着.........

除非有什么特殊需要

Re: 请教关于$AV( )

Posted: Nov 10 2009, 15:43
by phoenix
为了避免 *width 匹配 marginwidth ,可以写成 *\swidth

Re: 请教关于$AV( )

Posted: Nov 10 2009, 17:01
by 不夜侯
谢谢 phoenix 指点