16 Win Information Goldmine Flashcards
How get history in powershell ?
Get-History
How save history of powershell in a file ?
(Get-PSReadlineOption).HistorySavePath
How create PSCredential object (password: qwertqwertqwert123!! ) and connect on computer CLIENTWK220 ?
$password = ConvertTo-SecureString “qwertqwertqwert123!!” -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential(“daveadmin”, $password)
Enter-PSSession -ComputerName CLIENTWK220 -Credential $cred
whoami
How to connect via WinRM on Kali (ip: XXXX, user:daveadmin, password: qwertqwertqwert123!! ) ?
evil-winrm -i 192.168.50.220 -u daveadmin -p “qwertqwertqwert123!!”
Use Event viewer to get action of a script
Start the app “Event Viewer”
Why use evil-winrm instead of reverse shell via PS ?
Creating a PowerShell remoting session via WinRM in a bind shell can cause unexpected behavior.
How use evil-winrm to connect as user “daveadmin” with pass “pass!!” on target <IP></IP>
kali@kali:~$ evil-winrm -i 192.168.50.220 -u daveadmin -p “pass!!”
How prevent PS to log history (alternative ? (1))
Set-PSReadLineOption -HistorySaveStyle SaveNothing
Alternative: delete manually the history file
In which env. var is stored the history file path of PS ?
$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt