From b6476cc3164a86df6a9f942a9a9f773668876d02 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Wed, 4 Apr 2018 17:15:26 +0200 Subject: [PATCH 01/11] #82 Display invalid analyzers an allow removing them --- .../components/analyzers-list.controller.js | 3 +++ .../components/analyzers-list.html | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js b/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js index 2f4301b2f..74c8d813a 100644 --- a/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js @@ -33,6 +33,9 @@ export default class OrganizationAnalyzersController { $onInit() { this.activeAnalyzers = _.keyBy(this.analyzers, 'analyzerDefinitionId'); this.definitionsIds = _.keys(this.analyzerDefinitions).sort(); + this.invalidAnalyzers = _.filter(this.analyzers, a => + _.isEmpty(a.dataTypeList) + ); } openModal(mode, definition, analyzer) { diff --git a/www/src/app/pages/admin/organizations/components/analyzers-list.html b/www/src/app/pages/admin/organizations/components/analyzers-list.html index 1bc27f577..4747c314a 100644 --- a/www/src/app/pages/admin/organizations/components/analyzers-list.html +++ b/www/src/app/pages/admin/organizations/components/analyzers-list.html @@ -1,4 +1,27 @@
+ +
+
+

You have {{$ctrl.invalidAnalyzers.length}} invalid

+

Invalid analyzers have no definition and cannot be run on any observable. You have to remove them.

+
+
+
+
+
+

+ {{a.name}} +

+
+ +
+
+
+
+

Available analyzers ({{$ctrl.definitionsIds.length || 0}}) Refresh analyzers

From 0b4d7ec66fcd5bc01fbc335de81551f1f76b712a Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Thu, 5 Apr 2018 14:07:13 +0200 Subject: [PATCH 02/11] #80 Add observable auto extract option in analyzer dialog --- .../components/analyzer-config-form.html | 32 +++++++++++++------ .../components/analyzer.edit.controller.js | 4 ++- .../components/config-list.controller.js | 12 +++++-- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/www/src/app/pages/admin/organizations/components/analyzer-config-form.html b/www/src/app/pages/admin/organizations/components/analyzer-config-form.html index 20a2a26c8..2640cd8f7 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer-config-form.html +++ b/www/src/app/pages/admin/organizations/components/analyzer-config-form.html @@ -30,6 +30,20 @@

Options

+
+ +
+ +
+
+ +
+
+

Define the maximum number of requests and the associated unit if applicable.

+
+
@@ -43,17 +57,15 @@

Options

- -
- + +
+
+ + +
-
- -
-

Define the maximum number of requests and the associated unit if applicable.

-
+

Set to True to enable automatic observables extraction from analysis reports

+
\ No newline at end of file diff --git a/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js b/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js index 234098147..2b33b2ecc 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js @@ -49,7 +49,9 @@ export default class AnalyzerEditController { _.forEach(globalConfig, cnf => { if (analyzer.configuration[cnf] === undefined) { analyzer.configuration[cnf] = - this.configuration.config[cnf] || undefined; + this.configuration.config[cnf] !== undefined + ? this.configuration.config[cnf] + : undefined; } }); diff --git a/www/src/app/pages/admin/organizations/components/config-list.controller.js b/www/src/app/pages/admin/organizations/components/config-list.controller.js index 018a49852..6f0e2297e 100644 --- a/www/src/app/pages/admin/organizations/components/config-list.controller.js +++ b/www/src/app/pages/admin/organizations/components/config-list.controller.js @@ -26,12 +26,18 @@ export default class OrganizationConfigsController { size: 'lg', resolve: { configuration: () => { + let defaultValues = { + string: null, + number: 0, + boolean: true + }; let conf = angular.copy(config); _.forEach(conf.configurationItems, item => { - conf.config[item.name] = conf.config[item.name] - ? conf.config[item.name] - : item.defaultValue || (item.multi ? [undefined] : undefined); + conf.config[item.name] = + conf.config[item.name] !== undefined + ? conf.config[item.name] + : item.defaultValue || (item.multi ? [undefined] : undefined); }); return conf; From c8327147895074085eea41e96fc730b031e5a6f4 Mon Sep 17 00:00:00 2001 From: To-om Date: Thu, 5 Apr 2018 15:31:43 +0200 Subject: [PATCH 03/11] #75 Fix analyzer json format when definition is missing --- app/org/thp/cortex/controllers/AnalyzerCtrl.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/org/thp/cortex/controllers/AnalyzerCtrl.scala b/app/org/thp/cortex/controllers/AnalyzerCtrl.scala index 297397bf5..adf802682 100644 --- a/app/org/thp/cortex/controllers/AnalyzerCtrl.scala +++ b/app/org/thp/cortex/controllers/AnalyzerCtrl.scala @@ -46,12 +46,12 @@ class AnalyzerCtrl @Inject() ( } private val emptyAnalyzerDefinitionJson = Json.obj( - "version" -> JsNull, - "description" -> JsNull, + "version" -> "0.0", + "description" -> "unknown", "dataTypeList" -> Nil, - "author" -> JsNull, - "url" -> JsNull, - "license" -> JsNull) + "author" -> "unknown", + "url" -> "unknown", + "license" -> "unknown") private def analyzerJson(analyzer: Analyzer, analyzerDefinition: Option[AnalyzerDefinition]) = { analyzer.toJson ++ analyzerDefinition.fold(emptyAnalyzerDefinitionJson) { ad ⇒ From 2bc9adccc7f8771b59d2179f08c92f41574a2eef Mon Sep 17 00:00:00 2001 From: To-om Date: Thu, 5 Apr 2018 15:33:26 +0200 Subject: [PATCH 04/11] Update deprecated configuration item in docker entrypoint --- package/docker/entrypoint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/docker/entrypoint b/package/docker/entrypoint index 23b430e36..59e97e1ff 100755 --- a/package/docker/entrypoint +++ b/package/docker/entrypoint @@ -48,7 +48,7 @@ then SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) fi echo Using secret: $SECRET - echo play.crypto.secret=\"$SECRET\" >> $CONFIG_FILE + echo play.http.secret.key=\"$SECRET\" >> $CONFIG_FILE fi if test $CONFIG_ES = 1 From abf26e29eb9231bf6cab29c2bb7ba1316286c03a Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Thu, 5 Apr 2018 16:26:19 +0200 Subject: [PATCH 05/11] #83 Fix refresh analyzers button --- .../organizations/components/analyzers-list.controller.js | 6 +++--- www/src/app/pages/analyzers/analyzers.service.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js b/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js index 74c8d813a..3c41e9d06 100644 --- a/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js @@ -157,13 +157,13 @@ export default class OrganizationAnalyzersController { refreshAnalyzers() { this.AnalyzerService.scan() - .then(() => this.AnalyzerService.definitions()) + .then(() => this.AnalyzerService.definitions(true)) .then(defintions => { this.analyzerDefinitions = defintions; - this.$onInit(); + this.reload(); this.NotificationService.success('Analyzer definitions refreshed.'); }) - .catch(err => + .catch(() => this.NotificationService.error( 'Failed to refresh analyzer definitions.' ) diff --git a/www/src/app/pages/analyzers/analyzers.service.js b/www/src/app/pages/analyzers/analyzers.service.js index 04afd3bbd..86c827bc8 100644 --- a/www/src/app/pages/analyzers/analyzers.service.js +++ b/www/src/app/pages/analyzers/analyzers.service.js @@ -23,10 +23,10 @@ export default class AnalyzerService { return this.dataTypes; } - definitions() { + definitions(force) { let defered = this.$q.defer(); - if (this.analyzerDefinitions === null) { + if (force || this.analyzerDefinitions === null) { this.$http.get('./api/analyzerdefinition').then( response => { this.analyzerDefinitions = _.keyBy(response.data, 'id'); From df80aae060733d994fa5b7960f2512710dd3a098 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Fri, 6 Apr 2018 11:30:16 +0200 Subject: [PATCH 06/11] #81 Add Apply defaults buttons to analyzer config dialog --- .../analyzer-config-form.controller.js | 20 ++++++- .../components/analyzer-config-form.html | 50 +++++++++++------ .../components/analyzer.edit.controller.js | 4 ++ .../components/analyzer.edit.modal.html | 6 +- .../components/analyzers-list.controller.js | 56 ++++++++++--------- .../organizations/organizations.module.js | 5 +- .../app/pages/analyzers/analyzers.service.js | 15 +++++ 7 files changed, 110 insertions(+), 46 deletions(-) diff --git a/www/src/app/pages/admin/organizations/components/analyzer-config-form.controller.js b/www/src/app/pages/admin/organizations/components/analyzer-config-form.controller.js index 995368b92..445f71ac5 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer-config-form.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzer-config-form.controller.js @@ -1,10 +1,28 @@ 'use strict'; +import _ from 'lodash/core'; + export default class AnalyzerConfigFormController { - constructor(Tlps) { + constructor($log, Tlps, AnalyzerService) { 'ngInject'; + this.AnalyzerService = AnalyzerService; this.Tlps = Tlps; this.rateUnits = ['Day', 'Month']; } + + applyConfig(config) { + _.forEach( + _.keys(config), + k => (this.analyzer.configuration[k] = config[k]) + ); + } + + applyGlobalConfig() { + this.applyConfig(this.globalConfig.config); + } + + applyBaseConfig() { + this.applyConfig(this.baseConfig.config); + } } diff --git a/www/src/app/pages/admin/organizations/components/analyzer-config-form.html b/www/src/app/pages/admin/organizations/components/analyzer-config-form.html index 2640cd8f7..ec89c439a 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer-config-form.html +++ b/www/src/app/pages/admin/organizations/components/analyzer-config-form.html @@ -10,12 +10,28 @@

Base details

-

Configuration

+

+ Configuration + +

-

Options

+

+ Options + +

@@ -30,20 +46,6 @@

Options

-
- -
- -
-
- -
-
-

Define the maximum number of requests and the associated unit if applicable.

-
-
@@ -65,7 +67,21 @@

Options

-

Set to True to enable automatic observables extraction from analysis reports

+

Set to True to enable automatic observables extraction from analysis reports.

+
+ +
+ +
+
+
+ +
+
+

Define the maximum number of requests and the associated unit if applicable.

+
\ No newline at end of file diff --git a/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js b/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js index 2b33b2ecc..060c97043 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js @@ -7,6 +7,8 @@ export default class AnalyzerEditController { $log, $uibModalInstance, definition, + globalConfig, + baseConfig, configuration, analyzer, mode @@ -17,6 +19,8 @@ export default class AnalyzerEditController { this.$uibModalInstance = $uibModalInstance; this.mode = mode; this.definition = definition; + this.globalConfig = globalConfig; + this.baseConfig = baseConfig; this.configuration = configuration; this.analyzer = analyzer; } diff --git a/www/src/app/pages/admin/organizations/components/analyzer.edit.modal.html b/www/src/app/pages/admin/organizations/components/analyzer.edit.modal.html index baa3277b4..c65f05f27 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer.edit.modal.html +++ b/www/src/app/pages/admin/organizations/components/analyzer.edit.modal.html @@ -3,7 +3,11 @@ \ No newline at end of file diff --git a/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js b/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js index 060c97043..c8f0f7bbf 100644 --- a/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzer.edit.controller.js @@ -31,7 +31,8 @@ export default class AnalyzerEditController { name: this.definition.id, configuration: {}, rate: undefined, - rateUnit: undefined + rateUnit: undefined, + jobCache: null }; _.forEach(this.definition.configurationItems, item => { diff --git a/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js b/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js index 79fd9de26..1a2e0d44e 100644 --- a/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js +++ b/www/src/app/pages/admin/organizations/components/analyzers-list.controller.js @@ -96,7 +96,14 @@ export default class OrganizationAnalyzersController { } else { return this.OrganizationService.updateAnalyzer( analyzer.id, - _.pick(response, 'configuration', 'rate', 'rateUnit', 'name') + _.pick( + response, + 'configuration', + 'rate', + 'rateUnit', + 'name', + 'jobCache' + ) ); } }) From 34be620be4f3f5572f33cc4019404d56ef2b7687 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Mon, 9 Apr 2018 16:12:09 +0200 Subject: [PATCH 11/11] Bump bersion and update change log --- CHANGELOG.md | 25 ++++++++++++++++++++++--- version.sbt | 2 +- www/package.json | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e508f525..43969d449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,32 @@ # Change Log -## [2.0.2](https://github.com/TheHive-Project/Cortex/tree/2.02) +## [2.0.3](https://github.com/TheHive-Project/Cortex/tree/2.0.3) (2018-04-09) +[Full Changelog](https://github.com/TheHive-Project/Cortex/compare/2.0.2...2.0.3) + +**Implemented enhancements:** + +- Allow arbitrary parameters for a job [\#86](https://github.com/TheHive-Project/Cortex/issues/86) +- Change of global config for proxy is not reflected in analyzer's configurations [\#81](https://github.com/TheHive-Project/Cortex/issues/81) + +**Fixed bugs:** + +- Refresh Analyzers button not working [\#83](https://github.com/TheHive-Project/Cortex/issues/83) +- Version Upgrade of Analyzer makes all Analyzers invisible for TheHive \(Cortex2\) [\#75](https://github.com/TheHive-Project/Cortex/issues/75) + +**Closed issues:** + +- Allow specifying a cache period per analyzer [\#85](https://github.com/TheHive-Project/Cortex/issues/85) +- Display existing analyzers with invalid definition [\#82](https://github.com/TheHive-Project/Cortex/issues/82) +- Allow configuring auto artifacts extraction per analyzer [\#80](https://github.com/TheHive-Project/Cortex/issues/80) + +## [2.0.2](https://github.com/TheHive-Project/Cortex/tree/2.0.2) (2018-04-04) [Full Changelog](https://github.com/TheHive-Project/Cortex/compare/2.0.1...2.0.2) **Fixed bugs:** -- Silently failure when ElasticSearch is unreachable [\#76](https://github.com/TheHive-Project/Cortex/issues/76) - Coretxutils and TypeError: argument of type 'bool' is not iterable [\#73](https://github.com/TheHive-Project/Cortex/issues/73) +- Silently failure when ElasticSearch is unreachable [\#76](https://github.com/TheHive-Project/Cortex/issues/76) - Unable to disable analyzers [\#72](https://github.com/TheHive-Project/Cortex/issues/72) - Cortex 2 is not passing proxy variable to analyzers [\#71](https://github.com/TheHive-Project/Cortex/issues/71) - Session collision when TheHive & Cortex 2 share the same URL [\#70](https://github.com/TheHive-Project/Cortex/issues/70) @@ -157,4 +176,4 @@ ## [1.0.0](https://github.com/TheHive-Project/Cortex/tree/1.0.0) (2017-02-01) -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/version.sbt b/version.sbt index 121071caf..3e00daab6 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "2.0.2" +version in ThisBuild := "2.0.3" diff --git a/www/package.json b/www/package.json index 7ef08b028..66fee3a1b 100755 --- a/www/package.json +++ b/www/package.json @@ -1,6 +1,6 @@ { "name": "cortex", - "version": "2.0.2", + "version": "2.0.3", "description": "A powerfull observable analysis engine", "license": "AGPL-v3", "homepage": "https://github.com/TheHive-Project/Cortex",