Created
December 16, 2017 16:48
-
-
Save mattifestation/d063255f5c9509cacf49b78dad037832 to your computer and use it in GitHub Desktop.
Sample code used to extract catalog hashes from a mounted Windows image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/mattifestation/CatalogTools | |
Import-Module CatalogTools | |
# install.wim was mounted to C:\Mount with Mount-WindowsImage | |
$SystemCatalogEntries = ls -Path C:\Mount -Include '*.cat' -Recurse | % { | |
$CatalogInfo = Get-CatalogFile -Path $_.FullName | |
$FilePath = 'C:' + $CatalogInfo.FilePath.Path.Substring(8) | |
$CatalogInfo.CatalogMembers | ? { $_.HashInfo.Algorithm -and $_.HashInfo.FileHash } | % { | |
$Hint = $null | |
if ($_.NameValuePairs) { | |
$HintEntry = $_.NameValuePairs | ? { $_.Name -eq 'Hint' } | Select-Object -First 1 | |
if ($HintEntry) { $Hint = $HintEntry.Value } | |
} | |
[PSCustomObject] @{ | |
Algorithm = $_.HashInfo.Algorithm | |
Hash = $_.HashInfo.FileHash | |
CatalogPath = $FilePath | |
Hint = $Hint | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment