mirror of https://github.com/MISP/MISP
chg: [periodic_notification] Generate tag trendings for mitre ATTACK if none are provided
parent
a9e5b52b9d
commit
a0612d05aa
|
@ -2,6 +2,9 @@
|
|||
class TrendingTool
|
||||
{
|
||||
private $eventModel;
|
||||
public const defaultTagNamespaceForTrends = [
|
||||
'misp-galaxy:mitre-attack-pattern',
|
||||
];
|
||||
|
||||
public function __construct($eventModel)
|
||||
{
|
||||
|
@ -10,6 +13,7 @@ class TrendingTool
|
|||
|
||||
public function getTrendsForTags(array $events, int $baseDayRange, int $rollingWindows=3, $tagFilterPrefixes=null): array
|
||||
{
|
||||
$tagFilterPrefixes = $tagFilterPrefixes ?: self::defaultTagNamespaceForTrends;
|
||||
$clusteredTags = $this->__clusterTagsForRollingWindow($events, $baseDayRange, $rollingWindows, $tagFilterPrefixes);
|
||||
$trendAnalysis = $this->__computeTrendAnalysis($clusteredTags);
|
||||
return [
|
||||
|
|
|
@ -1787,9 +1787,10 @@ class User extends AppModel
|
|||
|
||||
$rollingWindows = 2;
|
||||
$trendAnalysis = $this->Event->getTrendsForTagsFromEvents($events, $this->__periodToDays($period), $rollingWindows, $periodicSettings['trending_for_tags']);
|
||||
$tagFilterPrefixes = $periodicSettings['trending_for_tags'] ?: array_keys($trendAnalysis['all_tags']);
|
||||
$trendData = [
|
||||
'trendAnalysis' => $trendAnalysis,
|
||||
'tagFilterPrefixes' => $periodicSettings['trending_for_tags'],
|
||||
'tagFilterPrefixes' => $tagFilterPrefixes,
|
||||
];
|
||||
$trending_summary = $this->__renderTrendingSummary($trendData);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ echo $this->element('genericElements/Form/genericForm', [
|
|||
'type' => 'tagsPicker',
|
||||
'placeholder' => '["tlp:red"]',
|
||||
],
|
||||
sprintf('<h4>%s</h4>', __('Notification filters')),
|
||||
sprintf('<h4>%s</h4>', __('Report settings')),
|
||||
[
|
||||
'field' => 'periodic_settings.trending_for_tags',
|
||||
'label' => __('Generate trends for tag namespaces'),
|
||||
|
|
Loading…
Reference in New Issue