|
1 | 1 | // |
2 | 2 | // QueryFolder test |
3 | | -// Simple format of the following blocks, separated by two new lines |
| 3 | +// |
| 4 | +// A test is made up of a name (one line), a query that can span multiple lines and ends with ; and one or multiple assertions (one per line) that end with ; |
| 5 | +// |
4 | 6 | // <name> |
5 | | -// <eql query> |
| 7 | +// <eql query>; |
6 | 8 | // <expectation 1> |
7 | 9 | // <expectation 2> |
8 | 10 | // ... |
9 | 11 | // <expectation n> |
| 12 | +// ; |
10 | 13 |
|
11 | 14 |
|
12 | 15 | basic |
13 | | -process where true |
| 16 | +process where true; |
14 | 17 | null |
15 | | - |
| 18 | +; |
16 | 19 |
|
17 | 20 | singleNumericFilterEquals |
18 | | -process where serial_event_id = 1 |
| 21 | +process where serial_event_id = 1; |
19 | 22 | "term":{"serial_event_id":{"value":1 |
20 | | - |
| 23 | +; |
21 | 24 |
|
22 | 25 | singleNumericFilterLess |
23 | | -process where serial_event_id < 4 |
| 26 | +process where serial_event_id < 4; |
24 | 27 | "range":{"serial_event_id":{"from":null,"to":4,"include_lower":false,"include_upper":false |
25 | | - |
| 28 | +; |
26 | 29 |
|
27 | 30 | singleNumericFilterLessEquals |
28 | | -process where serial_event_id <= 4 |
| 31 | +process where serial_event_id <= 4; |
29 | 32 | "range":{"serial_event_id":{"from":null,"to":4,"include_lower":false,"include_upper":true |
30 | | - |
| 33 | +; |
31 | 34 |
|
32 | 35 | singleNumericFilterGreater |
33 | | -process where serial_event_id > 4 |
| 36 | +process where serial_event_id > 4; |
34 | 37 | "range":{"serial_event_id":{"from":4,"to":null,"include_lower":false,"include_upper":false |
35 | | - |
| 38 | +; |
36 | 39 |
|
37 | 40 | singleNumericFilterGreaterEquals |
38 | | -process where serial_event_id >= 4 |
| 41 | +process where serial_event_id >= 4; |
39 | 42 | "range":{"serial_event_id":{"from":4,"to":null,"include_lower":true,"include_upper":false |
40 | | - |
| 43 | +; |
41 | 44 |
|
42 | 45 | mixedTypeFilter |
43 | | -process where process_name == "notepad.exe" or (serial_event_id < 4.5 and serial_event_id >= 3.1) |
| 46 | +process where process_name == "notepad.exe" or (serial_event_id < 4.5 and serial_event_id >= 3.1); |
44 | 47 | "term":{"process_name":{"value":"notepad.exe" |
45 | 48 | "range":{"serial_event_id":{"from":3.1,"to":4.5,"include_lower":true,"include_upper":false |
46 | | - |
| 49 | +; |
47 | 50 |
|
48 | 51 | notFilter |
49 | | -process where not (exit_code > -1) |
| 52 | +process where not (exit_code > -1); |
50 | 53 | "range":{"exit_code":{"from":null,"to":-1,"include_lower":false,"include_upper":true |
51 | | - |
| 54 | +; |
52 | 55 |
|
53 | 56 | inFilter |
54 | | -process where process_name in ("python.exe", "SMSS.exe", "explorer.exe") |
| 57 | +process where process_name in ("python.exe", "SMSS.exe", "explorer.exe"); |
55 | 58 | "terms":{"process_name":["python.exe","SMSS.exe","explorer.exe"], |
56 | | - |
| 59 | +; |
57 | 60 |
|
58 | 61 | equalsAndInFilter |
59 | 62 | process where process_path == "*\\red_ttp\\wininit.*" and opcode in (0,1,2,3) |
| 63 | +; |
60 | 64 | "wildcard":{"process_path":{"wildcard":"*\\\\red_ttp\\\\wininit.*" |
61 | 65 | {"terms":{"opcode":[0,1,2,3] |
62 | | - |
| 66 | +; |
63 | 67 |
|
64 | 68 | endsWithFunction |
65 | 69 | process where endsWith(user_name, 'c') |
| 70 | +; |
66 | 71 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalEqlScriptUtils.endsWith( |
67 | 72 | InternalQlScriptUtils.docValue(doc,params.v0),params.v1))", |
68 | 73 | "params":{"v0":"user_name","v1":"c"} |
69 | | - |
| 74 | +; |
70 | 75 |
|
71 | 76 | lengthFunctionWithExactSubField |
72 | 77 | process where length(file_name) > 0 |
| 78 | +; |
73 | 79 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalQlScriptUtils.gt( |
74 | 80 | InternalEqlScriptUtils.length(InternalQlScriptUtils.docValue(doc,params.v0)),params.v1))", |
75 | 81 | "params":{"v0":"file_name.keyword","v1":0} |
76 | | - |
| 82 | +; |
77 | 83 |
|
78 | 84 | lengthFunctionWithExactField |
79 | 85 | process where 12 == length(user_name) |
| 86 | +; |
80 | 87 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalQlScriptUtils.eq( |
81 | 88 | InternalEqlScriptUtils.length(InternalQlScriptUtils.docValue(doc,params.v0)),params.v1))", |
82 | 89 | "params":{"v0":"user_name","v1":12} |
83 | | - |
| 90 | +; |
84 | 91 |
|
85 | 92 | lengthFunctionWithConstantKeyword |
86 | 93 | process where 5 > length(constant_keyword) |
| 94 | +; |
87 | 95 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalQlScriptUtils.lt( |
88 | 96 | InternalEqlScriptUtils.length(InternalQlScriptUtils.docValue(doc,params.v0)),params.v1))", |
89 | 97 | "params":{"v0":"constant_keyword","v1":5} |
90 | | - |
| 98 | +; |
91 | 99 |
|
92 | 100 | startsWithFunction |
93 | 101 | process where startsWith(user_name, 'A') |
| 102 | +; |
94 | 103 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalEqlScriptUtils.startsWith( |
95 | 104 | InternalQlScriptUtils.docValue(doc,params.v0),params.v1))", |
96 | 105 | "params":{"v0":"user_name","v1":"A"} |
97 | | - |
| 106 | +; |
98 | 107 |
|
99 | 108 | substringFunction |
100 | 109 | process where substring(file_name, -4) == '.exe' |
| 110 | +; |
101 | 111 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalQlScriptUtils.eq( |
102 | 112 | InternalEqlScriptUtils.substring(InternalQlScriptUtils.docValue(doc,params.v0),params.v1,params.v2),params.v3))", |
103 | 113 | "params":{"v0":"file_name.keyword","v1":-4,"v2":null,"v3":".exe"} |
104 | | - |
| 114 | +; |
105 | 115 |
|
106 | 116 | betweenFunction |
107 | | -process where between(process_name, "s", "e") == "yst" |
| 117 | +process where between(process_name, "s", "e") == "yst"; |
| 118 | + |
108 | 119 | "script":{"source":"InternalQlScriptUtils.nullSafeFilter(InternalQlScriptUtils.eq( |
109 | 120 | InternalEqlScriptUtils.between(InternalQlScriptUtils.docValue(doc,params.v0),params.v1,params.v2,params.v3,params.v4),params.v5))", |
110 | 121 | "params":{"v0":"process_name","v1":"s","v2":"e","v3":false,"v4":false,"v5":"yst"} |
111 | | - |
| 122 | +; |
112 | 123 |
|
113 | 124 | wildcardFunctionSingleArgument |
114 | 125 | process where wildcard(process_path, "*\\red_ttp\\wininit.*") |
| 126 | +; |
115 | 127 | "wildcard":{"process_path":{"wildcard":"*\\\\red_ttp\\\\wininit.*" |
116 | | - |
| 128 | +; |
117 | 129 |
|
118 | 130 | wildcardFunctionTwoArguments |
119 | 131 | process where wildcard(process_path, "*\\red_ttp\\wininit.*", "*\\abc\\*") |
| 132 | +; |
120 | 133 | "wildcard":{"process_path":{"wildcard":"*\\\\red_ttp\\\\wininit.*" |
121 | 134 | "wildcard":{"process_path":{"wildcard":"*\\\\abc\\\\*" |
122 | | - |
| 135 | +; |
123 | 136 |
|
124 | 137 | wildcardFunctionThreeArguments |
125 | 138 | process where wildcard(process_path, "*\\red_ttp\\wininit.*", "*\\abc\\*", "*def*") |
| 139 | +; |
126 | 140 | "wildcard":{"process_path":{"wildcard":"*\\\\red_ttp\\\\wininit.*" |
127 | 141 | "wildcard":{"process_path":{"wildcard":"*\\\\abc\\\\*" |
128 | 142 | "wildcard":{"process_path":{"wildcard":"*def*" |
| 143 | +; |
0 commit comments