Skip to content

Commit

Permalink
#1285 Update the observable import from analyzer reports and take int…
Browse files Browse the repository at this point in the history
…o account the tags and message of the observable
  • Loading branch information
nadouani committed Apr 24, 2020
1 parent eb4614e commit d52840e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
55 changes: 41 additions & 14 deletions ui/app/scripts/directives/report-observables.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,49 @@
return item.selected === true;
}), 'dataType');

var message = [
'### Discovered from:',
'- Observable: **['+ $scope.origin.dataType + '] - ' + $filter('fang')($scope.origin.data) + '**',
'- Analyzer: **'+ $scope.analyzer + '**'
].join('\n');


_.each(toImport, function(list, key) {
var params = {
dataType: key,
single: list.length === 1,
ioc: false,
sighted: false,
tlp: 2,
message: message,
tags: [{text: 'src:' + $scope.analyzer}]
};
var message = [
'### Discovered from:',
'- Observable: **['+ $scope.origin.dataType + '] - ' + $filter('fang')($scope.origin.data) + '**',
'- Analyzer: **'+ $scope.analyzer + '**'
];

var params;

if(list.length === 1) {
var obs = list[0];

if(obs.message) {
message.push('- Message: ' + obs.message);
}

params = {
dataType: key,
single: true,
ioc: false,
sighted: false,
tlp: obs.tlp || 2,
message: message.join('\n'),
tags: [{text: 'src:' + $scope.analyzer}].concat(_.map(_.uniq(obs.tags), function(i) {
return {text: i};
}))
};
} else {
params = {
dataType: key,
single: list.length === 1,
ioc: false,
sighted: false,
tlp: 2,
message: message.join('\n'),
tags: [{text: 'src:' + $scope.analyzer}]
};
}




if(key === 'file') {
params.attachment = _.pluck(list, 'attachment');
Expand Down
4 changes: 3 additions & 1 deletion ui/app/views/directives/report-observables.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width:20px;"></th>
<th style="width:10px;"></th>
<th style="width:10px;"></th>
<th style="width:20px;"></th>
<th style="width:150px;">Type</th>
<th>Data</th>
Expand All @@ -38,6 +39,7 @@
offset: (pagination.currentPage-1)*pagination.pageSize |
limitTo: pagination.pageSize ">
<td><input type="checkbox" ng-model="observable.selected" ng-change="selectObservable(observable)" ng-disabled="observable.id"></td>
<td><tlp value="observable.tlp"></tlp></td>
<td>
<span uib-tooltip="Observable already id" tooltip-popup-delay="500" tooltip-placement="bottom" ng-if="observable.id" class="glyphicon glyphicon-eye-open"></span>
</td>
Expand Down

0 comments on commit d52840e

Please sign in to comment.