forked from phantomcyber/playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PhishTank_URL_Reputation_Analysis.json
364 lines (364 loc) · 18.1 KB
/
PhishTank_URL_Reputation_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
{
"blockly": false,
"blockly_xml": "<xml></xml>",
"category": "Identifier Reputation Analysis",
"coa": {
"data": {
"description": "Accepts a URL and does reputation analysis on the objects. Generates a global report and a per observable sub-report and normalized score. The score can be customized as desired.\n\nRef: https://d3fend.mitre.org/technique/d3f:IdentifierReputationAnalysis/",
"edges": [
{
"id": "port_0_to_port_2",
"sourceNode": "0",
"sourcePort": "0_out",
"targetNode": "2",
"targetPort": "2_in"
},
{
"id": "port_2_to_port_4",
"sourceNode": "2",
"sourcePort": "2_out",
"targetNode": "4",
"targetPort": "4_in"
},
{
"conditions": [
{
"index": 0
}
],
"id": "port_4_to_port_3",
"sourceNode": "4",
"sourcePort": "4_out",
"targetNode": "3",
"targetPort": "3_in"
},
{
"id": "port_3_to_port_5",
"sourceNode": "3",
"sourcePort": "3_out",
"targetNode": "5",
"targetPort": "5_in"
},
{
"id": "port_5_to_port_7",
"sourceNode": "5",
"sourcePort": "5_out",
"targetNode": "7",
"targetPort": "7_in"
},
{
"id": "port_7_to_port_6",
"sourceNode": "7",
"sourcePort": "7_out",
"targetNode": "6",
"targetPort": "6_in"
},
{
"id": "port_6_to_port_1",
"sourceNode": "6",
"sourcePort": "6_out",
"targetNode": "1",
"targetPort": "1_in"
}
],
"hash": "c6a3356c448c9ecaad5287502c3867284b3a6cac",
"nodes": {
"0": {
"data": {
"advanced": {
"join": []
},
"functionName": "on_start",
"id": "0",
"type": "start"
},
"errors": {},
"id": "0",
"type": "start",
"warnings": {},
"x": 19.999999999999986,
"y": -1.9184653865522705e-13
},
"1": {
"data": {
"advanced": {
"join": []
},
"functionName": "on_finish",
"id": "1",
"type": "end"
},
"errors": {},
"id": "1",
"type": "end",
"warnings": {},
"x": 19.999999999999986,
"y": 1180
},
"2": {
"data": {
"action": "url reputation",
"actionType": "investigate",
"advanced": {
"customName": "url reputation",
"customNameId": 0,
"description": "Queries PhishTank for information about the provided URL(s)",
"join": [],
"note": "Queries PhishTank for information about the provided URL(s)"
},
"connector": "PhishTank",
"connectorConfigs": [
"phishtank"
],
"connectorId": "c193026d-46cf-4f17-b4b9-f22525d2d87e",
"connectorVersion": "v1",
"functionId": 1,
"functionName": "url_reputation",
"id": "2",
"parameters": {
"url": "playbook_input:url"
},
"requiredParameters": [
{
"data_type": "string",
"field": "url"
}
],
"type": "action"
},
"errors": {},
"id": "2",
"type": "action",
"warnings": {},
"x": 0,
"y": 148
},
"3": {
"data": {
"advanced": {
"customName": "normalize score url",
"customNameId": 0,
"description": "Contains custom code for normalizing score. Adjust the logic as desired in the documented sections.",
"join": [],
"note": "Contains custom code for normalizing score. Adjust the logic as desired in the documented sections."
},
"functionId": 1,
"functionName": "normalize_score_url",
"id": "3",
"inputParameters": [
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.summary.In_Database",
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.summary.Valid",
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.summary.Verified"
],
"outputVariables": [
"url_score_object",
"scores"
],
"type": "code"
},
"errors": {},
"id": "3",
"type": "code",
"userCode": " \n # Assign variables\n normalize_score_url__url_score_object = []\n normalize_score_url__scores = []\n in_database_list = filtered_result_0_summary_in_database\n valid_list = filtered_result_0_summary_valid\n verified_list = filtered_result_0_summary_verified\n \n \n # Reference for scores: https://schema.ocsf.io/objects/reputation\n score_table = {\n \"-1\": \"Other\",\n \"0\":\"Unknown\",\n \"1\":\"Very_Safe\",\n \"2\":\"Safe\",\n \"3\":\"Probably_Safe\",\n \"4\":\"Leans_Safe\",\n \"5\":\"May_not_be_Safe\",\n \"6\":\"Exercise_Caution\",\n \"7\":\"Suspicious_or_Risky\",\n \"8\":\"Possibly_Malicious\",\n \"9\":\"Probably_Malicious\",\n \"10\":\"Malicious\"\n }\n \n # PhishTank URL Data\n # Adjust logic as desired\n for in_database, valid, verified in zip(in_database_list, valid_list, verified_list):\n \n # Condition 1 - In database but verified not valid phish\n if in_database and verified and not valid:\n score_id = \"2\"\n\n # Condition 2 - In database and valid phish\n elif in_database and valid:\n score_id = \"10\"\n \n # Condition 3 - In database but not verified\n elif in_database and not verified:\n score_id = \"5\"\n \n # Condition 4 - Not in database\n elif not in_database:\n score_id = \"0\"\n \n # Condition 5 - Catch all\n else:\n score_id = \"-1\"\n \n score = score_table[score_id]\n normalize_score_url__url_score_object.append(\n {\n 'score': score, \n 'score_id': score_id\n }\n )\n normalize_score_url__scores.append(score)\n \n\n",
"warnings": {},
"x": 0,
"y": 506
},
"4": {
"data": {
"advanced": {
"customName": "url result filter",
"customNameId": 0,
"description": "Filters successful url reputation results.",
"join": [],
"note": "Filters successful url reputation results."
},
"conditions": [
{
"comparisons": [
{
"conditionIndex": 0,
"op": "==",
"param": "url_reputation:action_result.status",
"value": "success"
}
],
"conditionIndex": 0,
"customName": "success",
"logic": "and"
}
],
"functionId": 1,
"functionName": "url_result_filter",
"id": "4",
"type": "filter"
},
"errors": {},
"id": "4",
"type": "filter",
"warnings": {},
"x": 60,
"y": 326
},
"5": {
"data": {
"advanced": {
"customName": "format report url",
"customNameId": 0,
"description": "Format a summary table with the information gathered from the playbook.",
"join": [],
"note": "Format a summary table with the information gathered from the playbook."
},
"functionId": 1,
"functionName": "format_report_url",
"id": "5",
"parameters": [
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.parameter.url",
"normalize_score_url:custom_function:scores",
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.data.*.phish_detail_page"
],
"template": "SOAR analyzed URL(s) using PhishTank. The table below shows a summary of the information gathered.\n\n| URL | Normalized Score | Report Link | Source |\n| --- | --- | --- | --- |\n%%\n| `{0}` | {1} | {2} | PhishTank |\n%%",
"type": "format"
},
"errors": {},
"id": "5",
"type": "format",
"warnings": {},
"x": 0,
"y": 684
},
"6": {
"data": {
"advanced": {
"customName": "build url output",
"customNameId": 0,
"description": "Generate an observable dictionary to output into the observables data path.",
"join": [],
"note": "Generate an observable dictionary to output into the observables data path."
},
"functionId": 2,
"functionName": "build_url_output",
"id": "6",
"inputParameters": [
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.parameter.url",
"filtered-data:url_result_filter:condition_1:url_reputation:action_result.data.*.phish_detail_page",
"normalize_score_url:custom_function:url_score_object",
"parse_url:custom_function_result.data"
],
"outputVariables": [
"observable_array"
],
"type": "code"
},
"errors": {},
"id": "6",
"type": "code",
"userCode": "\n # Assign variables\n build_url_output__observable_array = []\n url_list = filtered_result_0_parameter_url\n parsed_url_list = parse_url_data\n detail_page_list = filtered_result_0_data___phish_detail_page\n url_reputation_list = normalize_score_url__url_score_object\n \n for url, detail_page, parsed_url, url_rep in zip(url_list, detail_page_list, parsed_url_list, url_reputation_list):\n observable_object = {\n \"value\": url,\n \"type\": \"url\",\n \"reputation\": {\n \"score_id\": url_rep['score_id'],\n \"score\": url_rep['score'],\n },\n \"attributes\": {\n \"hostname\": parsed_url['hostname'],\n \"scheme\": parsed_url['scheme']\n },\n \"source\": \"PhishTank\",\n \"source_link\": detail_page\n }\n if parsed_url['path']:\n observable_object['attributes']['path'] = parsed_url['path']\n if parsed_url['query']:\n observable_object['attributes']['query'] = parsed_url['query']\n if parsed_url['port']:\n observable_object['attributes']['query'] = parsed_url['query']\n \n build_url_output__observable_array.append(observable_object)\n\n",
"warnings": {},
"x": 0,
"y": 1020
},
"7": {
"data": {
"advanced": {
"customName": "parse url",
"customNameId": 0,
"join": []
},
"customFunction": {
"draftMode": false,
"name": "url_parse",
"repoName": "community"
},
"functionId": 1,
"functionName": "parse_url",
"id": "7",
"selectMore": false,
"type": "utility",
"utilities": {
"url_parse": {
"description": "Separate a URL into its components using urlparse() from the urllib module of Python 3.",
"fields": [
{
"dataTypes": [
"url"
],
"description": "The URL to parse",
"inputType": "item",
"label": "input_url",
"name": "input_url",
"placeholder": "artifact:*.cef.requestUrl",
"renderType": "datapath",
"required": false
}
],
"label": "url_parse",
"name": "url_parse"
}
},
"utilityType": "custom_function",
"values": {
"url_parse": {
"input_url": "filtered-data:url_result_filter:condition_1:url_reputation:action_result.parameter.url"
}
}
},
"errors": {},
"id": "7",
"type": "utility",
"warnings": {},
"x": 0,
"y": 860
}
},
"notes": "Inputs: url\nInteractions: PhishTank\nActions: url reputation\nOutputs: report, observables"
},
"input_spec": [
{
"contains": [
"url"
],
"description": "A URL provided for reputation analysis",
"name": "url"
}
],
"output_spec": [
{
"contains": [],
"datapaths": [
"build_url_output:custom_function:observable_array"
],
"deduplicate": false,
"description": "An array of observable dictionaries with value, type, and reputation.",
"metadata": {},
"name": "observable"
},
{
"contains": [],
"datapaths": [
"format_report_url:formatted_data"
],
"deduplicate": false,
"description": "A formatted report.",
"metadata": {},
"name": "markdown_report"
}
],
"playbook_type": "data",
"python_version": "3",
"schema": "5.0.8",
"version": "5.5.0.108488"
},
"create_time": "2023-01-09T21:06:56.266161+00:00",
"draft_mode": false,
"labels": [
"*"
],
"tags": [
"D3-URA",
"D3-IRA",
"reputation",
"url",
"PhishTank"
]
}