forked from shaniacht1/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation-CheckFiles.yml
46 lines (46 loc) · 1.12 KB
/
automation-CheckFiles.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
args:
- default: true
description: If provided, checks only files whose names are in the list. The names
should be comma-separated.
name: fileNames
comment: Iterate on all file artifacts in the investigation and return details of
positives
commonfields:
id: CheckFiles
version: -1
dependson:
must:
- file
deprecated: true
name: CheckFiles
runonce: false
script: |-
var fileNames = [];
if (args.fileNames) {
fileNames = args.fileNames.split(',');
}
var entries = executeCommand('getEntries', {});
var res = [];
for (var i=0; i<entries.length; i++) {
if (entries[i].File && (fileNames.length === 0 || fileNames.indexOf(entries[i].File) >= 0)) {
var rep = executeCommand('file', {file: entries[i].FileMetadata.MD5});
if (rep && Array.isArray(rep)) {
for (var r = 0; r < rep.length; r++) {
if (positiveFile(rep[r])) {
res.push(shortFile(rep[r]));
}
}
}
}
}
if (res.length > 0) {
res.push('yes');
return res;
}
return ['No suspicious files found', 'no'];
scripttarget: 0
system: true
tags:
- server
- threat-intel
type: javascript