@@ -205,8 +205,10 @@ def generate_ref():
205
205
"**The following trendy words were detected:**\n "
206
206
"{words_list}"
207
207
),
208
- 'severity' : 2 ,
209
- 'tags' : ["Threats Watcher" , "Watcher" , "Buzzword" , "Trendy Words" , "Threat Detection" ]
208
+ 'severity' : 1 ,
209
+ 'tlp' : 1 ,
210
+ 'pap' : 1 ,
211
+ 'tags' : settings .THE_HIVE_TAGS
210
212
},
211
213
'data_leak' : {
212
214
'title' : "New Data Leakage - Alert #{alert_pk} for {keyword_name} keyword" ,
@@ -216,8 +218,10 @@ def generate_ref():
216
218
"*Keyword:* {keyword_name}\n "
217
219
"*Source:* {url}\n "
218
220
),
219
- 'severity' : 3 ,
220
- 'tags' : ["Data Leak" , "Watcher" , "Sensitive Data" , "Leak Detection" ]
221
+ 'severity' : 1 ,
222
+ 'tlp' : 1 ,
223
+ 'pap' : 1 ,
224
+ 'tags' : settings .THE_HIVE_TAGS
221
225
},
222
226
'website_monitoring' : {
223
227
'title' : "Website Monitoring Detected - {alert_type} on {domain_name_sanitized}" ,
@@ -236,8 +240,10 @@ def generate_ref():
236
240
"*• New Mail Server:* {new_mail_A_record_ip}\n "
237
241
"*• Old Mail Server:* {old_mail_A_record_ip}\n "
238
242
),
239
- 'severity' : 2 ,
240
- 'tags' : ["Website Monitoring" , "Watcher" , "Incident" , "Website" , "Domain Name" , "Impersonation" , "Malicious Domain" , "Typosquatting" ]
243
+ 'severity' : 1 ,
244
+ 'tlp' : 1 ,
245
+ 'pap' : 1 ,
246
+ 'tags' : settings .THE_HIVE_TAGS
241
247
},
242
248
'dns_finder' : {
243
249
'title' : "New Twisted DNS found - {dns_domain_name_sanitized}" ,
@@ -249,8 +255,10 @@ def generate_ref():
249
255
"*Corporate DNS:* {alert.dns_twisted.dns_monitored}\n "
250
256
"*Fuzzer:* {alert.dns_twisted.fuzzer}\n "
251
257
),
252
- 'severity' : 3 ,
253
- 'tags' : ["DNS Finder" , "Watcher" , "Twisted DNS" , "Corporate Keywords" , "Corporate DNS Assets" , "Impersonation" , "Malicious Domain" , "Typosquatting" ]
258
+ 'severity' : 1 ,
259
+ 'tlp' : 1 ,
260
+ 'pap' : 1 ,
261
+ 'tags' : settings .THE_HIVE_TAGS
254
262
},
255
263
}
256
264
@@ -306,41 +314,56 @@ def collect_observables(app_name, context_data):
306
314
elif app_name == 'website_monitoring' :
307
315
site = context_data .get ('site' )
308
316
alert_data = context_data .get ('alert_data' , {})
317
+ alert_type = alert_data .get ('type' )
309
318
if site :
310
- observables .append ({"dataType" : "domain" , "data" : site .domain_name })
319
+ domain_tag = f"domain_name:{ site .domain_name } "
320
+ observable = {"dataType" : "domain" , "data" : site .domain_name , "tags" : [domain_tag ]}
321
+ observables .append (observable )
311
322
if alert_data .get ('new_ip' ):
312
- observables .append ({"dataType" : "ip" , "data" : alert_data ['new_ip' ]})
323
+ observable = {"dataType" : "ip" , "data" : alert_data ['new_ip' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:new_ip" ]}
324
+ observables .append (observable )
313
325
if alert_data .get ('old_ip' ):
314
- observables .append ({"dataType" : "ip" , "data" : alert_data ['old_ip' ]})
326
+ observable = {"dataType" : "ip" , "data" : alert_data ['old_ip' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:old_ip" ]}
327
+ observables .append (observable )
315
328
if alert_data .get ('new_ip_second' ):
316
- observables .append ({"dataType" : "ip" , "data" : alert_data ['new_ip_second' ]})
329
+ observable = {"dataType" : "ip" , "data" : alert_data ['new_ip_second' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:new_ip_second" ]}
330
+ observables .append (observable )
317
331
if alert_data .get ('old_ip_second' ):
318
- observables .append ({"dataType" : "ip" , "data" : alert_data ['old_ip_second' ]})
332
+ observable = {"dataType" : "ip" , "data" : alert_data ['old_ip_second' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:old_ip_second" ]}
333
+ observables .append (observable )
319
334
if alert_data .get ('new_MX_records' ):
320
- observables .append ({"dataType" : "other" , "data" : alert_data ['new_MX_records' ]})
335
+ observable = {"dataType" : "other" , "data" : alert_data ['new_MX_records' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:new_MX_records" ]}
336
+ observables .append (observable )
321
337
if alert_data .get ('old_MX_records' ):
322
- observables .append ({"dataType" : "other" , "data" : alert_data ['old_MX_records' ]})
338
+ observable = {"dataType" : "other" , "data" : alert_data ['old_MX_records' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:old_MX_records" ]}
339
+ observables .append (observable )
323
340
if alert_data .get ('new_mail_A_record_ip' ):
324
- observables .append ({"dataType" : "ip" , "data" : alert_data ['new_mail_A_record_ip' ]})
341
+ observable = {"dataType" : "ip" , "data" : alert_data ['new_mail_A_record_ip' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:new_mail_A_record_ip" ]}
342
+ observables .append (observable )
325
343
if alert_data .get ('old_mail_A_record_ip' ):
326
- observables .append ({"dataType" : "ip" , "data" : alert_data ['old_mail_A_record_ip' ]})
344
+ observable = {"dataType" : "ip" , "data" : alert_data ['old_mail_A_record_ip' ], "tags" : [domain_tag , f"type:{ alert_type } " , "details:old_mail_A_record_ip" ]}
345
+ observables .append (observable )
327
346
328
347
elif app_name == 'data_leak' :
329
348
alert = context_data .get ('alert' )
330
349
if alert :
331
- observables .append ({"dataType" : "url" , "data" : alert .url })
332
- observables .append ({"dataType" : "other" , "data" : alert .keyword .name })
350
+ observable = {"dataType" : "url" , "data" : alert .url , "tags" : []}
351
+ if alert .keyword :
352
+ observable ["tags" ].append (f"keyword:{ alert .keyword .name } " )
353
+ observables .append (observable )
333
354
334
355
elif app_name == 'dns_finder' :
335
356
alert = context_data .get ('alert' )
336
357
if alert :
337
- observables .append ({"dataType" : "domain" , "data" : alert .dns_twisted .domain_name })
338
- if alert .dns_twisted .keyword_monitored :
339
- observables .append ({"dataType" : "other" , "data" : alert .dns_twisted .keyword_monitored .name })
340
- if alert .dns_twisted .dns_monitored :
341
- observables .append ({"dataType" : "domain" , "data" : alert .dns_twisted .dns_monitored .domain_name })
358
+ observable = {"dataType" : "domain" , "data" : alert .dns_twisted .domain_name , "tags" : []}
342
359
if alert .dns_twisted .fuzzer :
343
- observables .append ({"dataType" : "other" , "data" : alert .dns_twisted .fuzzer })
360
+ observable ["tags" ].append (f"fuzzer:{ alert .dns_twisted .fuzzer } " )
361
+ if alert .dns_twisted .dns_monitored :
362
+ observable ["tags" ].append (f"corporate_dns:{ alert .dns_twisted .dns_monitored .domain_name } " )
363
+ if alert .dns_twisted .keyword_monitored :
364
+ observable ["tags" ].append (f"corporate_keyword:{ alert .dns_twisted .keyword_monitored .name } " )
365
+
366
+ observables .append (observable )
344
367
345
368
observables = [observable for observable in observables if observable ['data' ] is not None and observable ['data' ] != 'None' ]
346
369
@@ -513,6 +536,8 @@ def send_notification(channel, content_template, subscribers_filter, send_func,
513
536
title = formatted_title ,
514
537
description = content ,
515
538
severity = app_config_thehive ['severity' ],
539
+ tlp = app_config_thehive ['tlp' ],
540
+ pap = app_config_thehive ['pap' ],
516
541
tags = app_config_thehive ['tags' ],
517
542
customFields = app_config_thehive .get ('customFields' ),
518
543
app_name = app_name ,
@@ -527,6 +552,8 @@ def send_notification(channel, content_template, subscribers_filter, send_func,
527
552
title = formatted_title ,
528
553
description = app_config_thehive ['description_template' ].format (** common_data ),
529
554
severity = app_config_thehive ['severity' ],
555
+ tlp = app_config_thehive ['tlp' ],
556
+ pap = app_config_thehive ['pap' ],
530
557
tags = app_config_thehive ['tags' ],
531
558
app_name = app_name ,
532
559
domain_name = None ,
0 commit comments