10 Essential PowerShell Commands for Offensive Security
Invoke-WebRequest Download files from a URL. This can be used to pull malicious payloads.
Invoke-Expression (IEX) Execute strings or scripts, often used for fileless attacks by downloading and running scripts in memory.
Set-ExecutionPolicy Change the execution policy to allow running scripts. Useful when bypassing script execution restrictions.
Get-WmiObject Gather detailed information about the target machine, including OS details, hardware specs, and processes.
Get-Process List all running processes. Often used for identifying running services or processes that can be exploited.
Start-Process Execute a process on the target machine, useful for starting a new payload or running privilege escalation techniques.
New-Object System.Net.Sockets.TCPClient Create a reverse shell by opening a TCP connection.
Get-Content Read the contents of a file. It can be used for exfiltrating sensitive data.
Out-File Write data to a file. Useful for saving stolen credentials or logs.
Add-Type Inject C# code directly into PowerShell, enabling the use of advanced .NET functionalities or custom code execution.
Note: The usage of these commands is for educational and authorized testing purposes only. Always ensure you have permission before engaging in offensive security activities.