-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Windows.Sys.BitLocker.yaml (#729)
Get BitLocker volumes, including keys, using PowerShell.
- Loading branch information
1 parent
2af9d41
commit 86404ed
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Windows.Sys.BitLocker | ||
author: Zane Gittins | ||
description: | | ||
This artifact gets all Bitlocker volumes using PowerShell, including the recovery password. | ||
# Can be CLIENT, CLIENT_EVENT, SERVER, SERVER_EVENT | ||
type: CLIENT | ||
|
||
sources: | ||
- precondition: | ||
SELECT OS From info() where OS = 'windows' | ||
|
||
query: | | ||
LET PowershellScript = '''$Results = @() | ||
$BitlockerVolumes = Get-BitLockerVolume | ||
$BitlockerVolumes | | ||
ForEach-Object { | ||
$RecoveryKey = [string]($_.KeyProtector).RecoveryPassword | ||
# Only add results with valid recovery keys. | ||
if ($RecoveryKey.Length -gt 5) { | ||
$_ | Add-Member -MemberType NoteProperty -Name "RecoveryPassword" -Value $RecoveryKey | ||
$Results += $_ | ||
} | ||
} | ||
return ($Results | ConvertTo-Json)''' | ||
SELECT * FROM foreach( | ||
row={ | ||
SELECT Stdout FROM execve(argv=["Powershell", "-ExecutionPolicy", | ||
"unrestricted", "-c", PowershellScript], length=1000000) | ||
}, query={ | ||
SELECT * FROM parse_json_array(data=Stdout) | ||
}) |