@@ -53,11 +53,11 @@ function Select-MimikatzDomainAccounts {
53
53
. PARAMETER Path
54
54
Choose the path or GLOB pattern that tells the function which files to search.
55
55
56
- . PARAMETER HashcatSelect
57
- Choose to look for either passwords or hashes (ntlm and sha1).
58
-
59
56
. PARAMETER OutputTo
60
57
Output the results either to the console, to a format parseable in hashcat, or to CSV.
58
+
59
+ . PARAMETER HashcatSelect
60
+ Choose to look for either passwords or hashes (ntlm and sha1).
61
61
#>
62
62
[CmdletBinding ()]
63
63
Param (
@@ -76,6 +76,7 @@ function Select-MimikatzDomainAccounts {
76
76
77
77
$DomainPasswordRegex = " \s+\*\s+Username\s+:\s+(?<username>[-_a-zA-Z0-9]+)[\r\n]+\s+\*\s+Domain\s+:\s+(?<domain>[a-zA-Z0-9]+)[\r\n]+\s+\*\s+Password\s+:\s+(?<password>(?!\(null\)).*)[\r\n]+"
78
78
$DomainHashRegex = " \s+\*\s+Username\s+:\s+(?<username>[-_a-zA-Z0-9]+)[\r\n]+\s+\*\s+Domain\s+:\s+(?<domain>[a-zA-Z0-9]+)[\r\n]+(\s+\*\sFlags\s+:\s+.*[\r\n]+)?\s+\*\s+NTLM\s+:\s+(?<ntlm>[0-9a-fA-F]+)[\r\n]+\s+\*\sSHA1\s+:\s+(?<sha1>[0-9a-fA-F]+)[\r\n]+"
79
+ $DomainCredmanRegex = " credman\s+:\s+[\r\n]+(?:\s+\[[0-9]+\][\r\n]+\s+\*\s+Username\s+:\s+(?<domain>[-_a-zA-Z0-9]+)\\(?<username>[-_a-zA-Z0-9]+)[\r\n]+\s+\*\s+Domain.*[\r\n]+\s+\*\s+Password\s+:\s+(?<password>.*)[\r\n]+)+"
79
80
80
81
$DomainAccounts = @ {}
81
82
Foreach ($LogFile in Get-ChildItem - Recurse $Path ) {
@@ -113,6 +114,26 @@ function Select-MimikatzDomainAccounts {
113
114
}
114
115
}
115
116
}
117
+
118
+ $DomainCredmanMatches = Select-String - InputObject $Content - AllMatches - Pattern $DomainCredmanRegex
119
+ if ($DomainCredmanMatches -ne $null ) {
120
+ Foreach ($Match in $DomainCredmanMatches.Matches ) {
121
+ For ($i = 0 ; $i -lt $Match.Groups [" username" ].Captures.Count; $i ++ ) {
122
+ $Domain = $Match.Groups [" domain" ].Captures[$i ].Value
123
+ $Username = $Match.Groups [" username" ].Captures[$i ].Value
124
+ $Password = $Match.Groups [" password" ].Captures[$i ].Value
125
+ if (! $DomainAccounts.ContainsKey ($Username )) {
126
+ $SearchEntry = New-DomainAccountEntry - Domain $Domain - Username $Username - Password $Password
127
+ $DomainAccounts.Add ($Username , $SearchEntry )
128
+ } else {
129
+ $SearchEntry = $DomainAccounts.Get_Item ($Username )
130
+ $SearchEntry.Domain = $Domain
131
+ $SearchEntry.Password = $Password
132
+ $DomainAccounts.Set_Item ($Username , $SearchEntry )
133
+ }
134
+ }
135
+ }
136
+ }
116
137
}
117
138
118
139
if ($DomainAccounts.Count -eq 0 ) {
0 commit comments