<?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>Kernel2Heart &#187; Script</title>
	<atom:link href="http://www.kernel2heart.com/labels/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kernel2heart.com</link>
	<description>一个人的内心里,究竟隐藏了什么呢?</description>
	<lastBuildDate>Fri, 20 May 2011 05:10:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>一个有趣的禁止复制代码</title>
		<link>http://www.kernel2heart.com/2010/07/a-clipboard-hijack-code/</link>
		<comments>http://www.kernel2heart.com/2010/07/a-clipboard-hijack-code/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 07:05:32 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/07/%e4%b8%80%e4%b8%aa%e6%9c%89%e8%b6%a3%e7%9a%84%e7%a6%81%e6%ad%a2%e5%a4%8d%e5%88%b6%e4%bb%a3%e7%a0%81/</guid>
		<description><![CDATA[其实是clipboard hijacking技术罢了。 主要内容是在content-min中：]]></description>
			<content:encoded><![CDATA[<p>其实是clipboard hijacking技术罢了。</p>
<p> <span id="more-450"></span>  主要内容是在content-min中： <</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">KISSY.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;textarea&quot;</span><span style="color: #339933;">,</span> b <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\u</span>7981<span style="color: #000099; font-weight: bold;">\u</span>6b62copy!&quot;</span><span style="color: #339933;">,</span> g <span style="color: #339933;">=</span> c.<span style="color: #660066;">Event</span><span style="color: #339933;">,</span> f <span style="color: #339933;">=</span> document<span style="color: #339933;">,</span> d <span style="color: #339933;">=</span> f.<span style="color: #660066;">body</span><span style="color: #339933;">,</span> h <span style="color: #339933;">=</span> c.<span style="color: #660066;">DOM</span><span style="color: #339933;">,</span> e <span style="color: #339933;">=</span> c.<span style="color: #660066;">Node</span><span style="color: #339933;">,</span> 
    a <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> e<span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>h.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;&quot;</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">' style=&quot;position:absolute;left:-9999px;&quot;&gt;'</span> <span style="color: #339933;">+</span> b <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;/&quot;</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    g.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span>document<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;contextmenu&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>j<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        j.<span style="color: #660066;">halt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    g.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span>document<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;keydown&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>l<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> l.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>m <span style="color: #339933;">===</span> <span style="color: #CC0000;">67</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>l.<span style="color: #660066;">ctrlKey</span> <span style="color: #339933;">||</span> l.<span style="color: #660066;">metaKey</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> c.<span style="color: #660066;">Selection</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> k <span style="color: #339933;">=</span> j.<span style="color: #660066;">getRanges</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            a<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            a<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                k.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    d.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\u</span>6211<span style="color: #000099; font-weight: bold;">\u</span>662f<span style="color: #000099; font-weight: bold;">\u</span>5185<span style="color: #000099; font-weight: bold;">\u</span>5bb9<span style="color: #000099; font-weight: bold;">\u</span>ff0c<span style="color: #000099; font-weight: bold;">\u</span>4f60<span style="color: #000099; font-weight: bold;">\u</span>53ef<span style="color: #000099; font-weight: bold;">\u</span>4ee5copy<span style="color: #000099; font-weight: bold;">\u</span>6211<span style="color: #000099; font-weight: bold;">\u</span>770b<span style="color: #000099; font-weight: bold;">\u</span>770b<span style="color: #000099; font-weight: bold;">\u</span>ff01&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>适用于所有浏览器，google Docs也是使用的这种技术。<br />
例子可以在<a href="http://lite-ext.googlecode.com/svn/trunk/lite-ext/playground/no-copy/no-copy.html" target="_blank">http://lite-ext.googlecode.com/svn/trunk/lite-ext/playground/no-copy/no-copy.html</a>找到</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/07/a-clipboard-hijack-code/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>如何使用GreaseMonkey给页面添加超链接</title>
		<link>http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/</link>
		<comments>http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 10:00:35 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/</guid>
		<description><![CDATA[GreaseMonkey是个很强大的软件，无论是在Firefox还是Chrome上的表现，都无疑是出众的。之前写过一篇关于GreaseMonkey的文章，但是一直时间不多，没有继续研究下去。 这次打算做一个某知名网站的辅助工具（平时还是firefox用得多，chrome是偶尔用下，不过理论上Firefox和Chrome都是兼容的），所以就把GreaseMonkey又上手了一下。 比如我们要在某一页面添加一个借口，比如说：显示楼主。通过对页面结构的观察（我是用的是Firebug，总之自己习惯的工具就好），发现可以在一个id名为“thread_nav_lef”的Div上添加一个链接。这个Div的结构大致如下： 1 2 3 4 5 6 7 8 9 10 &#60;div id=&#34;thread_nav_left&#34;&#62; &#60;ul&#62; &#160; &#60;li&#62;&#60;a onclick=&#34;Post.reply(&#38;#39;0&#38;#39;);&#34; href=&#34;#sub&#34;&#62;快速回复&#60;/a&#62;&#60;/li&#62; &#160; &#60;li&#62;&#60;a title=&#34;切换到经典版&#34; onclick=&#34;Page.changeVersion(2);return false;&#34; href=&#34;#&#34;&#62;切换到经典版&#60;/a&#62;&#60;/li&#62; &#160; &#60;/ul&#62; &#160; &#60;/div&#62; 这样可以这样写： 1 2 3 4 5 6 7 8 9 &#8230; <a href="http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>是个很强大的软件，无论是在<a href="http://www.kernel2heart.com/labels/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">Firefox</a>还是Chrome上的表现，都无疑是出众的。之前写过<a href="http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/" target="_blank">一篇关于GreaseMonkey的文章</a>，但是一直时间不多，没有继续研究下去。</p>
<p>这次打算做一个某知名网站的辅助工具（平时还是<a href="http://www.kernel2heart.com/labels/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">firefox</a>用得多，chrome是偶尔用下，不过理论上<a href="http://www.kernel2heart.com/labels/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">Firefox</a>和Chrome都是兼容的），所以就把<a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>又上手了一下。</p>
<p> <span id="more-430"></span>
<p>比如我们要在某一页面添加一个借口，比如说：显示楼主。通过对页面结构的观察（我是用的是Firebug，总之自己习惯的工具就好），发现可以在一个id名为“thread_nav_lef”的Div上添加一个链接。这个Div的结构大致如下：</p>
<blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thread_nav_left&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
&nbsp;
                 <span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Post.reply(&amp;#39;0&amp;#39;);&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#sub&quot;</span><span style="color: #339933;">&gt;</span>快速回复<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
&nbsp;
                 <span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a title<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;切换到经典版&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Page.changeVersion(2);return false;&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">&gt;</span>切换到经典版<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
&nbsp;
            <span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
&nbsp;
        <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</blockquote>
<p>这样可以这样写：</p>
<blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> init <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #003366; font-weight: bold;">var</span> showButton <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'thread_nav_left'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//为什么第二个是2？因为2比较美观，第一个格式有点乱…. </span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> flli <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> fllink <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
        fllink.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'javascript:void(0);'</span><span style="color: #339933;">;</span> 
&nbsp;
        fllink.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'只看楼主'</span><span style="color: #339933;">;</span> 
&nbsp;
        flli.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>fllink<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
        fllink.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> filter<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Filter是个函数，当点击时会执行Filter函数 </span>
&nbsp;
        showButton.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>flli<span style="color: #339933;">,</span> showButton.<span style="color: #660066;">nextSibling</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</blockquote>
<p>nextSibling是一个插入到指定节点之后的方法，如果插入指定节点之前，可以选择去掉nextSibling。</p>
<p>效果大致如下：快速回复   只看楼主  切换到经典版</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>GreaseMonkey的应用真是强大</title>
		<link>http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/</link>
		<comments>http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:34:28 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/</guid>
		<description><![CDATA[今天无聊，想去下一个漫画来看，本来嘛，想着FX这么强大，一定有相关的扩展了，搜索了一番，失望而归。如果你晓得什么在看图的时候可以自动下载指定网址序列下图片的插件，也欢迎指教！ 好吧，事实上我打算写的东西也不在这个里面，仅仅只是一些简单的GM应用而已。 首先推荐一本入门教程，非常不错，像我这样的脚本白痴都可以看的懂的：《深入浅出Greasemonkey》。在里面也有很多很简单，但是却非常实用的例子，为快速上手GreaseMonkey脚本编写提供了非常方便的指南。 在参阅该教程几页之后，我也可以写一个清爽页面的脚本啦： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // ==UserScript== // @name 百度贴吧侧边栏广告去除器 // @namespace http://www.kernel2heart.com // @description 去除百度贴吧侧边栏广告，免广告功能请配合Adblock Plua使用 // @include http://tieba.baidu.com/* // @author 灰机要考研 // &#8230; <a href="http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>今天无聊，想去下一个漫画来看，本来嘛，想着FX这么强大，一定有相关的扩展了，搜索了一番，失望而归。如果你晓得什么<strong><font color="#ff0000">在看图的时候可以自动下载指定网址序列下图片的插件</font></strong>，也欢迎指教！</p>
<p>   <span id="more-261"></span>
<p>好吧，事实上我打算写的东西也不在这个里面，仅仅只是一些简单的GM应用而已。</p>
<p>首先推荐一本入门教程，非常不错，像我这样的脚本白痴都可以看的懂的：《<a href="http://www.firefox.net.cn/dig/" target="_blank">深入浅出Greasemonkey</a>》。在里面也有很多很简单，但是却非常实用的例子，为快速上手<a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>脚本编写提供了非常方便的指南。</p>
<p>在参阅该教程几页之后，我也可以写一个清爽页面的脚本啦：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// ==UserScript==</span>
<span style="color: #006600; font-style: italic;">// @name           百度贴吧侧边栏广告去除器</span>
<span style="color: #006600; font-style: italic;">// @namespace      http://www.kernel2heart.com</span>
<span style="color: #006600; font-style: italic;">// @description    去除百度贴吧侧边栏广告，免广告功能请配合Adblock Plua使用</span>
<span style="color: #006600; font-style: italic;">// @include        http://tieba.baidu.com/*</span>
<span style="color: #006600; font-style: italic;">// @author         灰机要考研</span>
<span style="color: #006600; font-style: italic;">// @version        0.01</span>
<span style="color: #006600; font-style: italic;">/* @reason
* 支持去除普通百度贴吧侧边栏广告
* 横幅flash和图片广告请使用Adblock plus去除
@end*/</span>
<span style="color: #006600; font-style: italic;">// ==/UserScript==</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> adSidebar <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rightAd'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>adSidebar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    adSidebar.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>adSidebar<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>如果比较感兴趣如何实现这些功能的，可以参见《<a href="http://www.firefox.net.cn/dig/" target="_blank">深入浅出Greasemonkey</a>》。GM的功能在处理网页时实在是太强大了，通过<a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>就可以轻松操纵网页的任意内容了，不过可惜的是，就我的使用经验来说，好像GM需要等待页面载入完成之后才会执行脚本，这样的话，比如载入去广告脚本的时候，广告还是会一闪而过的，算是一个缺点吧。</p>
<p>我是一个JS苦手，其实在去除其他广告时也有其他措施的，例如一个Div广告具有class=sponsoredlink属性，且唯一，可以这样获得：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">thisDiv <span style="color: #339933;">=</span> document.<span style="color: #660066;">evaluate</span><span style="color: #009900;">&#40;</span>
    <span style="color: #3366CC;">&quot;//div[@class='sponsoredlink']&quot;</span><span style="color: #339933;">,</span>
    document<span style="color: #339933;">,</span>
    <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
    XPathResult.<span style="color: #660066;">UNORDERED_NODE_SNAPSHOT_TYPE</span><span style="color: #339933;">,</span>
    <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>如果属性不唯一的话，会返回元素组，如果RemoveChild的时候，会对所有元素进行操作。</p>
<p>有其他问题，欢迎一起交流，GM脚本的编写我才刚刚开始看，如果你有兴趣，我们可以一起学习。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>分享：一个unpack conficker worm的脚本</title>
		<link>http://www.kernel2heart.com/2009/07/ollydbg-script-for-unpack-conficker-worm-b/</link>
		<comments>http://www.kernel2heart.com/2009/07/ollydbg-script-for-unpack-conficker-worm-b/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 11:41:56 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Ollydbg]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Virus]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/07/ollydbg-script-for-unpack-conficker-worm-b/</guid>
		<description><![CDATA[lclee 说: i just finish the ollyscript automated unpack the conficker worm tested these sample with MD5 MD5:83c52b56b1ecbe23183bae5e05474e3e MD5:6ee741c4e0d36d0dc9162a6e71943379 if want to get the sample, search the md5 from here http://www.offensivecomputing.net/ hmm..still not perfect yet the script it just can &#8230; <a href="http://www.kernel2heart.com/2009/07/ollydbg-script-for-unpack-conficker-worm-b/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote><p>lclee 说:<br />
i just finish the ollyscript<br />
automated unpack the conficker worm<br />
tested these sample with MD5<br />
MD5:83c52b56b1ecbe23183bae5e05474e3e<br />
MD5:6ee741c4e0d36d0dc9162a6e71943379<br />
if want to get the sample, search the md5 from here<br />
<a href="http://www.offensivecomputing.net/">http://www.offensivecomputing.net/</a><br />
hmm..still not perfect yet the <a href="http://www.kernel2heart.com/labels/script/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Script">script</a><br />
it just can automated unpack the conficker variant B<br />
C still cannot</p></blockquote>
<p><span id="more-87"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
</pre></td><td class="code"><pre class="asm" style="font-family:monospace;">var goaddr1
var goaddr2
var goaddr3
var goaddr4
var goaddr5
var goaddr6
var goaddr7
var szmemory
&nbsp;
start<span style="color: #339933;">:</span>
  find eip<span style="color: #339933;">,</span> #807C240801#
  <span style="color: #00007f; font-weight: bold;">cmp</span> $RESULT<span style="color: #339933;">,</span> <span style="color: #0000ff;">0</span>
  <span style="color: #00007f; font-weight: bold;">jne</span> uncompress1
&nbsp;
error1<span style="color: #339933;">:</span>
  msg <span style="color: #7f007f;">&quot;Failed to uncompress 1st layer packer of conficker worm variant B&quot;</span>
  <span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
uncompress1<span style="color: #339933;">:</span>
  <span style="color: #00007f; font-weight: bold;">sti</span>
  msg <span style="color: #7f007f;">&quot;Start to uncompress 1st layer packer&quot;</span>
  <span style="color: #00007f; font-weight: bold;">mov</span> goaddr1<span style="color: #339933;">,</span> $RESULT
  findop goaddr1<span style="color: #339933;">,</span> #83EC??#
  <span style="color: #00007f; font-weight: bold;">cmp</span> $RESULT<span style="color: #339933;">,</span> <span style="color: #0000ff;">0</span>
  bphws $RESULT<span style="color: #339933;">,</span> <span style="color: #7f007f;">&quot;x&quot;</span>
  run
  bphwc $RESULT
  <span style="color: #00007f; font-weight: bold;">sti</span>
  sto
  msg <span style="color: #7f007f;">&quot;1st Layer packer success uncompress, Now start uncompress 2nd layer packer&quot;</span>
&nbsp;
SearchAPI<span style="color: #339933;">:</span>
  gpa <span style="color: #7f007f;">&quot;VirtualProtect&quot;</span><span style="color: #339933;">,</span> <span style="color: #7f007f;">&quot;kernel32.dll&quot;</span>
  <span style="color: #00007f; font-weight: bold;">mov</span> goaddr2<span style="color: #339933;">,</span> $RESULT
  bphws goaddr2<span style="color: #339933;">,</span> <span style="color: #7f007f;">&quot;x&quot;</span>
  run
  bphwc goaddr2
  msg <span style="color: #7f007f;">&quot;Landed at address of VirtualProtect, check the segment address of memory allocate for dll&quot;</span>
  <span style="color: #00007f; font-weight: bold;">mov</span> goaddr3<span style="color: #339933;">,</span> <span style="color: #00007f;">esp</span>
  <span style="color: #00007f; font-weight: bold;">add</span> goaddr3<span style="color: #339933;">,</span> <span style="color: #0000ff;">4</span>
  <span style="color: #00007f; font-weight: bold;">mov</span> goaddr4<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">&#91;</span>goaddr3<span style="color: #009900; font-weight: bold;">&#93;</span>
  findop goaddr4<span style="color: #339933;">,</span> #807C240801#
  <span style="color: #00007f; font-weight: bold;">cmp</span> $RESULT<span style="color: #339933;">,</span> <span style="color: #0000ff;">0</span>
  <span style="color: #00007f; font-weight: bold;">jne</span> uncompress2
&nbsp;
error2<span style="color: #339933;">:</span>
  msg <span style="color: #7f007f;">&quot;Failed to uncompress 2nd layer packer of conficker worm variant B&quot;</span>
  <span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
uncompress2<span style="color: #339933;">:</span>
  <span style="color: #00007f; font-weight: bold;">mov</span> goaddr5<span style="color: #339933;">,</span> $RESULT
  go goaddr5
  msg <span style="color: #7f007f;">&quot;start uncompress 2nd layer packer&quot;</span>
  find eip<span style="color: #339933;">,</span> #83EC??#
  <span style="color: #00007f; font-weight: bold;">mov</span> goaddr6<span style="color: #339933;">,</span> $RESULT
  bphws goaddr6<span style="color: #339933;">,</span> <span style="color: #7f007f;">&quot;x&quot;</span>
  run
  bphwc goaddr6
  <span style="color: #00007f; font-weight: bold;">sti</span>
  sto
&nbsp;
  <span style="color: #339933;">//</span><span style="color: #00007f; font-weight: bold;">mov</span> goaddr7<span style="color: #339933;">,</span> eip
  <span style="color: #339933;">//</span>gmemi goaddr7<span style="color: #339933;">,</span> MEMORYSIZE
  <span style="color: #339933;">//</span><span style="color: #00007f; font-weight: bold;">mov</span> szmemory<span style="color: #339933;">,</span> $RESULT
&nbsp;
  <span style="color: #339933;">//</span>msgyn <span style="color: #7f007f;">&quot;Dump the file from the memory?&quot;</span>
  <span style="color: #339933;">//</span><span style="color: #00007f; font-weight: bold;">cmp</span> $RESULT<span style="color: #339933;">,</span> <span style="color: #0000ff;">0</span>
  <span style="color: #339933;">//</span><span style="color: #00007f; font-weight: bold;">jne</span> dumpfile
  <span style="color: #339933;">//</span><span style="color: #00007f; font-weight: bold;">jmp</span> <span style="color: #000000; font-weight: bold;">end</span>
&nbsp;
<span style="color: #339933;">//</span>error3<span style="color: #339933;">:</span>
  <span style="color: #339933;">//</span>msg <span style="color: #7f007f;">&quot;Failed to dump the file from the memory&quot;</span>
  <span style="color: #339933;">//</span><span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
<span style="color: #339933;">//</span>dumpfile<span style="color: #339933;">:</span>
  <span style="color: #339933;">//</span>dma goaddr7<span style="color: #339933;">,</span> szmemory<span style="color: #339933;">,</span> <span style="color: #7f007f;">&quot;conficker.mem&quot;</span>
  <span style="color: #339933;">//</span>msg <span style="color: #7f007f;">&quot;stop&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span><span style="color: #339933;">:</span>
  cmt eip<span style="color: #339933;">,</span> <span style="color: #7f007f;">&quot;This is Original Entry Point of the conficker worm variant B&quot;</span>
  msg <span style="color: #7f007f;">&quot;This is OEP of the binary file. Right click and select &quot;</span>backup<span style="color: #7f007f;">&quot; and &quot;</span>save <span style="color: #000000; font-weight: bold;">data</span> to file<span style="color: #7f007f;">&quot; and dump the binary from the memory. Binary decrypted.&quot;</span>
  msg <span style="color: #7f007f;">&quot;Script by lclee_vx/F-13 Labs&quot;</span>
  <span style="color: #00007f; font-weight: bold;">ret</span></pre></td></tr></table></div>

<p>很久没有沾手病毒这一块了，相对之下，lclee最近的成果可真是多呀 :)。 马上考完最后一场编译原理之后，我全部的精力就要集中在考研这种事情上了。加油！这个是给lclee的，也是给自己的。:)</p>
<p>目标还没有选好，北京理工其实也不错，不是吗？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/07/ollydbg-script-for-unpack-conficker-worm-b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

