Skip to content

Commit 5fc6f2b

Browse files
committed
Support for Credman
[+] Added support for credman credentials to Select-MimikatzDomainAccounts [*] Minor changes in PowerShellUtilities.psd1 and Select-MimikatzLocalAccounts.ps1
1 parent 77af70f commit 5fc6f2b

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

PowerShellUtilities.psd1

0 Bytes
Binary file not shown.

Select-MimikatzDomainAccounts.ps1

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

Select-MimikatzLocalAccounts.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ function Select-MimikatzLocalAccounts {
4747
.PARAMETER Path
4848
Choose the path or GLOB pattern that tells the function which files to search.
4949
50-
.PARAMETER HashcatSelect
51-
Choose to look for either passwords or hashes (ntlm and sha1).
52-
5350
.PARAMETER OutputTo
5451
Output the results either to the console, to a format parseable in hashcat, or to CSV.
52+
53+
.PARAMETER HashcatSelect
54+
Choose to look for either passwords or hashes (ntlm and lm).
5555
#>
5656
[CmdletBinding()]
5757
Param (

0 commit comments

Comments
 (0)