diff --git a/analyzers/VirusTotal/report/success_short.html b/analyzers/VirusTotal/report/success_short.html index 2fc2d1a33c..924e8224ae 100644 --- a/analyzers/VirusTotal/report/success_short.html +++ b/analyzers/VirusTotal/report/success_short.html @@ -1,11 +1,11 @@ VT: - {{content.positives}}/{{content.total}} ({{content.scan_date}})  - Scans({{content.scans.length}})  - Resolutions({{content.resolutions.length}})  - Url detections({{content.detected_urls.length}})  - files({{content.detected_downloaded_samples.length}})  + {{content.positives}}/{{content.total}} ({{content.scan_date}}) + Scans({{content.scans.length}}) + Resolutions({{content.resolutions.length}}) + Url detections({{content.detected_urls.length}}) + files({{content.detected_downloaded_samples.length}}) diff --git a/ui/app/index.html b/ui/app/index.html index 1360eff69f..212f52cb94 100644 --- a/ui/app/index.html +++ b/ui/app/index.html @@ -24,6 +24,7 @@ + @@ -39,7 +40,8 @@ - + +
@@ -84,6 +86,7 @@ + diff --git a/ui/app/scripts/app.js b/ui/app/scripts/app.js index bf05ebb62f..3b20204eb6 100644 --- a/ui/app/scripts/app.js +++ b/ui/app/scripts/app.js @@ -7,7 +7,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router 'theHiveControllers', 'theHiveServices', 'theHiveFilters', 'theHiveDirectives', 'yaru22.jsonHuman', 'timer', 'angularMoment', 'ngCsv', 'ngTagsInput', 'btford.markdown', 'ngResource', 'ui.codemirror', 'ui-notification', 'angularjs-dropdown-multiselect', 'base64', 'angular-clipboard', - 'LocalStorageModule', 'angular-markdown-editor', 'hc.marked', 'hljs', 'ui.ace' + 'LocalStorageModule', 'angular-markdown-editor', 'hc.marked', 'hljs', 'ui.ace', 'angular-page-loader' ]) .config(function($resourceProvider) { 'use strict'; diff --git a/ui/app/scripts/controllers/admin/AdminReportTemplatesCtrl.js b/ui/app/scripts/controllers/admin/AdminReportTemplatesCtrl.js index 6e6029d4e3..193cb3fa62 100644 --- a/ui/app/scripts/controllers/admin/AdminReportTemplatesCtrl.js +++ b/ui/app/scripts/controllers/admin/AdminReportTemplatesCtrl.js @@ -24,9 +24,7 @@ return $q.resolve(self.analyzers); }).then(function (analyzersMap) { _.each(self.templates, function (tpl) { - _.each(tpl.analyzers, function (analyzerId) { - analyzersMap[analyzerId][tpl.flavor + 'Report'] = tpl; - }); + analyzersMap[tpl.analyzers][tpl.flavor + 'Report'] = tpl; }); console.log(self.analyzers); @@ -70,7 +68,7 @@ }; this.formData = _.pick(reportTemplate, 'id', 'flavor', 'content'); - this.formData.analyzers = [this.analyzer.id]; + this.formData.analyzers = this.analyzer.id; this.cancel = function () { $modalInstance.dismiss(); diff --git a/ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js b/ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js index b45514d3f7..e330c89331 100644 --- a/ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js +++ b/ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js @@ -6,7 +6,7 @@ observableName = 'observable-' + observableId; $scope.caseId = $stateParams.caseId; - $scope.report = {}; + $scope.report = null; $scope.analyzers = {}; $scope.analyzerJobs = {}; $scope.jobs = {}; @@ -60,12 +60,10 @@ // Get analyzers available for the observable's datatype AnalyzerSrv.forDataType(artifact.dataType) - .then(function (analyzers) { + .then(function (analyzers) { return $scope.analyzers = analyzers; }) .then(function (analyzers) { - console.log(analyzers); - $scope.jobs = CortexSrv.list($scope.caseId, observableId, $scope.onJobsChange); }); @@ -85,19 +83,24 @@ $scope.analyzerJobs[job.analyzerId] = [job]; AnalyzerSrv.get(job.analyzerId) - .then(function (data) { - $scope.analyzers[data.analyzerId] = { - active: false, - showRows: false - }; - }, - function (response) { - AlertSrv.error('artifactDetails', response.data, response.status); - }); + .finally(function (data) { + $scope.analyzers[data.analyzerId] = { + active: false, + showRows: false + }; + }); } }); }; + $scope.showReport = function (job) { + $scope.report = { + template: job.analyzerId, + content: job.report, + status: job.status + } + } + $scope.similarArtifacts = CaseArtifactSrv.api().similar({ 'artifactId': observableId }); diff --git a/ui/app/scripts/directives/report.js b/ui/app/scripts/directives/report.js index 85ce4f313a..919cec15a2 100644 --- a/ui/app/scripts/directives/report.js +++ b/ui/app/scripts/directives/report.js @@ -1,39 +1,32 @@ -(function() { +(function () { 'use strict'; angular.module('theHiveDirectives') - .directive('report', function($templateRequest, $compile) { + .directive('report', function ($templateRequest, $q, $compile) { function updateReport(a, b, scope) { - console.log('update report ' + scope.name); - if (!angular.isDefined(scope.content) || !angular.isDefined(scope.name)) { - console.log('no data, don\'t show anything'); scope.element.html(''); return; } // find report template - //$templateRequest('/api/analyzer/' + scope.name + '/report/' + scope.status.toLowerCase() + '_' + scope.flavor, true) $templateRequest('/api/connector/cortex/report/template/content/' + scope.name + '/' + scope.flavor, true) - .then(function(tmpl) { - scope.element.html($compile(tmpl)(scope)); - }, function(response) { - if(response.status === 404) { - console.log('Use default template'); - return $templateRequest('/views/reports/' + scope.flavor + '.html', true) - } else { - scope.element.html('Analyzer not found !'); - } - }).then(null, function(tmpl) { + .then(function (tmpl) { scope.element.html($compile(tmpl)(scope)); - }); + }, function (response) { + $templateRequest('/views/reports/' + scope.flavor + '.html', true) + .then(function (tmpl) { + scope.element.html($compile(tmpl)(scope)); + }); + }) } return { - 'restrict': 'E', - 'link': function(scope, element) { + restrict: 'E', + replace: true, + link: function (scope, element) { scope.element = element; scope.$watchGroup(['name', 'content', 'status'], updateReport); }, - 'scope': { + scope: { 'name': '=', 'artifact': '=', 'flavor': '@', diff --git a/ui/app/scripts/services/CortexSrv.js b/ui/app/scripts/services/CortexSrv.js index 5fa2838ee7..3377e82b74 100644 --- a/ui/app/scripts/services/CortexSrv.js +++ b/ui/app/scripts/services/CortexSrv.js @@ -12,7 +12,7 @@ loadAll: false, pageSize: 200, onUpdate: callback || angular.noop, - streamObjectType: 'job', + streamObjectType: 'case_artifact_job', filter: { _parent: { _type: 'case_artifact', diff --git a/ui/app/styles/main.css b/ui/app/styles/main.css index f0cb32e78f..d28d079b77 100644 --- a/ui/app/styles/main.css +++ b/ui/app/styles/main.css @@ -356,6 +356,21 @@ td.vmiddle { vertical-align: middle !important; } +.observable-report pre { + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 1.42857143; + word-break: break-all; + word-wrap: break-word; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 4px; + background: #333; + color: #fff; +} + @-moz-keyframes spin { from { -moz-transform: rotate(0deg); diff --git a/ui/app/views/app.html b/ui/app/views/app.html index abc6a12275..db45f3240d 100644 --- a/ui/app/views/app.html +++ b/ui/app/views/app.html @@ -177,7 +177,7 @@ -
+
diff --git a/ui/app/views/partials/admin/report-template-dialog.html b/ui/app/views/partials/admin/report-template-dialog.html index e0283a0f80..31fe140775 100644 --- a/ui/app/views/partials/admin/report-template-dialog.html +++ b/ui/app/views/partials/admin/report-template-dialog.html @@ -17,7 +17,7 @@