From 90d8be48d465c6bf107ae03f5fc294d71e59e0dd Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Wed, 17 Jan 2018 15:52:25 +0100 Subject: [PATCH 1/9] Make Split more flexible so it can be used to join --- src/core/config/OperationConfig.js | 8 ++++---- src/core/operations/StrUtils.js | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index e1454d0a..ec47384d 100755 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -2125,13 +2125,13 @@ const OperationConfig = { args: [ { name: "Split delimiter", - type: "binaryShortString", - value: StrUtils.SPLIT_DELIM + type: "editableOption", + value: StrUtils.SPLIT_DELIM_OPTIONS }, { name: "Join delimiter", - type: "option", - value: StrUtils.DELIMITER_OPTIONS + type: "editableOption", + value: StrUtils.JOIN_DELIM_OPTIONS } ] }, diff --git a/src/core/operations/StrUtils.js b/src/core/operations/StrUtils.js index 5c1f8f18..d3695893 100755 --- a/src/core/operations/StrUtils.js +++ b/src/core/operations/StrUtils.js @@ -65,12 +65,28 @@ const StrUtils = { * @constant * @default */ - SPLIT_DELIM: ",", + SPLIT_DELIM_OPTIONS: [ + {name: "Line feed", value: "\\n"}, + {name: "CRLF", value: "\\r\\n"}, + {name: "Space", value: " "}, + {name: "Comma", value: ","}, + {name: "Semi-colon", value: ";"}, + {name: "Colon", value: ":"}, + {name: "Nothing (separate chars)", value: ""} + ], /** * @constant * @default */ - DELIMITER_OPTIONS: ["Line feed", "CRLF", "Space", "Comma", "Semi-colon", "Colon", "Nothing (separate chars)"], + JOIN_DELIM_OPTIONS: [ + {name: "Line feed", value: "\\n"}, + {name: "CRLF", value: "\\r\\n"}, + {name: "Space", value: " "}, + {name: "Comma", value: ","}, + {name: "Semi-colon", value: ";"}, + {name: "Colon", value: ":"}, + {name: "Nothing (join chars)", value: ""} + ], /** * Split operation. @@ -80,8 +96,8 @@ const StrUtils = { * @returns {string} */ runSplit: function(input, args) { - let splitDelim = args[0] || StrUtils.SPLIT_DELIM, - joinDelim = Utils.charRep[args[1]], + let splitDelim = args[0], + joinDelim = args[1], sections = input.split(splitDelim); return sections.join(joinDelim); From aa2b3b2843a712532122ab949d7e1680faf18cc5 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Thu, 18 Jan 2018 15:26:09 +0000 Subject: [PATCH 2/9] Changed order of split delimiters, placing comma first. --- src/core/operations/StrUtils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/operations/StrUtils.js b/src/core/operations/StrUtils.js index d3695893..6ca93253 100755 --- a/src/core/operations/StrUtils.js +++ b/src/core/operations/StrUtils.js @@ -66,10 +66,10 @@ const StrUtils = { * @default */ SPLIT_DELIM_OPTIONS: [ + {name: "Comma", value: ","}, + {name: "Space", value: " "}, {name: "Line feed", value: "\\n"}, {name: "CRLF", value: "\\r\\n"}, - {name: "Space", value: " "}, - {name: "Comma", value: ","}, {name: "Semi-colon", value: ";"}, {name: "Colon", value: ":"}, {name: "Nothing (separate chars)", value: ""} From 6fbb2f26d1d4abbccaaefb39124b34652942785e Mon Sep 17 00:00:00 2001 From: n1474335 Date: Thu, 18 Jan 2018 15:27:26 +0000 Subject: [PATCH 3/9] 7.5.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 739fa32c..6be60166 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "7.5.1", + "version": "7.5.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 56dc55bf..1b556776 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "7.5.1", + "version": "7.5.2", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 512487328d23feaf96710d0bcf12daf0732764a2 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Thu, 18 Jan 2018 18:35:17 +0000 Subject: [PATCH 4/9] Fixed bugs in pretty recipe format generation --- src/core/Utils.js | 15 +++++++-------- src/web/App.js | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/Utils.js b/src/core/Utils.js index a72a319c..877f1f82 100755 --- a/src/core/Utils.js +++ b/src/core/Utils.js @@ -903,9 +903,9 @@ const Utils = { * "Pretty" CyberChef recipe formats are designed to be included in the fragment (#) or query (?) * parts of the URL. They can also be loaded into CyberChef through the 'Load' interface. In order * to make this format as readable as possible, various special characters are used unescaped. This - * reduces the amount of percent-encoding included in the URL which is typically difficult to read, - * as well as substantially increasing the overall length. These characteristics can be quite - * offputting for users. + * reduces the amount of percent-encoding included in the URL which is typically difficult to read + * and substantially increases the overall length. These characteristics can be quite off-putting + * for users. * * @param {Object[]} recipeConfig * @param {boolean} newline - whether to add a newline after each operation @@ -922,12 +922,11 @@ const Utils = { name = op.op.replace(/ /g, "_"); args = JSON.stringify(op.args) .slice(1, -1) // Remove [ and ] as they are implied - // We now need to switch double-quoted (") strings to single-quotes (') as these do not - // need to be percent-encoded. + // We now need to switch double-quoted (") strings to single quotes (') as single quotes + // do not need to be percent-encoded. .replace(/'/g, "\\'") // Escape single quotes - .replace(/\\"/g, '"') // Unescape double quotes - .replace(/(^|,|{|:)"/g, "$1'") // Replace opening " with ' - .replace(/"(,|:|}|$)/g, "'$1"); // Replace closing " with ' + .replace(/"((?:[^"\\]|\\.)*)"/g, "'$1'") // Replace opening and closing " with ' + .replace(/\\"/g, '"'); // Unescape double quotes disabled = op.disabled ? "/disabled": ""; bp = op.breakpoint ? "/breakpoint" : ""; diff --git a/src/web/App.js b/src/web/App.js index f60420ae..13e57c9e 100755 --- a/src/web/App.js +++ b/src/web/App.js @@ -443,6 +443,7 @@ App.prototype.getRecipeConfig = function() { /** * Given a recipe configuration, sets the recipe to that configuration. * + * @fires Manager#statechange * @param {Object[]} recipeConfig - The recipe configuration */ App.prototype.setRecipeConfig = function(recipeConfig) { @@ -487,6 +488,7 @@ App.prototype.setRecipeConfig = function(recipeConfig) { // Unpause auto bake this.autoBakePause = false; + window.disptchEent(this.manager.statechange); }; From ec205f4f7d0cd86859c929a8c2bec5f0951c75df Mon Sep 17 00:00:00 2001 From: n1474335 Date: Thu, 18 Jan 2018 19:53:01 +0000 Subject: [PATCH 5/9] 7.5.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6be60166..52c138f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "7.5.2", + "version": "7.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1b556776..f6f2bc92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "7.5.2", + "version": "7.5.3", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 6220128a749993d398fcc1124f2dc005aa166916 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 22 Jan 2018 17:09:58 +0000 Subject: [PATCH 6/9] Fixed delimiter options in StrUtils. Closes #238. --- src/core/config/OperationConfig.js | 2 +- src/core/operations/StrUtils.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index ec47384d..e7775e1c 100755 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -2154,7 +2154,7 @@ const OperationConfig = { { name: "Invert condition", type: "boolean", - value: SeqUtils.SORT_REVERSE + value: false }, ] }, diff --git a/src/core/operations/StrUtils.js b/src/core/operations/StrUtils.js index 6ca93253..7e7f8b33 100755 --- a/src/core/operations/StrUtils.js +++ b/src/core/operations/StrUtils.js @@ -104,6 +104,12 @@ const StrUtils = { }, + /** + * @constant + * @default + */ + DELIMITER_OPTIONS: ["Line feed", "CRLF", "Space", "Comma", "Semi-colon", "Colon", "Nothing (separate chars)"], + /** * Filter operation. * From 7490651a0634aefab927ed7d429419991fe765a6 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 22 Jan 2018 17:10:02 +0000 Subject: [PATCH 7/9] 7.5.4 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 52c138f8..4bcf071c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "7.5.3", + "version": "7.5.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f6f2bc92..46450b06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "7.5.3", + "version": "7.5.4", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From abe87830cdea58d4e00adf1ed00e31de59e02786 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 22 Jan 2018 17:51:04 +0000 Subject: [PATCH 8/9] Operation tooltips now disappear if you hover over them while dragging an opertion. --- src/web/OperationsWaiter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/web/OperationsWaiter.js b/src/web/OperationsWaiter.js index adc2be6d..48bbe158 100755 --- a/src/web/OperationsWaiter.js +++ b/src/web/OperationsWaiter.js @@ -167,7 +167,8 @@ OperationsWaiter.prototype.opListCreate = function(e) { OperationsWaiter.prototype.enableOpsListPopovers = function(el) { $(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]") .popover({trigger: "manual"}) - .on("mouseenter", function() { + .on("mouseenter", function(e) { + if (e.buttons > 0) return; // Mouse button held down - likely dragging an opertion const _this = this; $(this).popover("show"); $(".popover").on("mouseleave", function () { @@ -178,7 +179,7 @@ OperationsWaiter.prototype.enableOpsListPopovers = function(el) { setTimeout(function() { // Determine if the popover associated with this element is being hovered over if ($(_this).data("bs.popover") && - !$(_this).data("bs.popover").$tip.is(":hover")) { + ($(_this).data("bs.popover").$tip && !$(_this).data("bs.popover").$tip.is(":hover"))) { $(_this).popover("hide"); } }, 50); From fe8f8bc71292683347d56e7c8d999955cd7d3dbd Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 22 Jan 2018 19:58:21 +0000 Subject: [PATCH 9/9] Setting a text value in the input now closes any open files. --- src/web/InputWaiter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/web/InputWaiter.js b/src/web/InputWaiter.js index 2fb6d7df..8ae452fa 100755 --- a/src/web/InputWaiter.js +++ b/src/web/InputWaiter.js @@ -64,6 +64,7 @@ InputWaiter.prototype.set = function(input) { this.setInputInfo(input.size, null); } else { inputText.value = input; + this.closeFile(); window.dispatchEvent(this.manager.statechange); const lines = input.length < (this.app.options.ioDisplayThreshold * 1024) ? input.count("\n") + 1 : null;