• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

SQL xp_cmdshell

mysql 搞代码 4年前 (2022-01-09) 23次浏览 已收录 0个评论

xp_cmdshell 创建文件夹,复制文件,导出数据到TXT,读取TXT,调用RAR–压缩文件夹 无 GO—打开xp_cmdshellEXEC sp_configure ‘show advanced options’, 1;RECONFIGURE;EXEC sp_configure ‘xp_cmdshell’, 1;RECONFIGUREGO—创建文件夹declare @shellCommand

xp_cmdshell 创建文件夹,复制文件,导出数据到TXT,读取TXT,调用RAR–压缩文件夹 <style> .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;} .CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;} .CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;} .CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;} .CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;} .CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;} </style> <!—ecms

    –> <!—ecms

  • $velocityCount
  • –> <!—ecms

–>

GO---打开xp_cmdshellEXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGUREGO---创建文件夹declare @shellCommand nvarchar(1024)Set @shellCommand='"mkdir C:\sqlcreatefold"'exec xp_cmdshell @shellCommandGO--复制文件--准备一个空的文本文件在C盘declare @shellCommand nvarchar(1024)Set @shellCommand='Copy "C:\1.txt'+'" "C:\sqlcreatefold\1.txt'+'"'exec xp_cmdshell @shellCommandGO--导出数据到T<strong style="color:transparent">来2源gaodaima#com搞(代@码&网</strong>XTCreate table ##temp(line varchar(100))Insert into ##temp(line)values('asdfghjklasdfghjkl')Insert into ##temp(line)values('一二三四五六七')declare @shellCommand nvarchar(1024)Set @shellCommand='bcp "Select line From ##temp" queryout C:\sqlcreatefold\1.txt'+' -S"." -U"sa" -P"123456" -c -T'exec xp_cmdshell @shellCommanddrop table ##tempGO--读取TXT文件Create table ##temp(line varchar(100))exec(N'bulk insert ##temp from N''C:\sqlcreatefold\1.txt''')select * From ##tempdrop table ##tempGO--调用RAR--压缩文件夹declare @shellCommand nvarchar(1024)declare @WinRar varchar(128)set @WinRar='C:\Program Files\WinRAR\WinRAR.exe'Set @shellCommand='""'+@WinRar+'"  a -ep1 -afzip -df -ibck C:\sqlcreatefold\Package.zip C:\sqlcreatefold"'exec xp_cmdshell @shellCommandset @shellCommand='" dir C:\sqlcreatefold"'exec xp_cmdshell @shellCommand

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:SQL xp_cmdshell
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址