Created
March 26, 2020 05:43
-
-
Save scudette/bb642ef1a03ceed0c73b6b2031b22696 to your computer and use it in GitHub Desktop.
This artifact enumerates the service binaries from the registry and locates their binaries. We then calculate hashes of the binaries.
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
name: Windows.Services.Hashes | |
description: | | |
This artifact enumerates the service binaries from the registry and locates their | |
binaries. We then calculate hashes of the binaries. | |
parameters: | |
- name: serviceKeys | |
default: | | |
HKEY_LOCAL_MACHINE\System\CurrentControlSet\services\**\ImagePath | |
- name: pathRegex | |
default: >- | |
^(?P<path>"[^"]+"|[^ ]+) | |
sources: | |
- precondition: | |
SELECT OS From info() where OS = 'windows' | |
queries: | |
- LET paths = SELECT FullPath,Name, Data.value AS Value, | |
parse_string_with_regex(string=Data.value, | |
regex=pathRegex) as regData | |
FROM glob(globs=split(string=serviceKeys, sep="[, \\n]+"), | |
accessor="reg") | |
WHERE Data.value | |
- LET normalized = SELECT *, | |
expand(path= | |
regex_replace(re='(?i)^system32\\\\', replace="%SystemRoot%\\system32\\", | |
source=regex_replace( | |
source=regData.path, re="^\\\\SystemRoot\\\\", | |
replace="%SystemRoot%\\"))) AS RealPath | |
FROM paths | |
- SELECT FullPath, Name, Value, RealPath, | |
hash(path=expand(path=RealPath)).SHA256 AS Hash | |
FROM normalized |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment