forked from phantomcyber/playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
G_Suite_for_GMail_Message_Identifier_Activity_Analysis.json
380 lines (380 loc) · 17.2 KB
/
G_Suite_for_GMail_Message_Identifier_Activity_Analysis.json
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
{
"blockly": false,
"blockly_xml": "<xml></xml>",
"category": "Message Identifier Activity Analysis",
"coa": {
"data": {
"description": "Accepts an internet message id, and asks Gmail for a list of mailboxes to search, and then searches each one to look for records that have a matching internet message id. It then produces a normalized output and summary table.\n\nThis may not work in the intended fashion if your organization has more than 500 mailboxes.\n\nRef: D3-IAA: https://d3fend.mitre.org/technique/d3f:IdentifierActivityAnalysis/",
"edges": [
{
"conditions": [
{
"index": 0
}
],
"id": "port_3_to_port_4",
"sourceNode": "3",
"sourcePort": "3_out",
"targetNode": "4",
"targetPort": "4_in"
},
{
"id": "port_4_to_port_5",
"sourceNode": "4",
"sourcePort": "4_out",
"targetNode": "5",
"targetPort": "5_in"
},
{
"id": "port_6_to_port_7",
"sourceNode": "6",
"sourcePort": "6_out",
"targetNode": "7",
"targetPort": "7_in"
},
{
"id": "port_7_to_port_1",
"sourceNode": "7",
"sourcePort": "7_out",
"targetNode": "1",
"targetPort": "1_in"
},
{
"id": "port_5_to_port_9",
"sourceNode": "5",
"sourcePort": "5_out",
"targetNode": "9",
"targetPort": "9_in"
},
{
"id": "port_0_to_port_3",
"sourceNode": "0",
"sourcePort": "0_out",
"targetNode": "3",
"targetPort": "3_in"
},
{
"conditions": [
{
"index": 0
}
],
"id": "port_9_to_port_6",
"sourceNode": "9",
"sourcePort": "9_out",
"targetNode": "6",
"targetPort": "6_in"
}
],
"hash": "c253dd1339538806313a6f387f6df7a39d537dff",
"nodes": {
"0": {
"data": {
"advanced": {
"join": []
},
"functionName": "on_start",
"id": "0",
"type": "start"
},
"errors": {},
"id": "0",
"type": "start",
"warnings": {},
"x": 19.999999999999986,
"y": -1.2789769243681803e-13
},
"1": {
"data": {
"advanced": {
"join": []
},
"functionName": "on_finish",
"id": "1",
"type": "end"
},
"errors": {},
"id": "1",
"type": "end",
"warnings": {},
"x": 19.999999999999986,
"y": 1220
},
"3": {
"data": {
"advanced": {
"customName": "artifact filter",
"customNameId": 0,
"delimiter": ",",
"delimiter_enabled": true,
"join": [],
"note": "Ensure we have an input"
},
"conditions": [
{
"comparisons": [
{
"conditionIndex": 0,
"op": "!=",
"param": "playbook_input:message_id",
"value": "None"
}
],
"conditionIndex": 0,
"customName": "Input Valid",
"logic": "and"
}
],
"functionId": 1,
"functionName": "artifact_filter",
"id": "3",
"type": "filter"
},
"errors": {},
"id": "3",
"type": "filter",
"warnings": {},
"x": 60,
"y": 148
},
"4": {
"data": {
"action": "list users",
"actionType": "investigate",
"advanced": {
"customName": "get mailboxes",
"customNameId": 0,
"description": "Required step in order to search \"All\" of a Gsuite organization. This receives a list of mailboxes that are passed to the next action.",
"join": [],
"note": "Gets a list of mailboxes from GMail to search"
},
"connector": "G Suite for GMail",
"connectorConfigs": [
"g_suite_for_gmail"
],
"connectorId": "9c73f233-2c4a-406a-855e-41d8d2497d0e",
"connectorVersion": "v1",
"functionId": 1,
"functionName": "get_mailboxes",
"id": "4",
"parameters": {
"max_items": "500",
"page_token": ""
},
"requiredParameters": [],
"type": "action"
},
"errors": {},
"id": "4",
"type": "action",
"warnings": {},
"x": 0,
"y": 328
},
"5": {
"data": {
"action": "run query",
"actionType": "investigate",
"advanced": {
"customName": "search mailboxes",
"customNameId": 0,
"join": [],
"note": "Searches mailboxes returned by the previous action for messages with an internet message ID matching the input"
},
"connector": "G Suite for GMail",
"connectorConfigs": [
"g_suite_for_gmail"
],
"connectorId": "9c73f233-2c4a-406a-855e-41d8d2497d0e",
"connectorVersion": "v1",
"functionId": 1,
"functionName": "search_mailboxes",
"id": "5",
"parameters": {
"email": "get_mailboxes:action_result.data.*.emails.*.address",
"internet_message_id": "filtered-data:artifact_filter:condition_1:playbook_input:message_id",
"label": "Inbox",
"max_results": 100,
"query": ""
},
"requiredParameters": [
{
"data_type": "string",
"field": "email"
},
{
"data_type": "string",
"default": "Inbox",
"field": "label"
},
{
"data_type": "numeric",
"default": 100,
"field": "max_results"
}
],
"type": "action"
},
"errors": {},
"id": "5",
"type": "action",
"warnings": {},
"x": 0,
"y": 506
},
"6": {
"data": {
"advanced": {
"customName": "format message report",
"customNameId": 0,
"join": [],
"note": "Format the markdown table summary of this playbook execution"
},
"functionId": 1,
"functionName": "format_message_report",
"id": "6",
"parameters": [
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.parameter.internet_message_id",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.delivered_to",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.to",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.subject",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.from"
],
"template": "SOAR searched for occurrences of `{0}` within your environment using GSuite for GMail. The table below shows a summary of the information gathered.\n\n| Recipient | Addressed To | Subject | Sender |\n| --- | --- | --- | --- |\n%%\n| {1} | {2} | {3} | {4} |\n%%\n",
"type": "format"
},
"errors": {},
"id": "6",
"type": "format",
"userCode": " \n \n",
"warnings": {},
"x": 0,
"y": 864
},
"7": {
"data": {
"advanced": {
"customName": "build message output",
"customNameId": 0,
"description": "Logic regarding observable construction goes here",
"join": [],
"note": "Format the observable output object produced by this playbook"
},
"functionId": 1,
"functionName": "build_message_output",
"id": "7",
"inputParameters": [
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.parameter.internet_message_id",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.delivered_to",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.to",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.subject",
"filtered-data:results_filter:condition_1:search_mailboxes:action_result.data.*.from"
],
"outputVariables": [
"observable_array"
],
"type": "code"
},
"errors": {},
"id": "7",
"type": "code",
"userCode": "\n # Variable renaming for convenince\n messageID = filtered_result_0_parameter_internet_message_id\n recipients = filtered_result_0_data___delivered_to\n addressees = filtered_result_0_data___to\n subjects = filtered_result_0_data___subject\n senders = filtered_result_0_data___from\n \n build_message_output__observable_array = []\n recordList = []\n \n for message_id in messageID:\n \n # construct iterables for records\n for recipient, addressee, subject, sender in zip(recipients, addressees, subjects, senders):\n record = {\n \"recipient\": recipient,\n \"addressee\": addressee,\n \"subject\": subject,\n \"sender\": sender\n }\n recordList.append(record)\n \n # Create observable body\n observable = {\n \"value\": message_id,\n \"type\": \"internet message ID\",\n \"count\": len(recordList),\n \"source\": \"GSuite for GMail\",\n \"message_identifier_activity\": recordList\n }\n \n build_message_output__observable_array.append(observable)\n \n\n",
"warnings": {},
"x": 0,
"y": 1040
},
"9": {
"data": {
"advanced": {
"customName": "results filter",
"customNameId": 0,
"delimiter": ",",
"delimiter_enabled": true,
"description": "Filter results from mailbox search",
"join": [],
"note": "Remove mailboxes that couldn't be searched or where no results were found"
},
"conditions": [
{
"comparisons": [
{
"conditionIndex": 0,
"op": "==",
"param": "search_mailboxes:action_result.status",
"value": "success"
},
{
"conditionIndex": 0,
"op": ">",
"param": "search_mailboxes:action_result.summary.total_messages_returned",
"value": "0"
}
],
"conditionIndex": 0,
"customName": "Results found",
"logic": "and"
}
],
"functionId": 2,
"functionName": "results_filter",
"id": "9",
"type": "filter"
},
"errors": {},
"id": "9",
"type": "filter",
"warnings": {},
"x": 60,
"y": 684
}
},
"notes": "Inputs: internet message id\nInteractions: GSuite For GMail\nActions: get users, run query\nOutputs: observable, markdown report"
},
"input_spec": [
{
"contains": [
"internet message id"
],
"description": "An Internet Message ID to look for within a GMail environment",
"name": "message_id"
}
],
"output_spec": [
{
"contains": [],
"datapaths": [
"build_message_output:custom_function:observable_array"
],
"deduplicate": false,
"description": "An array of Observable objects ",
"metadata": {},
"name": "observable"
},
{
"contains": [],
"datapaths": [
"format_message_report:formatted_data"
],
"deduplicate": false,
"description": "An array of markdown reports",
"metadata": {},
"name": "markdown_report"
}
],
"playbook_type": "data",
"python_version": "3",
"schema": "5.0.10",
"version": "6.0.1.123902"
},
"create_time": "2023-06-16T15:48:09.633490+00:00",
"draft_mode": false,
"labels": [
"*"
],
"tags": [
"message_identifier_activity",
"internet_message_id",
"gsuite_for_gmail",
"D3-IAA"
]
}