首页 > 系统服务 > 详细

powershell -enc参数无法解码base64编码payload的解决方案

时间:2018-07-07 00:01:43      阅读:664      评论:0      收藏:0      [点我收藏+]

powershell的-enc参数允许传入一个base64编码过的powershell脚本字符串作为参数来执行该powershell脚本,该方法常被用于绕过杀毒软件的主动防御机制。

今天下午在做一个后门程序时,通过在线base64编码网站编码的字符串竟然没法被powershell的-enc参数解析,解析时全是乱码,通过查找资料终于解决了这个问题

故将这个问题记录下来以备后续使用

方法引用自:http://www.pstips.net/question/5827.html

可以使用如下脚本,对所需powershell脚本进行编码,所得字符串可以被powershell的-enc参数解析

$fileContent = “所要编码的脚本”
$bytes = [System.Text.Encoding]::Unicode.GetBytes($fileContent)
$encodedCommand = [Convert]::ToBase64String($bytes)
echo $encodedCommand

编码后的脚本可以通过如下命令解析执行

powershell -enc $encodedCommand

 

powershell -enc参数无法解码base64编码payload的解决方案

原文:https://www.cnblogs.com/zlgxzswjy/p/9275818.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!