Skip to content

Commit

Permalink
#1633 Add tlp to observable flags component and use it in report obse…
Browse files Browse the repository at this point in the history
…rvables import section
  • Loading branch information
nadouani committed Nov 12, 2020
1 parent a21c32e commit c7eb6c4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
inline: '<',
hideSimilarity: '<',
hideSeen: '<',
hideTlp: '<',
onFilter: '&'
}
});
Expand Down
4 changes: 3 additions & 1 deletion frontend/app/scripts/directives/report-observables.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
$scope.selectAll = function() {
var type = $scope.pagination.filter;
_.each(type === '' ? $scope.observables : $scope.groups[type], function(item) {
if(!item.id && !item.selected) {
//if(!item.id && !item.selected) {
if(!item.stats.observableId && !item.selected) {
item.selected = true;
$scope.selected++;
}
Expand Down Expand Up @@ -80,6 +81,7 @@
single: list.length === 1,
ioc: false,
sighted: false,
ignoreSimilarity: false,
tlp: 2,
message: message,
tags: [{text: 'src:' + $scope.analyzer}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width: 10px;" class="p-0"></th>
<th style="width:50px;"></th>
<th style="width:50px;">Flags</th>
<th style="width:100px;">Type</th>
<th>Data</th>
<th style="width: 120px">Date Added</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="observable in $cmp.list.values" class="clickable">
<td class="p-0 bg-tlp-{{observable.tlp}} clickable" ng-click="$cmp.filterBy('tlp', observable.tlp)"></td>
<td class="nowrap">
<observable-flags observable="observable" inline="true"></observable-flags>
<observable-flags observable="observable" inline="true" on-filter="$cmp.filterBy(fieldName, value)"></observable-flags>
</td>
<td>
<a href ng-click="$cmp.filterBy('dataType', observable.dataType)">{{observable.dataType}}</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<div class="observable-flags" ng-class="{'inline': $ctrl.inline}">
<!-- TLP -->
<div ng-if="!!!$ctrl.hideTlp" class="observable-tlp clickable" uib-tooltip="{{ {
0: 'TLP:WHITE',
1: 'TLP:GREEN',
2: 'TLP:AMBER',
3: 'TLP:RED',
}[$ctrl.observable.tlp] }}" tooltip-popup-delay="500" tooltip-placement="tlp"
ng-click="$ctrl.filterBy('tlp', $ctrl.observable.tlp)">
<i class="fa fa-circle" ng-class="{
0: 'text-tlp-default fa-circle-o',
1: 'text-tlp-green',
2: 'text-tlp-amber',
3: 'text-tlp-red',
}[$ctrl.observable.tlp]"></i>
</div>

<!-- IOC flag -->
<div ng-if="!!$ctrl.observable.ioc" class="observable-ioc clickable" uib-tooltip="is an IOC" tooltip-popup-delay="500" tooltip-placement="bottom"
ng-click="$ctrl.filterBy('ioc', true)">
Expand Down
14 changes: 10 additions & 4 deletions frontend/app/views/directives/report-observables.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width:20px;"></th>
<th style="width:20px;"></th>
<th style="width:10px;"></th>
<th style="width:80px;">Flags</th>
<th style="width:80px;">Imported</th>
<th style="width:150px;">Type</th>
<th>Data</th>
<th style="width:80px;"></th>
Expand All @@ -37,9 +38,14 @@
<tr ng-repeat="observable in pagination.data | orderBy:'id':true |
offset: (pagination.currentPage-1)*pagination.pageSize |
limitTo: pagination.pageSize ">
<td><input type="checkbox" ng-model="observable.selected" ng-change="selectObservable(observable)" ng-disabled="!!observable.stats.observableId"></td>
<td>
<span uib-tooltip="Observable already imported" tooltip-popup-delay="500" tooltip-placement="right" ng-if="!!observable.stats.observableId" class="glyphicon glyphicon-eye-open"></span>
<input type="checkbox" ng-model="observable.selected" ng-change="selectObservable(observable)" ng-disabled="!!observable.stats.observableId">
</td>
<td>
<observable-flags observable="observable" inline="true" hide-seen="true" hide-similarity="true"></observable-flags>
</td>
<td align="center">
<span uib-tooltip="Observable already imported" tooltip-popup-delay="500" tooltip-placement="right" ng-if="!!observable.stats.observableId" class="fa fa-check"></span>
</td>
<td>{{observable.dataType}}</td>
<td class="wrap">
Expand Down
13 changes: 3 additions & 10 deletions frontend/app/views/partials/observables/details/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,15 @@ <h4 class="vpad10 text-primary">Links</h4>
<table class="table table-striped">
<thead>
<tr>
<th width="10">IOC</th>
<th>TLP</th>
<th width="80">Flags</th>
<th>Case</th>
<th>Date added</th>
<th width="120">Date added</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="a in similarArtifacts | limitTo:similarArtifactsLimit" style="cursor: pointer;" ng-click="openArtifact(a)" uib-tooltip="{{a.message}}" tooltip-popup-delay="500" tooltip-placement="bottom">
<td align="center">
<span class="clickable fa"
ng-class="{true: 'fa-star', false: 'fa-star-o'}[a.ioc]"
tooltip-popup-delay="500"
tooltip-placement="bottom"></span>
</td>
<td>
<tlp value="a.tlp"></tlp>
<observable-flags observable="a" inline="true" hide-seen="true" hide-similarity="true"></observable-flags>
</td>
<td>
<!-- [{{a.dataType}}]: {{a.data || a.attachment.name}}<br> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h4>
<input type="checkbox" ng-model="artifact.selected" ng-change="selectArtifact(artifact)" if-permission="manageObservable" allowed="{{artifact.extraData.permissions.join(',')}}">
</td>
<td>
<observable-flags observable="artifact" on-filter="addFilterValue(fieldName, value)"></observable-flags>
<observable-flags observable="artifact" on-filter="addFilterValue(fieldName, value)" hide-tlp="true"></observable-flags>
</td>
<td>
<a href ng-click="addFilterValue('dataType', artifact.dataType)"><span ng-bind="artifact.dataType"></span></a>
Expand Down

0 comments on commit c7eb6c4

Please sign in to comment.