forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement timeout on report generation in the GUI. (Velocidex#514)
This prevents the gui from being overloaded by expensive reports. Backport Generic.Utils.FetchBinary to older clients.
- Loading branch information
Showing
25 changed files
with
265 additions
and
165 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
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
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
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
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,51 @@ | ||
name: Windows.Search.Yara | ||
description: | | ||
Searches for a specific malicious file or set of files by a Yara rule. | ||
You will need to upload your yara file using: | ||
``` | ||
velociraptor tools upload --name YaraRules my_yara_file.yara | ||
``` | ||
tools: | ||
- name: YaraRules | ||
|
||
parameters: | ||
- name: nameRegex | ||
description: Only file names that match this regular expression will be scanned. | ||
default: "(exe|txt|dll|php)$" | ||
|
||
precondition: | ||
SELECT * FROM info() WHERE OS =~ "windows" | ||
|
||
sources: | ||
- query: | | ||
LET yara_rules <= SELECT read_file(filename=FullPath) AS Rule | ||
FROM Artifact.Generic.Utils.FetchBinary(ToolName="YaraRules") | ||
LET fileList = SELECT FullPath | ||
FROM parse_mft( | ||
accessor="ntfs", | ||
filename="C:\\$MFT") | ||
WHERE InUse | ||
AND FileName =~ nameRegex | ||
AND NOT FullPath =~ "WinSXS" | ||
-- These files are typically short - only report a single hit. | ||
LET search = SELECT Rule, String.Offset AS HitOffset, | ||
str(str=String.Data) AS HitContext, | ||
FileName, | ||
File.Size AS Size, | ||
File.ModTime AS ModTime | ||
FROM yara( | ||
rules=yara_rules[0].Rule, key="A", | ||
files="C:/" + FullPath) | ||
LIMIT 1 | ||
-- Only do something when yara rules are available. | ||
SELECT * FROM if(condition=yara_rules, | ||
then={ | ||
SELECT *, upload(file=FileName) AS Upload | ||
FROM foreach(row=fileList, query=search) | ||
}) |
Oops, something went wrong.