diff options
author | Matthias Held <ilovemilk@wusa.io> | 2018-09-13 20:20:02 +0300 |
---|---|---|
committer | Matthias Held <ilovemilk@wusa.io> | 2018-09-13 20:20:02 +0300 |
commit | 900e31eecdfba9a7bfdaaf0349e293098e149834 (patch) | |
tree | b4b09d4f3b56c4d9eb054c342177dc34d54ec4b9 | |
parent | 4a1cff97b588e6047168f6d91de92cc6a0d9534f (diff) |
Simplify sequence analysis result color coding
Signed-off-by: Matthias Held <matthias.held@uni-konstanz.de>
-rw-r--r-- | css/style.scss | 12 | ||||
-rw-r--r-- | js/filelist.js | 4 | ||||
-rw-r--r-- | js/scan.js | 4 | ||||
-rw-r--r-- | js/utils.js | 10 | ||||
-rw-r--r-- | lib/Analyzer/SequenceAnalyzer.php | 8 |
5 files changed, 12 insertions, 26 deletions
diff --git a/css/style.scss b/css/style.scss index 79b71f7..1dc1844 100644 --- a/css/style.scss +++ b/css/style.scss @@ -235,12 +235,6 @@ table { &.color-blind-yellow { background-color: rgba(11, 85, 159, .5); } - &.orange { - background-color: #EB9532; - } - &.color-blind-orange { - background-color: rgba(11, 85, 159, .75); - } &.red { background-color: #FF6347; } @@ -267,12 +261,6 @@ table { &.color-blind-yellow { background-color: rgba(11, 85, 159, .5); } - &.orange { - background-color: #EB9532; - } - &.color-blind-orange { - background-color: rgba(11, 85, 159, .75); - } &.red { background-color: #FF6347; } diff --git a/js/filelist.js b/js/filelist.js index 6d45741..c04ad14 100644 --- a/js/filelist.js +++ b/js/filelist.js @@ -88,8 +88,8 @@ } $.getJSON(self.getColorModeUrl, function(schema) { if (schema.colorMode == 1) { - Utils.colors = {red: 'color-blind-red', orange: 'color-blind-orange', yellow: 'color-blind-yellow', green: 'color-blind-green'}; - Utils.colorsText = {red: 'color-blind-red-text', orange: 'color-blind-orange', yellow: 'color-blind-yellow-text', green: 'color-blind-green-text'}; + Utils.colors = {red: 'color-blind-red', yellow: 'color-blind-yellow', green: 'color-blind-green'}; + Utils.colorsText = {red: 'color-blind-red-text', yellow: 'color-blind-yellow-text', green: 'color-blind-green-text'}; } $.getJSON(self.url, function(data) { $('#section-loading').remove(); @@ -208,8 +208,8 @@ var count = 0; $.getJSON(self.getColorModeUrl, function(schema) { if (schema.colorMode == 1) { - Utils.colors = {red: 'color-blind-red', orange: 'color-blind-orange', yellow: 'color-blind-yellow', green: 'color-blind-green'}; - Utils.colorsText = {red: 'color-blind-red-text', orange: 'color-blind-orange', yellow: 'color-blind-yellow-text', green: 'color-blind-green-text'}; + Utils.colors = {red: 'color-blind-red', yellow: 'color-blind-yellow', green: 'color-blind-green'}; + Utils.colorsText = {red: 'color-blind-red-text', yellow: 'color-blind-yellow-text', green: 'color-blind-green-text'}; } $.each(self.sequencesToScan, function(index, sequence) { $.ajax({ diff --git a/js/utils.js b/js/utils.js index 18afda9..5820eba 100644 --- a/js/utils.js +++ b/js/utils.js @@ -32,8 +32,8 @@ * @memberof OCA.RansomwareDetection */ Utils.prototype = { - colors: {red: 'red', orange: 'orange', yellow: 'yellow', green: 'green'}, - colorsText: {red: 'red-text', orange: 'orange-text', yellow: 'yellow-text', green: 'green-text'}, + colors: {red: 'red', yellow: 'yellow', green: 'green'}, + colorsText: {red: 'red-text', yellow: 'yellow-text', green: 'green-text'}, /** * Creates a new row in the table. @@ -211,11 +211,9 @@ */ _createTableSkeleton: function(sequence, suspicionScore) { var color = this.colors.green; - if (suspicionScore >= 6) { + if (suspicionScore > 4) { color = this.colors.red; - } else if (suspicionScore >= 5) { - color = this.colors.orange; - } else if (suspicionScore >= 3) { + } else if (suspicionScore > 2) { color = this.colors.yellow; } var table = diff --git a/lib/Analyzer/SequenceAnalyzer.php b/lib/Analyzer/SequenceAnalyzer.php index e1b8c6c..190ca7d 100644 --- a/lib/Analyzer/SequenceAnalyzer.php +++ b/lib/Analyzer/SequenceAnalyzer.php @@ -71,7 +71,7 @@ class SequenceAnalyzer * Therefor the suspicions levels are weighted: * Suspicious - 1 * Maybe suspicious - 0.5 - * Not suspicious - 0.25 + * Not suspicious - 0 * * summed up and divided by the sum of all written files. The higher the result, * the higher is the suspicion of the hole sequence. @@ -139,10 +139,10 @@ class SequenceAnalyzer if (sizeof($files['written']) <= $upperBound && sizeof($files['written']) >= sizeof($files['deleted'])) { if ($this->sequenceSizeAnalyzer->analyze($sequence) === SequenceSizeAnalyzer::EQUAL_SIZE) { $sequenceResult->setQuantities(2); - $suspicionScore += 2; + $suspicionScore += 1; } else { $sequenceResult->setQuantities(1); - $suspicionScore += 1; + $suspicionScore += 0; } } } @@ -156,7 +156,7 @@ class SequenceAnalyzer } // weight the suspicion levels. - $suspicionSum = (sizeof($files['suspicious']) * 1) + (sizeof($files['maybeSuspicious']) * 0.5) + ((sizeof($files['notSuspicious']) - $numberOfInfoFiles) * 0.25); + $suspicionSum = (sizeof($files['suspicious']) * 1) + (sizeof($files['maybeSuspicious']) * 0.5); // check for division by zero. if (($numberOfWrittenFiles - $numberOfInfoFiles) > 0) { |