Page 1 of 1

为什么谷粉会逃脱过滤

Posted: Aug 05 2014, 12:07
by 白城哨站
http://www.gfsoso.com/?q=121~
即使纯字符替换如script测试也不行,链接也是http的,但就是不触发规则。
查看日志中的内容

Code: Select all

+++GET 2122+++
GET /?q=121~ HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
Accept-Encoding: gzip, deflate
Host: www.gfsoso.com
DNT: 1
Cookie: AJSTAT_ok_pages=1; AJSTAT_ok_times=1
Connection: keep-alive

+++RESP 2122+++
HTTP/1.1 200 OK
Date: Tue, 05 Aug 2014 04:03:09 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Server: gunicorn/18.0
+++CLOSE 2122+++

+++GET 2123+++
GET /pagead/js/adsbygoogle.js HTTP/1.1
Accept: application/javascript, */*;q=0.8
Referer: http://www.gfsoso.com/?q=121~
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
Accept-Encoding: gzip, deflate
DNT: 1
Host: pagead2.googlesyndication.com
Connection: keep-alive
+++CLOSE 2123+++

+++GET 2124+++
GET /pagead/js/adsbygoogle.js HTTP/1.1
Accept: application/javascript, */*;q=0.8
Referer: http://www.gfsoso.com/?q=121~
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
Accept-Encoding: gzip, deflate
DNT: 1
Host: pagead2.googlesyndication.com
Connection: keep-alive

Re: 为什么谷粉会逃脱过滤

Posted: Aug 05 2014, 23:40
by phoenix
请把你的规则贴上来。

BTW,20号之前我不能保证能回复。

Re: 为什么谷粉会逃脱过滤

Posted: Aug 07 2014, 14:07
by 白城哨站
打算用的是第一个,导致框架引用时跳出。因为不见效,就用了第二个和其它网站来测试,才确认是没有在谷粉生效。

Code: Select all

[Patterns]
Name = "gfsoso"
Active = TRUE
Limit = 256
Match = "<script language="javascript">\n"
        "if\(top.location!==self.location\){\n"
        "top.location.href=self.location.href;\n"
        "}\n"
        "</script>"

Code: Select all

[Patterns]
Name = "js"
Active = TRUE
Bounds = "<script*</script>"
Limit = 32767
Match = "<script*</script>"

Re: 为什么谷粉会逃脱过滤

Posted: Aug 07 2014, 16:27
by cre
链接也是http的,但是不触发web规则
这个问题跟web规则没有关系.

有这个疑惑是因为你没有弄明白proxomitron的过滤.
简单的说,proxomitron的过滤分为header过滤web过滤.
不考虑规则的干扰,假设规则是有效的情况下,那么:
决定header能否过滤的关键只有http和https的区别.默认是不使用ssleay/openssl的
决定web能否过滤的关键除了http|https的分别外,多了一个"类型"就是"Content-Type".
默认过滤的有三个类型,就是那三个$type
即:
默认 Content-Type
$TYPE(htm) text/html
$TYPE(css) text/css
$TYPE(js) text/javascript
这是因为非"文本"的类型一般不应该修改文件的实体.
例如图片,可以阻止但不应该修改文件的内容.压缩包,修改内容就会crc错;exe文件,修改自然就不能运行.

对于gfsoso.com就是该url没有Content-Type,没有指定文档的类型,proxomitron默认不过滤.

解决,有两种办法:
1.强制过滤,使用$FILTER(True)和$TYPE(oth)
2.修改Content-Type的类型

实例1.使用$FILTER(True)和$TYPE(oth)强制过滤
header添加一条

Code: Select all

[HTTP headers]
In = TRUE
Out = FALSE
Key = "$FILTER(True) [in]"
URL = "www.gfsoso.com/$FILTER(True)"
web使用$TYPE(oth)

Code: Select all

[Patterns]
Name = "$TYPE(oth)"
Active = TRUE
URL = "$TYPE(oth)"
Limit = 256
Match = "<!DOCTYPE html>"
这里要注意,$TYPE(oth)使用的话必须先在header$FILTER(True).

实例2.强制修改类型为text/html.这个是立竿见影的.
header添加一条

Code: Select all

[HTTP headers]
In = TRUE
Out = FALSE
Key = "Content-Type: gfsoso.com"
Replace = "text/html"

Re: 为什么谷粉会逃脱过滤

Posted: Aug 07 2014, 20:19
by 白城哨站
感谢解答~用了第二个

万万没想到真是没类型。Privoxy是只要没类型就按文本过滤,结果某站几百张缩略图全给破坏了还卡半天,Proxomitron则相反就没问题。谷粉这个也曾有一闪念,但想谷粉也挺有技术的怎么会没类型,日志什么的看着很吃力就没多想……其实幸亏没多想,不然会误以为解决不了就不会来问了,就真解决不了了。

Re: 为什么谷粉会逃脱过滤

Posted: Aug 23 2014, 11:07
by phoenix
@cre,回答得很赞!