Skip to content

Commit

Permalink
Started working on Case Reporting TheHive-Project#305
Browse files Browse the repository at this point in the history
  • Loading branch information
tyliec committed Jun 19, 2018
1 parent 3369907 commit be0856e
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 4 deletions.
11 changes: 11 additions & 0 deletions rebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

rm -rf /opt/thehive/

~/TheHive/bin/activator clean stage

cp -r ~/TheHive/target/universal/stage /opt/thehive

chown -R thehive /opt/thehive

service thehive restart
2 changes: 1 addition & 1 deletion ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
<script src="bower_components/underscore.string/dist/underscore.string.js"></script>
<script src="bower_components/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js"></script>
<script src="bower_components/angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module.js"></script>
<script src="bower_components/file-saver/FileSaver.js"></script>
<!-- endbower -->

<script type="text/javascript" src="bower_components/ace-builds/src-min-noconflict/ace.js"></script>
Expand Down Expand Up @@ -163,6 +162,7 @@
<script src="scripts/controllers/case/CaseObservablesExportCtrl.js"></script>
<script src="scripts/controllers/case/CaseObservablesItemCtrl.js"></script>
<script src="scripts/controllers/case/CaseReopenModalCtrl.js"></script>
<script src="scripts/controllers/case/CaseReportCtrl.js"></script>
<script src="scripts/controllers/case/CaseStatsCtrl.js"></script>
<script src="scripts/controllers/case/CaseTasksCtrl.js"></script>
<script src="scripts/controllers/case/CaseTasksItemCtrl.js"></script>
Expand Down
56 changes: 55 additions & 1 deletion ui/app/scripts/controllers/case/CaseMainCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers').controller('CaseMainCtrl',
function($scope, $rootScope, $state, $stateParams, $q, $uibModal, CaseTabsSrv, CaseSrv, MetricsCacheSrv, UserInfoSrv, MispSrv, StreamSrv, StreamStatSrv, NotificationSrv, UtilsSrv, CaseResolutionStatus, CaseImpactStatus, caze) {
function($scope, $rootScope, $state, $stateParams, $q, $uibModal, $http, CaseTabsSrv, CaseSrv, MetricsCacheSrv, UserInfoSrv, MispSrv, StreamSrv, StreamStatSrv, NotificationSrv, UtilsSrv, CaseResolutionStatus, CaseImpactStatus, caze) {
$scope.CaseResolutionStatus = CaseResolutionStatus;
$scope.CaseImpactStatus = CaseImpactStatus;

Expand Down Expand Up @@ -216,6 +216,60 @@
});
};

$scope.caseReport = function() {
$uibModal.open({
templateUrl: 'views/partials/case/case.report.html',
controller: 'CaseReportCtrl',
controllerAs: 'report',
size: '',
resolve: {
caze: function() {
return $scope.caze;
},
tasks: function() {
var defer = $q.defer();
$http.post('./api/case/task/_search', {
query: {
"_parent": {
"_type": "case",
"_query": {
"_id": $scope.caze.id
}
}
},
range: "all"
})
.then(function(response) {
defer.resolve(response.data);
}, function(err) {
defer.reject(err);
})
return defer.promise;
},
observables: function() {
var defer = $q.defer();
$http.post('./api/case/artifact/_search', {
query: {
"_parent": {
"_type": "case",
"_query": {
"_id": $scope.caze.id
}
}
},
range: "all"
})
.then(function(response) {
defer.resolve(response.data);
}, function (err) {
defer.reject(err);
})
return defer.promise;
}
}
});
};

$scope.mergeCase = function() {
$uibModal.open({
templateUrl: 'views/partials/case/case.merge.html',
Expand Down
27 changes: 27 additions & 0 deletions ui/app/scripts/controllers/case/CaseReportCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(function() {
'use strict';
angular.module('theHiveControllers')
.controller('CaseReportCtrl', CaseReportCtrl);

function CaseReportCtrl($uibModalInstance, caze, tasks, observables) {
var self = this;

this.caze = caze;
console.log("CASE");
console.log(caze);
this.tasks = tasks;
console.log("TASKS");
console.log(tasks);
this.observables = observables;
console.log("OBSERVABLES");
console.log(observables);

this.download = function() {
$uibModalInstance.close();
};

this.cancel = function() {
$uibModalInstance.dismiss();
};
}
})();
7 changes: 7 additions & 0 deletions ui/app/views/partials/case/case.panelinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ <h3 class="box-title">
</a>
</span>

<span class="ml-xs pull-right">
<a href ng-click="caseReport()" class="text-primary noline" uib-tooltip="Case Report">
<i class="text-primary fa fa-book"></i>
Report
</a>
</span>

</div>
</div>

Expand Down
80 changes: 80 additions & 0 deletions ui/app/views/partials/case/case.report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<div class="modal-header bg-primary">
<h3 class="modal-titlpe">Case Report</h3>
</div>
<div class="modal-body">
<div class="container">
<h1 class="jumbotron-heading">Case #{{report.caze.caseId}}: {{ report.caze.title }}</h1>
<div class="row">
<div class="col-sm">
<span>
<i class="glyphicon glyphicon-user"></i>
{{ report.caze.owner }}
</span>
</div>
<div class="col-sm">
<span>
<i class="glyphicon glyphicon-adjust"></i>
{{ report.caze.status }}
</span>
</div>
<div class="col-sm">
<span>
<i class="glyphicon glyphicon-asterisk"></i>
{{ report.caze.severity }}
</span>
</div>
<div class="col-sm">
<span>
<i class="glyphicon glyphicon-warning-sign"></i>
{{ report.caze.tlp }}
</span>
</div>
<div ng-if="report.caze.flag" class="col-sm">
<span>
<i class="glyphicon glyphicon-flag"></i>
</span>
</div>
</div>

<div>
<h3>Description</h3>
<p>{{ report.caze.description }}</p>
</div>

<div>
<h3>Audit Trail</h3>
<p>Created By: {{ report.caze.createdBy }}</p>
<p>Created On: {{ report.caze.createdAt }}</p>
<p>Assigned To: {{ report.caze.owner }}</p>
<p>Last Updated: {{ report.caze.updatedAt }}</p>
<p>Last Updated By: {{ report.caze.updatedBy}}</p>
<p ng-if="report.caze.endDate">Closed On: {{ report.caze.endDate }}</p>
</div>
</div>

<div class="container">
<h1 class="jumbotron-heading">Tasks</h1>
<p>Tasks: {{ report.tasks.length }}</p>
<div ng-repeat="task in report.tasks">
<p>Title: {{ task.title }}</p>
<p>Author: {{ task.createdBy }}</p>
<p>Status: {{ task.status }}</p>
</div>
<h3>Details</h3>
<h3>Logs</h3>
<h3>Attachments</h3>
<h3>Audit Trail</h3>
</div>

<div class="container">
<h1 class="jumbotron-heading">Observables</h1>
<h3>Details</h3>
<h3>Report Findings</h3>
<h3>Audit Trail</h3>
</div>

</div>
<div class="modal-footer text-left">
<button class="btn btn-default" ng-click="report.cancel()">Cancel</button>
<button class="btn btn-primary pull-right" ng-click="report.download()">Download</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<h3 class="pv-xxs pr-xxs text-primary">
Analysis
<span class="pull-right" ng-if="analysisEnabled">
<small><a href class="text-primary" ng-click="runAll()">Run all</a></small>
<small><a href class="text-primary" ng-click="runAll()">Run alls</a></small>
</span>
<span class="pull-right" ng-if="analysisEnabled">
<small><a href class="text-primary" ng-click="generateReport()">Generate Report</a></small>
</span>
</h3>
<table class="table table-striped">
Expand Down
1 change: 0 additions & 1 deletion ui/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module.exports = function(config) {
'bower_components/underscore.string/dist/underscore.string.js',
'bower_components/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js',
'bower_components/angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module.js',
'bower_components/file-saver/FileSaver.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
"bower_components/cryptojslib/components/core-min.js",
Expand Down

0 comments on commit be0856e

Please sign in to comment.