@@ -53,11 +53,11 @@ function Select-MimikatzDomainAccounts {
5353 . PARAMETER Path
5454 Choose the path or GLOB pattern that tells the function which files to search.
5555
56- . PARAMETER HashcatSelect
57- Choose to look for either passwords or hashes (ntlm and sha1).
58-
5956 . PARAMETER OutputTo
6057 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).
6161#>
6262 [CmdletBinding ()]
6363 Param (
@@ -76,6 +76,7 @@ function Select-MimikatzDomainAccounts {
7676
7777 $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]+"
7878 $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]+)+"
7980
8081 $DomainAccounts = @ {}
8182 Foreach ($LogFile in Get-ChildItem - Recurse $Path ) {
@@ -113,6 +114,26 @@ function Select-MimikatzDomainAccounts {
113114 }
114115 }
115116 }
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+ }
116137 }
117138
118139 if ($DomainAccounts.Count -eq 0 ) {
0 commit comments