<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>apt-blog.net   无证程序员的PT桑 &#187; Sogou</title>
	<atom:link href="http://apt-blog.net/tag/sogou/feed" rel="self" type="application/rss+xml" />
	<link>http://apt-blog.net</link>
	<description>潜逃中。</description>
	<lastBuildDate>Fri, 18 May 2012 11:25:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>通过Wine使用Sogou浏览器的教育网加速代理</title>
		<link>http://apt-blog.net/using_sogou_proxy_with_wine</link>
		<comments>http://apt-blog.net/using_sogou_proxy_with_wine#comments</comments>
		<pubDate>Tue, 14 Apr 2009 05:59:06 +0000</pubDate>
		<dc:creator>PT</dc:creator>
				<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Sogou]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wine]]></category>
		<category><![CDATA[代理]]></category>
		<category><![CDATA[加速代理]]></category>
		<category><![CDATA[搜狗]]></category>
		<category><![CDATA[教育网]]></category>
		<category><![CDATA[浏览器]]></category>
		<guid isPermaLink="false">http://apt-blog.net/?p=268</guid>
		<description><![CDATA[此前用wireshark嗅探研究过Sogou浏览器的代理功能，没什么头绪，有访客留言说用Process Explorer瞧瞧Sogou的进程，今天有空看了下，果然，有一个子进程是用-proxy参数启动的，打开了本地的8081和8082端口在监听，用其他浏览器连8081，发现就是普通的透明代理，而8082则是一个自动配置代理的PAC（Javascript）。 虽然现在我的Ubuntu下已经有了一堆翻墙用的代理软件（没边、门、eTunnel……），但经常速度不甚理想，而且学校校园网的电信出口经常被挤爆，而教育网出口是空的，所以使用Sogou提供的免费教育网代理是个不错的解决办法。 把Sogou弄到Ubuntu下的Wine环境没有任何难度，把Sogou的安装文件夹全部复制到~/.wine/drive_c/sogou下，运行的很正常： pentie@pentie-desktop:~$ wine "C:\sogou\SogouExplorer.exe" -proxy fixme:win:EnumDisplayDevicesW ((null),0,0x32f3c4,0x00000000), stub! fixme:wtsapi:WTSRegisterSessionNotification Stub 0x1002a 0x00000000 fixme:mountmgr:harddisk_ioctl unsupported ioctl 74080 fixme:mountmgr:harddisk_ioctl unsupported ioctl 2d1400 fixme:mountmgr:harddisk_ioctl unsupported ioctl 2d0c10 PID:8 PORT:8081 CPORT:8082 PAC:http://127.0.0.1:8082/proxy.pac?t=626 RET:SUCCESS 在配置Firefox的FoxyProxy，可以像平常那样添加127.0.0.1:8081作为代理，但既然提供了PAC，不妨试试：在Automatic proxy configuration URL内添入“http://127.0.0.1:8082/”，按Test，说找到PAC，解析成功！确定后右下角也出现FoxyProxy的提示。此时在Firefox中打开的网页都是通过Sogou的免费代理了！不过发觉现在的代理速度没此前那么快了。 Ubuntu中有一个工具可以配置全局代理，gnome-network-preferences，运行它可以轻松的让apt-get、telnet之类的程序通过代理来连接外网。 再一次提醒的是，Sogou浏览器代理是“透明代理”，它会转发你的真实IP，没有任何匿名功能，因为他们的服务器也在国内（北京），因此也不会有翻墙功能。 参考了别人的网志：http://dan.febird.net/2008/12/firefox.html 已知缺陷：在流量和连接数比较大时（比如刷开Google Reader），wine出来的SogouExplorer进程占用大量CPU资源，可能是某链接库匹配问题，以致这个方法的实用性不是很高。]]></description>
			<content:encoded><![CDATA[<p>此前用wireshark嗅探<a href="http://apt-blog.net/archives/92.html" target="_blank">研究过Sogou浏览器的代理功能</a>，没什么头绪，有访客留言说用Process Explorer瞧瞧Sogou的进程，今天有空看了下，果然，有一个子进程是用-proxy参数启动的，打开了本地的8081和8082端口在监听，用其他浏览器连8081，发现就是普通的<strong>透明</strong>代理，而8082则是一个自动配置代理的PAC（Javascript）。</p>
<p>虽然现在我的Ubuntu下已经有了一堆翻墙用的代理软件（没边、门、eTunnel……），但经常速度不甚理想，而且学校校园网的电信出口经常被挤爆，而教育网出口是空的，所以使用Sogou提供的免费教育网代理是个不错的解决办法。</p>
<p>把Sogou弄到Ubuntu下的Wine环境没有任何难度，把Sogou的安装文件夹全部复制到~/.wine/drive_c/sogou下，运行的很正常：</p>
<p style="text-align: justify; padding-left: 30px;">pentie@pentie-desktop:~$ wine "C:\sogou\SogouExplorer.exe" -proxy<br />
fixme:win:EnumDisplayDevicesW ((null),0,0x32f3c4,0x00000000), stub!<br />
fixme:wtsapi:WTSRegisterSessionNotification Stub 0x1002a 0x00000000<br />
fixme:mountmgr:harddisk_ioctl unsupported ioctl 74080<br />
fixme:mountmgr:harddisk_ioctl unsupported ioctl 2d1400<br />
fixme:mountmgr:harddisk_ioctl unsupported ioctl 2d0c10<br />
PID:8<br />
PORT:8081<br />
CPORT:8082<br />
PAC:http://127.0.0.1:8082/proxy.pac?t=626<br />
RET:SUCCESS</p>
<p>在配置Firefox的FoxyProxy，可以像平常那样添加127.0.0.1:8081作为代理，但既然提供了PAC，不妨试试：在Automatic proxy configuration URL内添入“http://127.0.0.1:8082/”，按Test，说找到PAC，解析成功！确定后右下角也出现FoxyProxy的提示。此时在Firefox中打开的网页都是通过Sogou的免费代理了！不过发觉现在的代理速度没此前那么快了。</p>
<p>Ubuntu中有一个工具可以配置全局代理，gnome-network-preferences，运行它可以轻松的让apt-get、telnet之类的程序通过代理来连接外网。</p>
<p>再一次提醒的是，Sogou浏览器代理是“透明代理”，它会转发你的真实IP，<strong>没有任何匿名功能</strong>，因为他们的服务器也在国内（北京），因此也不会有翻墙功能。</p>
<p>参考了别人的网志：<a href="http://dan.febird.net/2008/12/firefox.html" target="_blank">http://dan.febird.net/2008/12/firefox.html</a><strong></strong></p>
<p><strong>已知缺陷：在流量和连接数比较大时（比如刷开Google Reader），wine出来的SogouExplorer进程占用大量CPU资源，可能是某链接库匹配问题，以致这个方法的实用性不是很高。</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://apt-blog.net/using_sogou_proxy_with_wine/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>搜狗浏览器教育网加速所用代理协议初探</title>
		<link>http://apt-blog.net/exporing-the-protocol-of-sogou-browser</link>
		<comments>http://apt-blog.net/exporing-the-protocol-of-sogou-browser#comments</comments>
		<pubDate>Fri, 27 Feb 2009 17:38:36 +0000</pubDate>
		<dc:creator>PT</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Sogou]]></category>
		<category><![CDATA[wireshark]]></category>
		<category><![CDATA[代理]]></category>
		<category><![CDATA[加速]]></category>
		<category><![CDATA[搜狗]]></category>
		<category><![CDATA[教育网]]></category>
		<category><![CDATA[浏览器]]></category>
		<category><![CDATA[破解]]></category>
		<guid isPermaLink="false">http://apt-blog.net/archives/92.html</guid>
		<description><![CDATA[后注（09-04-14）：其实Sogou浏览器的代理功能是独立的，可以单独利用，分析其协议意义不大，见通过Wine使用Sogou浏览器的教育网加速代理 搜狗浏览器的教育网加速功能，对n多在学校使用校园网的用户来说可是福音，更别提其附带的翻墙功能。自从搜狗浏览器发布那天起，我就对其所用的代理服务器虎视眈眈：要是能在其他浏览器使用，多好啊…… 早前，用Wireshark嗅探搜狗连接加速代理的数据包，找到如219.234.81.(64/65/)66、219.234.81.（35/36/37)等几个服务器，看其发送的数据包，好像和HTTP代理差不多！试着将其加入Firefox的代理……果然吃的是闭门羹：Try Sogou Explorer now! 也看到搜狗发出的HTTP GET带有一些私有头部X-Sogou-XXXX的，估计有一些校验机制，就暂时放下了。 这几天校园网特别不稳定，又打起搜狗的主意。 感谢Python能够用这么简单的语句给我提供实验的环境，现在已经肯定下面的代码能够通过搜狗的代理访问到google的主页！程序输出的确实是Google的HTML代码！ #!/usr/bin/python &#160; import socket, sys &#160; s = socket.socket&#40;socket.AF_INET, socket.SOCK_STREAM&#41; &#160; s.connect&#40; &#40;&#34;219.234.81.66&#34;, 80&#41; &#41; &#160; data = &#34;GET http://www.google.com/ HTTP/1.1\r\nHost: www.google.com\ \r\nX-Sogou-Auth: 438892784B65C0ADAB8B42F1BF6E7984/91/1ac66c2d240157be\ \r\nX-Sogou-Tag: 82cfc55e\r\nX-Sogou-Timestamp: 49a7fa22\r\n\r\n&#34; &#160; s.sendall&#40;data&#41; &#160; while 1: buf = s.recv&#40;4096&#41; if not len&#40;buf&#41;: break sys.stdout.write&#40;buf&#41; 然而，现在高兴还为时过早，这个程序我发送的HTTP头信息如下： GET http://www.google.com/ HTTP/1.1 Host: [...]]]></description>
			<content:encoded><![CDATA[<h5>后注（09-04-14）：其实Sogou浏览器的代理功能是独立的，可以单独利用，分析其协议意义不大，见<a title="通过Wine使用Sogou浏览器的教育网加速代理 (2009/04/14)" href="../archives/268.html">通过Wine使用Sogou浏览器的教育网加速代理</a></h5>
<p>搜狗浏览器的教育网加速功能，对n多在学校使用校园网的用户来说可是福音，更别提其附带的翻墙功能。自从搜狗浏览器发布那天起，我就对其所用的代理服务器虎视眈眈：要是能在其他浏览器使用，多好啊……</p>
<p>早前，用Wireshark嗅探搜狗连接加速代理的数据包，找到如219.234.81.(64/65/)66、219.234.81.（35/36/37)等几个服务器，看其发送的数据包，好像和HTTP代理差不多！试着将其加入Firefox的代理……果然吃的是闭门羹：Try Sogou Explorer now!</p>
<p>也看到搜狗发出的HTTP GET带有一些私有头部X-Sogou-XXXX的，估计有一些校验机制，就暂时放下了。</p>
<p>这几天校园网特别不稳定，又打起搜狗的主意。</p>
<p>感谢Python能够用这么简单的语句给我提供实验的环境，现在已经肯定下面的代码能够通过搜狗的代理访问到google的主页！程序输出的确实是Google的HTML代码！</p>
<p><span id="more-92"></span></p>
<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">socket</span>, <span style="color: #dc143c;">sys</span>
&nbsp;
s = <span style="color: #dc143c;">socket</span>.<span style="color: #dc143c;">socket</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">socket</span>.<span style="color: black;">AF_INET</span>, <span style="color: #dc143c;">socket</span>.<span style="color: black;">SOCK_STREAM</span><span style="color: black;">&#41;</span>
&nbsp;
s.<span style="color: black;">connect</span><span style="color: black;">&#40;</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;219.234.81.66&quot;</span>, <span style="color: #ff4500;">80</span><span style="color: black;">&#41;</span> <span style="color: black;">&#41;</span>
&nbsp;
data = <span style="color: #483d8b;">&quot;GET http://www.google.com/ HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Host: www.google.com<span style="color: #000099; font-weight: bold;">\</span>
<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>X-Sogou-Auth: 438892784B65C0ADAB8B42F1BF6E7984/91/1ac66c2d240157be<span style="color: #000099; font-weight: bold;">\</span>
<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>X-Sogou-Tag: 82cfc55e<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>X-Sogou-Timestamp: 49a7fa22<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
s.<span style="color: black;">sendall</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
    buf = s.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">4096</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>buf<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">break</span>
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">stdout</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>buf<span style="color: black;">&#41;</span></pre></div></div>
<p>然而，现在高兴还为时过早，这个程序我发送的HTTP头信息如下：</p>
<blockquote><p>GET http://www.google.com/ HTTP/1.1<br />
Host: www.google.com<br />
X-Sogou-Auth: 438892784B65C0ADAB8B42F1BF6E7984/91/1ac66c2d240157be<br />
X-Sogou-Tag: 82cfc55e<br />
X-Sogou-Timestamp: 49a7fa22</p></blockquote>
<p>已经确定这三个X-Sogou是必须的头验证，缺一不可，改掉其中任意一个的值，也不行。</p>
<p>其中X-Sogou-Auth的值一直不变，估计和系统、硬件有关。</p>
<p>X-Sogou-Tag一直在变，摸不清头绪。</p>
<p>X-Sogou-Timestamp似乎如其名字，和时间有关，每次发出都大概和秒表一样加一。</p>
<p>……  ……  ……  ……  ……  …… 接下来做了以下的猜测：</p>
<p>X-Sogou-Timestamp似乎是一个数值，按16进制输入计算器，将其转换成10进制数字，得到1235745314……恩，想起之前外国很多IT媒体都在兴奋的报道，情人节那天，Sat Feb 14 07:31:30 CST 2009——的时候的Unix时间值是1234567890，难道这个就是当前的Unix时间值？马上验证：</p>
<blockquote><p>&gt;&gt;&gt; time.ctime(1235745314)<br />
'Fri Feb 27 22:35:14 2009'</p></blockquote>
<p>强大！果然是刚才的时间！貌似看到希望的曙光了！</p>
<p>…… …… …… …… …… …… ……</p>
<p>然而，过了n久，运行刚才的python脚本，依然可以正常输出！看来代理服务器并没有校验Timestamp的值是否合理……那么唯一的解释，就是用Timestamp来做验证的密码了……</p>
<p>观察X-Sogou-Tag，刷新一个网页往往会发出很多个连接，包括图片、css文件什么的，发现同一秒中发出的连接，Timestamp值相同，Tag的值也相同！Tag由Timestamp决定！</p>
<p>…… …… …… …… …… …… ……</p>
<p>继续观察，发现Timestamp相同，但是域名不同的网站，Tag也不同，X-Sogou-Domain也不定时出现……</p>
<p>…… …… …… …… …… …… ……</p>
<p>哎，可恶的Tag，貌似Out of my reach了……看来自己还是当不成黑客，密码学领域知识很空白……对数字也没那个敏感……</p>
<p>收获就是对HTTP头的结构了解……上网查过，居然没有一点资料详细说！害我在wireshark里面对着那些16进制一个个字节的看！</p>
]]></content:encoded>
			<wfw:commentRss>http://apt-blog.net/exporing-the-protocol-of-sogou-browser/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

