From 219469f24f03295f0ac6c87c3b454fa03a338ba0 Mon Sep 17 00:00:00 2001 From: h345983745 Date: Sat, 11 May 2019 20:24:39 +0100 Subject: [PATCH 01/39] Intial Commit Consolidated IP Regex's Fixed Logic Error Added Tests Removed Changes Outside Of Operation Added to category --- src/core/config/Categories.json | 3 +- src/core/operations/DefangIP.mjs | 75 +++++++++++++++++++++++++++++ tests/operations/index.mjs | 1 + tests/operations/tests/DefangIP.mjs | 64 ++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 src/core/operations/DefangIP.mjs create mode 100644 tests/operations/tests/DefangIP.mjs diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 2d194c37..1692b434 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -177,7 +177,8 @@ "Group IP addresses", "Encode NetBIOS Name", "Decode NetBIOS Name", - "Defang URL" + "Defang URL", + "Defang IP" ] }, { diff --git a/src/core/operations/DefangIP.mjs b/src/core/operations/DefangIP.mjs new file mode 100644 index 00000000..b993c81e --- /dev/null +++ b/src/core/operations/DefangIP.mjs @@ -0,0 +1,75 @@ +/** + * @author h345983745 + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; + + +/** + * Defang IP operation + */ +class DefangIP extends Operation { + + /** + * DefangIP constructor + */ + constructor() { + super(); + + this.name = "Defang IP"; + this.module = "Default"; + this.description = "Takes a IPV4 or IPV6 address and 'Defangs' it; meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address."; + this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + name: "IPV4", + type: "boolean", + value: true + }, + { + name: "IPV6", + type: "boolean", + value: true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const [IPV4, IPV6] = args; + + if (IPV4) { + input = input.replace(IPV4_REGEX, x => { + return x.replace(/\./g, "[.]"); + }); + } + if (IPV6) { + input = input.replace(IPV6_REGEX, x => { + return x.replace(/:/g, "[:]"); + }); + } + return input; + } +} + +export default DefangIP; + + +/** + * IPV4 regular expression + */ +const IPV4_REGEX = new RegExp("(?:(?:\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d|\\d)(?:\\/\\d{1,2})?", "g"); + + +/** + * IPV6 regular expression + */ +const IPV6_REGEX = new RegExp("((?=.*::)(?!.*::.+::)(::)?([\\dA-Fa-f]{1,4}:(:|\\b)|){5}|([\\dA-Fa-f]{1,4}:){6})((([\\dA-Fa-f]{1,4}((?!\\3)::|:\\b|(?![\\dA-Fa-f])))|(?!\\2\\3)){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})", "g"); diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index 41d78c35..32c6e0ce 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -90,6 +90,7 @@ import "./tests/Typex"; import "./tests/BLAKE2b"; import "./tests/BLAKE2s"; import "./tests/Protobuf"; +import "./tests/DefangIP"; // Cannot test operations that use the File type yet //import "./tests/SplitColourChannels"; diff --git a/tests/operations/tests/DefangIP.mjs b/tests/operations/tests/DefangIP.mjs new file mode 100644 index 00000000..7c8c206c --- /dev/null +++ b/tests/operations/tests/DefangIP.mjs @@ -0,0 +1,64 @@ +/** + * DefangIP tests. + * + * @author h345983745 + * + * @copyright Crown Copyright 2017 + * @license Apache-2.0 + */ +import TestRegister from "../TestRegister"; + +TestRegister.addTests([ + { + name: "Defang IP: Valid IPV4", + input: "192.168.1.1", + expectedOutput: "192[.]168[.]1[.]1", + recipeConfig: [ + { + op: "Defang IP", + args: [true, true], + }, + ], + }, { + name: "Defang IP: Valid IPV6", + input: "2001:0db8:85a3:0000:0000:8a2e:0370:7343", + expectedOutput: "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343", + recipeConfig: [ + { + op: "Defang IP", + args: [true, true], + }, + ], + }, { + name: "Defang IP: Valid IPV6 Shorthand", + input: "2001:db8:3c4d:15::1a2f:1a2b", + expectedOutput: "2001[:]db8[:]3c4d[:]15[:][:]1a2f[:]1a2b", + recipeConfig: [ + { + op: "Defang IP", + args: [true, true], + }, + ], + }, + { + name: "Defang IP: IPV4 Only", + input: "192.168.1.1 2001:0db8:85a3:0000:0000:8a2e:0370:7343", + expectedOutput: "192[.]168[.]1[.]1 2001:0db8:85a3:0000:0000:8a2e:0370:7343", + recipeConfig: [ + { + op: "Defang IP", + args: [true, false], + }, + ], + }, { + name: "Defang IP: IPV6 Only", + input: "192.168.1.1 2001:0db8:85a3:0000:0000:8a2e:0370:7343", + expectedOutput: "192.168.1.1 2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343", + recipeConfig: [ + { + op: "Defang IP", + args: [false, true], + }, + ], + } +]); From 59cdd259ac8915368d5b81354a8d7d046359b608 Mon Sep 17 00:00:00 2001 From: j433866 Date: Thu, 23 May 2019 11:11:37 +0100 Subject: [PATCH 02/39] Add new parse ssh host key operation --- src/core/operations/ParseSSHHostKey.mjs | 143 ++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 src/core/operations/ParseSSHHostKey.mjs diff --git a/src/core/operations/ParseSSHHostKey.mjs b/src/core/operations/ParseSSHHostKey.mjs new file mode 100644 index 00000000..811f33c8 --- /dev/null +++ b/src/core/operations/ParseSSHHostKey.mjs @@ -0,0 +1,143 @@ +/** + * @author j433866 [j433866@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; +import Utils from "../Utils"; +import { fromBase64 } from "../lib/Base64"; +import { fromHex, toHexFast } from "../lib/Hex"; + +/** + * Parse SSH Host Key operation + */ +class ParseSSHHostKey extends Operation { + + /** + * ParseSSHHostKey constructor + */ + constructor() { + super(); + + this.name = "Parse SSH Host Key"; + this.module = "Default"; + this.description = "Parses a SSH host key. The key can be in either Hex or Base64."; + this.infoURL = "https://wikipedia.org/wiki/Secure_Shell"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + name: "Input Format", + type: "option", + value: [ + "Auto", + "Base64", + "Hex" + ] + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + const [inputFormat] = args, + inputKey = this.convertKeyToBinary(input.trim(), inputFormat), + fields = this.parseKey(inputKey), + keyType = Utils.byteArrayToChars(fromHex(fields[0]), ""); + + let output = `Key type: ${keyType}`; + + if (keyType === "ssh-rsa") { + output += `\nExponent: 0x${fields[1]}`; + output += `\nModulus: 0x${fields[2]}`; + } else if (keyType === "ssh-dss") { + output += `\np: 0x${fields[1]}`; + output += `\nq: 0x${fields[2]}`; + output += `\ng: 0x${fields[3]}`; + output += `\ny: 0x${fields[4]}`; + } else if (keyType.startsWith("ecdsa-sha2")) { + output += `\nCurve: ${Utils.byteArrayToChars(fromHex(fields[0]))}`; + output += `\nPoint: 0x${fields.slice(2)}`; + } else { + output += "\nUnsupported key type."; + output += `\nParameters: ${fields.slice(1)}`; + } + + return output; + } + + /** + * Converts the key to binary format from either hex or base64 + * + * @param {string} inputKey + * @param {string} inputFormat + * @returns {byteArray} + */ + convertKeyToBinary(inputKey, inputFormat) { + if (inputFormat === "Auto") { + inputFormat = this.detectKeyFormat(inputKey); + } + if (inputFormat === "Hex") { + return fromHex(inputKey); + } else if (inputFormat === "Base64") { + return fromBase64(inputKey, null, "byteArray"); + } else { + throw new OperationError("Invalid input format."); + } + } + + + /** + * Detects if the key is base64 or hex encoded + * + * @param {string} inputKey + * @returns {string} + */ + detectKeyFormat(inputKey) { + const hexPattern = new RegExp(/^(?:[\dA-Fa-f]{2}[ ,;:]?)+$/); + const b64Pattern = new RegExp(/^\s*(?:[A-Za-z\d+/]{4})+(?:[A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?\s*$/); + + if (hexPattern.test(inputKey)) { + return "Hex"; + } else if (b64Pattern.test(inputKey)) { + return "Base64"; + } else { + throw new OperationError("Unable to detect input key format."); + } + } + + + /** + * Parses fields from the key + * + * @param {byteArray} key + */ + parseKey(key) { + const fields = []; + while (key.length > 0) { + const lengthField = key.slice(0, 4); + let decodedLength = 0; + for (let i = 0; i < lengthField.length; i++) { + decodedLength += lengthField[i]; + decodedLength = decodedLength << 8; + } + decodedLength = decodedLength >> 8; + // Break if length wasn't decoded correctly + if (decodedLength <= 0) break; + + fields.push(toHexFast(key.slice(4, 4 + decodedLength))); + key = key.slice(4 + decodedLength); + } + + return fields; + } + +} + +export default ParseSSHHostKey; From bac2e8c014a6abf90dcf8c29e59b69fbacfb357d Mon Sep 17 00:00:00 2001 From: h345983745 Date: Sat, 29 Jun 2019 01:12:50 +0100 Subject: [PATCH 03/39] Removed V4 + V6 options --- src/core/operations/DefangIP.mjs | 35 ++++++++++------------------- tests/operations/tests/DefangIP.mjs | 29 ++++-------------------- 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/src/core/operations/DefangIP.mjs b/src/core/operations/DefangIP.mjs index b993c81e..03bfc6da 100644 --- a/src/core/operations/DefangIP.mjs +++ b/src/core/operations/DefangIP.mjs @@ -24,18 +24,8 @@ class DefangIP extends Operation { this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/"; this.inputType = "string"; this.outputType = "string"; - this.args = [ - { - name: "IPV4", - type: "boolean", - value: true - }, - { - name: "IPV6", - type: "boolean", - value: true - } - ]; + this.args = []; + } /** @@ -44,18 +34,17 @@ class DefangIP extends Operation { * @returns {string} */ run(input, args) { - const [IPV4, IPV6] = args; - if (IPV4) { - input = input.replace(IPV4_REGEX, x => { - return x.replace(/\./g, "[.]"); - }); - } - if (IPV6) { - input = input.replace(IPV6_REGEX, x => { - return x.replace(/:/g, "[:]"); - }); - } + + input = input.replace(IPV4_REGEX, x => { + return x.replace(/\./g, "[.]"); + }); + + + input = input.replace(IPV6_REGEX, x => { + return x.replace(/:/g, "[:]"); + }); + return input; } } diff --git a/tests/operations/tests/DefangIP.mjs b/tests/operations/tests/DefangIP.mjs index 7c8c206c..7c3ce1e8 100644 --- a/tests/operations/tests/DefangIP.mjs +++ b/tests/operations/tests/DefangIP.mjs @@ -3,7 +3,7 @@ * * @author h345983745 * - * @copyright Crown Copyright 2017 + * @copyright Crown Copyright 2019 * @license Apache-2.0 */ import TestRegister from "../TestRegister"; @@ -16,7 +16,7 @@ TestRegister.addTests([ recipeConfig: [ { op: "Defang IP", - args: [true, true], + args: [], }, ], }, { @@ -26,7 +26,7 @@ TestRegister.addTests([ recipeConfig: [ { op: "Defang IP", - args: [true, true], + args: [], }, ], }, { @@ -36,29 +36,8 @@ TestRegister.addTests([ recipeConfig: [ { op: "Defang IP", - args: [true, true], + args: [], }, ], }, - { - name: "Defang IP: IPV4 Only", - input: "192.168.1.1 2001:0db8:85a3:0000:0000:8a2e:0370:7343", - expectedOutput: "192[.]168[.]1[.]1 2001:0db8:85a3:0000:0000:8a2e:0370:7343", - recipeConfig: [ - { - op: "Defang IP", - args: [true, false], - }, - ], - }, { - name: "Defang IP: IPV6 Only", - input: "192.168.1.1 2001:0db8:85a3:0000:0000:8a2e:0370:7343", - expectedOutput: "192.168.1.1 2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343", - recipeConfig: [ - { - op: "Defang IP", - args: [false, true], - }, - ], - } ]); From d56ff0825a0d61c63ab897522c861522c9fd287d Mon Sep 17 00:00:00 2001 From: j433866 Date: Mon, 8 Jul 2019 15:58:56 +0100 Subject: [PATCH 04/39] Add extraction of actual key from public key file --- src/core/operations/ParseSSHHostKey.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/operations/ParseSSHHostKey.mjs b/src/core/operations/ParseSSHHostKey.mjs index 811f33c8..fe055496 100644 --- a/src/core/operations/ParseSSHHostKey.mjs +++ b/src/core/operations/ParseSSHHostKey.mjs @@ -80,6 +80,13 @@ class ParseSSHHostKey extends Operation { * @returns {byteArray} */ convertKeyToBinary(inputKey, inputFormat) { + const keyPattern = new RegExp(/^(?:[ssh]|[ecdsa-sha2])\S+\s+(\S*)/), + keyMatch = inputKey.match(keyPattern); + + if (keyMatch) { + inputKey = keyMatch[1]; + } + if (inputFormat === "Auto") { inputFormat = this.detectKeyFormat(inputKey); } From 944842d4eb2695db5b463b48c531558fb4732085 Mon Sep 17 00:00:00 2001 From: j433866 Date: Mon, 8 Jul 2019 16:44:36 +0100 Subject: [PATCH 05/39] Improve description and add to Categories --- src/core/config/Categories.json | 3 ++- src/core/operations/ParseSSHHostKey.mjs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 2d194c37..ae5c68ed 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -122,7 +122,8 @@ "PGP Encrypt", "PGP Decrypt", "PGP Encrypt and Sign", - "PGP Decrypt and Verify" + "PGP Decrypt and Verify", + "Parse SSH Host Key" ] }, { diff --git a/src/core/operations/ParseSSHHostKey.mjs b/src/core/operations/ParseSSHHostKey.mjs index fe055496..f83f6536 100644 --- a/src/core/operations/ParseSSHHostKey.mjs +++ b/src/core/operations/ParseSSHHostKey.mjs @@ -23,7 +23,7 @@ class ParseSSHHostKey extends Operation { this.name = "Parse SSH Host Key"; this.module = "Default"; - this.description = "Parses a SSH host key. The key can be in either Hex or Base64."; + this.description = "Parses a SSH host key and extracts fields from it.
The key type can be:
  • ssh-rsa
  • ssh-dss
  • ecdsa-sha2
The key format can be either Hex or Base64."; this.infoURL = "https://wikipedia.org/wiki/Secure_Shell"; this.inputType = "string"; this.outputType = "string"; From ac1c93d29bdf89ee41d9cbdec361167b4f8329bf Mon Sep 17 00:00:00 2001 From: j433866 Date: Mon, 8 Jul 2019 16:58:03 +0100 Subject: [PATCH 06/39] Fix incorrect curve detection for ecdsa-sha2 --- src/core/operations/ParseSSHHostKey.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/operations/ParseSSHHostKey.mjs b/src/core/operations/ParseSSHHostKey.mjs index f83f6536..17b1a8d1 100644 --- a/src/core/operations/ParseSSHHostKey.mjs +++ b/src/core/operations/ParseSSHHostKey.mjs @@ -62,7 +62,7 @@ class ParseSSHHostKey extends Operation { output += `\ng: 0x${fields[3]}`; output += `\ny: 0x${fields[4]}`; } else if (keyType.startsWith("ecdsa-sha2")) { - output += `\nCurve: ${Utils.byteArrayToChars(fromHex(fields[0]))}`; + output += `\nCurve: ${Utils.byteArrayToChars(fromHex(fields[1]))}`; output += `\nPoint: 0x${fields.slice(2)}`; } else { output += "\nUnsupported key type."; From 9c6ceaa58a0497f2f20fd756d24c193d0c0b16fc Mon Sep 17 00:00:00 2001 From: j433866 Date: Mon, 15 Jul 2019 14:12:40 +0100 Subject: [PATCH 07/39] Add tests --- tests/operations/index.mjs | 1 + tests/operations/tests/ParseSSHHostKey.mjs | 65 ++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tests/operations/tests/ParseSSHHostKey.mjs diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index 41d78c35..e107ac97 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -90,6 +90,7 @@ import "./tests/Typex"; import "./tests/BLAKE2b"; import "./tests/BLAKE2s"; import "./tests/Protobuf"; +import "./tests/ParseSSHHostKey"; // Cannot test operations that use the File type yet //import "./tests/SplitColourChannels"; diff --git a/tests/operations/tests/ParseSSHHostKey.mjs b/tests/operations/tests/ParseSSHHostKey.mjs new file mode 100644 index 00000000..d6668e40 --- /dev/null +++ b/tests/operations/tests/ParseSSHHostKey.mjs @@ -0,0 +1,65 @@ +/** + * Parse SSH Host Key tests + * + * @author j433866 [j433866@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ +import TestRegister from "../TestRegister"; + +TestRegister.addTests([ + { + name: "SSH Host Key: RSA", + input: "AAAAB3NzaC1yc2EAAAADAQABAAABAQDiJZ/9W9Ix/Dk9b+K4E+RGCug1AtkGXaJ9vNIY0YHFHLpWsB8DAuh/cGEI9TLbL1gzR2wG+RJNQ2EAQVWe6ypkK63Jm4zw4re+vhEiszpnP889J0h5N9yzyTndesrl4d3cQtv861FcKDPxUJbRALdtl6gwOB7BCL8gsXJLLVLO4EesrbPXD454qpVt7CgJXEXByOFjcIm3XwkdOnXMPHHnMSD7EIN1SvQMD6PfIDrbDd6KQt5QXW/Rc/BsfX5cbUIV1QW5A/GbepXHHKmWRtLC2J/mH3hW2Zq/hITPEaJdG1CtIilQmJaZGXpfGIwFeb0Av9pSL926arZZ6vDi9ctF", + expectedOutput: `Key type: ssh-rsa +Exponent: 0x010001 +Modulus: 0x00e2259ffd5bd231fc393d6fe2b813e4460ae83502d9065da27dbcd218d181c51cba56b01f0302e87f706108f532db2f5833476c06f9124d43610041559eeb2a642badc99b8cf0e2b7bebe1122b33a673fcf3d27487937dcb3c939dd7acae5e1dddc42dbfceb515c2833f15096d100b76d97a830381ec108bf20b1724b2d52cee047acadb3d70f8e78aa956dec28095c45c1c8e1637089b75f091d3a75cc3c71e73120fb1083754af40c0fa3df203adb0dde8a42de505d6fd173f06c7d7e5c6d4215d505b903f19b7a95c71ca99646d2c2d89fe61f7856d99abf8484cf11a25d1b50ad222950989699197a5f188c0579bd00bfda522fddba6ab659eaf0e2f5cb45`, + recipeConfig: [ + { + op: "Parse SSH Host Key", + args: ["Base64"] + } + ] + }, + { + name: "SSH Host Key: DSA", + input: "AAAAB3NzaC1kc3MAAACBAMnoZCOzvaQqs//9mxK2USZvJBc7b1dFJiBcV80abN6maE+203pTRPIPCpPt0deQxv4YN3dSHoodEcArWxs1QRAIuRsQIvsUP7chovzGnxP84XWK5sbfrseD0vxZ7UR0NaAFPcSgeXcWC1SG9uvrAJQlyp4DBy+fKuqiYmwaz0bHAAAAFQCXNJ4yiE1V7LpCU2V1JKbqDvICMwAAAIB/5aR1iBOeyCVpj0dP3YZmoxd9R7FCC/0UuOf0lx4E6WHT6Z2QuPBhc2mpNDq2M0VF9oJfVWgcfG8r1rlXaCYODSacGcbnW5VKQ+LKkkALmg4h8jFCHReUC+Hmia/v8LyDwPO1wK6ETn7a3m80yM7gAU5ZNurVIVVP2lB65mjEsQAAAIA3ct9YRB6iUCvOD45sZM1C9oTC24Ttmaou0GcpWx3h0/iZ8mbil1cjaO9frRNZ/vSSVWEhEDNG8gwkjZWlvnJL3y1XUxbMll4WbmI/Q1kzKwopceaFwMbYTPKDg6L1RtCMUxSUyKsFk1c4SpEPlDS7DApZs5PgmWgMd/u6vwMXyg==", + expectedOutput: `Key type: ssh-dss +p: 0x00c9e86423b3bda42ab3fffd9b12b651266f24173b6f574526205c57cd1a6cdea6684fb6d37a5344f20f0a93edd1d790c6fe183777521e8a1d11c02b5b1b35411008b91b1022fb143fb721a2fcc69f13fce1758ae6c6dfaec783d2fc59ed447435a0053dc4a07977160b5486f6ebeb009425ca9e03072f9f2aeaa2626c1acf46c7 +q: 0x0097349e32884d55ecba4253657524a6ea0ef20233 +g: 0x7fe5a47588139ec825698f474fdd8666a3177d47b1420bfd14b8e7f4971e04e961d3e99d90b8f0617369a9343ab6334545f6825f55681c7c6f2bd6b95768260e0d269c19c6e75b954a43e2ca92400b9a0e21f231421d17940be1e689afeff0bc83c0f3b5c0ae844e7edade6f34c8cee0014e5936ead521554fda507ae668c4b1 +y: 0x3772df58441ea2502bce0f8e6c64cd42f684c2db84ed99aa2ed067295b1de1d3f899f266e297572368ef5fad1359fef492556121103346f20c248d95a5be724bdf2d575316cc965e166e623f4359332b0a2971e685c0c6d84cf28383a2f546d08c531494c8ab059357384a910f9434bb0c0a59b393e099680c77fbbabf0317ca`, + recipeConfig: [ + { + op: "Parse SSH Host Key", + args: ["Base64"] + } + ] + }, + { + name: "SSH Host Key: ECDSA", + input: "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGxZWSAGJyJQoVBwFCpr420eRUZDE/kw2YWm5vDro8050DZ1ZzqIuYaNl0BGzMcRTeasGtJuI8G84ZQQSgca3C4=", + expectedOutput: `Key type: ecdsa-sha2-nistp256 +Curve: nistp256 +Point: 0x046c59592006272250a15070142a6be36d1e45464313f930d985a6e6f0eba3cd39d03675673a88b9868d974046ccc7114de6ac1ad26e23c1bce194104a071adc2e`, + recipeConfig: [ + { + op: "Parse SSH Host Key", + args: ["Base64"] + } + ] + }, + { + name: "SSH Host Key: Extract key", + input: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiJZ/9W9Ix/Dk9b+K4E+RGCug1AtkGXaJ9vNIY0YHFHLpWsB8DAuh/cGEI9TLbL1gzR2wG+RJNQ2EAQVWe6ypkK63Jm4zw4re+vhEiszpnP889J0h5N9yzyTndesrl4d3cQtv861FcKDPxUJbRALdtl6gwOB7BCL8gsXJLLVLO4EesrbPXD454qpVt7CgJXEXByOFjcIm3XwkdOnXMPHHnMSD7EIN1SvQMD6PfIDrbDd6KQt5QXW/Rc/BsfX5cbUIV1QW5A/GbepXHHKmWRtLC2J/mH3hW2Zq/hITPEaJdG1CtIilQmJaZGXpfGIwFeb0Av9pSL926arZZ6vDi9ctF test@test", + expectedOutput: `Key type: ssh-rsa +Exponent: 0x010001 +Modulus: 0x00e2259ffd5bd231fc393d6fe2b813e4460ae83502d9065da27dbcd218d181c51cba56b01f0302e87f706108f532db2f5833476c06f9124d43610041559eeb2a642badc99b8cf0e2b7bebe1122b33a673fcf3d27487937dcb3c939dd7acae5e1dddc42dbfceb515c2833f15096d100b76d97a830381ec108bf20b1724b2d52cee047acadb3d70f8e78aa956dec28095c45c1c8e1637089b75f091d3a75cc3c71e73120fb1083754af40c0fa3df203adb0dde8a42de505d6fd173f06c7d7e5c6d4215d505b903f19b7a95c71ca99646d2c2d89fe61f7856d99abf8484cf11a25d1b50ad222950989699197a5f188c0579bd00bfda522fddba6ab659eaf0e2f5cb45`, + recipeConfig: [ + { + op: "Parse SSH Host Key", + args: ["Base64"] + } + ] + } +]); From e4d98eba6baa129b7414c50956e911c11dff9231 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Fri, 19 Jul 2019 13:14:32 +0100 Subject: [PATCH 08/39] use std/esm to make chef compatible with cjs projects. Remove webpack work for node --- .travis.yml | 3 +- Gruntfile.js | 45 +--------------------------- package-lock.json | 5 ++++ package.json | 7 ++--- src/node/cjs.js | 13 ++++++++ src/node/{repl-index.mjs => repl.js} | 8 ++--- 6 files changed, 27 insertions(+), 54 deletions(-) create mode 100644 src/node/cjs.js rename src/node/{repl-index.mjs => repl.js} (86%) diff --git a/.travis.yml b/.travis.yml index 058ba004..c1929a9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ script: - grunt lint - grunt test - grunt docs - - npm run node-prod - grunt prod --msg="$COMPILE_MSG" - xvfb-run --server-args="-screen 0 1200x800x24" grunt testui before_deploy: @@ -34,7 +33,7 @@ deploy: file_glob: true file: - build/prod/*.zip - - build/node/CyberChef.js + - src/node/cjs.js on: repo: gchq/CyberChef tags: true diff --git a/Gruntfile.js b/Gruntfile.js index ab986085..df68bee4 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,7 +3,6 @@ const webpack = require("webpack"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; -const NodeExternals = require("webpack-node-externals"); const glob = require("glob"); const path = require("path"); @@ -15,7 +14,6 @@ const path = require("path"); * @license Apache-2.0 */ -const NODE_PROD = process.env.NODE_ENV === "production"; module.exports = function (grunt) { grunt.file.defaultEncoding = "utf8"; @@ -36,8 +34,7 @@ module.exports = function (grunt) { grunt.registerTask("node", "Compiles CyberChef into a single NodeJS module.", [ - "clean:node", "clean:config", "clean:nodeConfig", "exec:generateConfig", - "exec:generateNodeIndex", "webpack:node", "webpack:nodeRepl", "chmod:build" + "clean:node", "clean:config", "clean:nodeConfig", "exec:generateConfig", "exec:generateNodeIndex" ]); grunt.registerTask("test", @@ -201,46 +198,6 @@ module.exports = function (grunt) { ] }; }, - node: { - mode: NODE_PROD ? "production" : "development", - target: "node", - entry: "./src/node/index.mjs", - externals: [NodeExternals({ - whitelist: ["crypto-api/src/crypto-api"] - })], - output: { - filename: "CyberChef.js", - path: __dirname + "/build/node", - library: "CyberChef", - libraryTarget: "commonjs2" - }, - plugins: [ - new webpack.DefinePlugin(BUILD_CONSTANTS), - new webpack.optimize.LimitChunkCountPlugin({ - maxChunks: 1 - }) - ], - }, - nodeRepl: { - mode: NODE_PROD ? "production" : "development", - target: "node", - entry: "./src/node/repl-index.mjs", - externals: [NodeExternals({ - whitelist: ["crypto-api/src/crypto-api"] - })], - output: { - filename: "CyberChef-repl.js", - path: __dirname + "/build/node", - library: "CyberChef", - libraryTarget: "commonjs2" - }, - plugins: [ - new webpack.DefinePlugin(BUILD_CONSTANTS), - new webpack.optimize.LimitChunkCountPlugin({ - maxChunks: 1 - }) - ], - } }, "webpack-dev-server": { options: { diff --git a/package-lock.json b/package-lock.json index dfc402b9..ca59a9cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5097,6 +5097,11 @@ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", "dev": true }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" + }, "esmangle": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esmangle/-/esmangle-1.0.1.tgz", diff --git a/package.json b/package.json index 5dea14a9..bb5d5833 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "type": "git", "url": "https://github.com/gchq/CyberChef/" }, - "main": "build/node/CyberChef.js", + "main": "src/node/cjs.js", "module": "src/node/index.mjs", "bugs": "https://github.com/gchq/CyberChef/issues", "browserslist": [ @@ -108,6 +108,7 @@ "diff": "^4.0.1", "es6-promisify": "^6.0.1", "escodegen": "^1.11.1", + "esm": "^3.2.25", "esmangle": "^1.0.1", "esprima": "^4.0.1", "exif-parser": "^0.1.12", @@ -156,9 +157,7 @@ "scripts": { "start": "grunt dev", "build": "grunt prod", - "node": "NODE_ENV=development grunt node", - "node-prod": "NODE_ENV=production grunt node", - "repl": "grunt node && node build/node/CyberChef-repl.js", + "repl": "node src/node/repl.js", "test": "grunt test", "test-node": "grunt test-node", "testui": "grunt testui", diff --git a/src/node/cjs.js b/src/node/cjs.js new file mode 100644 index 00000000..a17bce53 --- /dev/null +++ b/src/node/cjs.js @@ -0,0 +1,13 @@ +/** + * Export the main ESM module as CommonJS + * + * + * @author d98762656 [d98762625@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +/*eslint no-global-assign: ["off"] */ +require = require("esm")(module); +module.exports = require("./index.mjs"); +module.exports.File = require("./File.mjs"); diff --git a/src/node/repl-index.mjs b/src/node/repl.js similarity index 86% rename from src/node/repl-index.mjs rename to src/node/repl.js index a974e364..c9ed76f1 100644 --- a/src/node/repl-index.mjs +++ b/src/node/repl.js @@ -7,9 +7,9 @@ * @license Apache-2.0 */ -import chef from "./index.mjs"; -import repl from "repl"; -import File from "./File.mjs"; +const chef = require("./cjs.js"); +const repl = require("repl"); + /*eslint no-console: ["off"] */ @@ -26,7 +26,7 @@ const replServer = repl.start({ prompt: "chef > ", }); -global.File = File; +global.File = chef.File; Object.keys(chef).forEach((key) => { if (key !== "operations") { From 67ead1c250319a810c09d3ffbdd6adfbfc763228 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 22 Jul 2019 23:12:36 +0100 Subject: [PATCH 09/39] Fixed alternative theme tables --- src/web/stylesheets/themes/_classic.css | 1 + src/web/stylesheets/themes/_dark.css | 1 + src/web/stylesheets/themes/_geocities.css | 1 + src/web/stylesheets/themes/_solarizedDark.css | 1 + src/web/stylesheets/themes/_solarizedLight.css | 1 + src/web/stylesheets/utils/_overrides.css | 12 ++++++++++++ 6 files changed, 17 insertions(+) diff --git a/src/web/stylesheets/themes/_classic.css b/src/web/stylesheets/themes/_classic.css index f89d9dce..3986a19e 100755 --- a/src/web/stylesheets/themes/_classic.css +++ b/src/web/stylesheets/themes/_classic.css @@ -125,6 +125,7 @@ /* Misc. */ --drop-file-border-colour: #3a87ad; + --table-border-colour: rgb(0, 0, 0, 0.1); --popover-background: #fff; --popover-border-colour: #ccc; --code-background: #f9f2f4; diff --git a/src/web/stylesheets/themes/_dark.css b/src/web/stylesheets/themes/_dark.css index ff2217fb..e37025d6 100755 --- a/src/web/stylesheets/themes/_dark.css +++ b/src/web/stylesheets/themes/_dark.css @@ -121,6 +121,7 @@ /* Misc. */ --drop-file-border-colour: #0e639c; + --table-border-colour: rgb(255, 255, 255, 0.10); --popover-background: #444; --popover-border-colour: #555; --code-background: #0e639c; diff --git a/src/web/stylesheets/themes/_geocities.css b/src/web/stylesheets/themes/_geocities.css index 230638b1..fcf3cdb5 100755 --- a/src/web/stylesheets/themes/_geocities.css +++ b/src/web/stylesheets/themes/_geocities.css @@ -121,6 +121,7 @@ /* Misc. */ --drop-file-border-colour: purple; + --table-border-colour: var(--hl3); --popover-background: turquoise; --popover-border-colour: violet; --code-background: black; diff --git a/src/web/stylesheets/themes/_solarizedDark.css b/src/web/stylesheets/themes/_solarizedDark.css index 1d46a9bd..a370258a 100755 --- a/src/web/stylesheets/themes/_solarizedDark.css +++ b/src/web/stylesheets/themes/_solarizedDark.css @@ -138,6 +138,7 @@ /* Misc. */ --drop-file-border-colour: var(--base01); + --table-border-colour: rgba(131, 148, 150, 0.4); --popover-background: var(--base02); --popover-border-colour: var(--base01); --code-background: var(--base03); diff --git a/src/web/stylesheets/themes/_solarizedLight.css b/src/web/stylesheets/themes/_solarizedLight.css index 46f8bf1c..8ce4ac1f 100755 --- a/src/web/stylesheets/themes/_solarizedLight.css +++ b/src/web/stylesheets/themes/_solarizedLight.css @@ -140,6 +140,7 @@ /* Misc. */ --drop-file-border-colour: var(--base1); + --table-border-colour: rgba(131, 148, 150, 0.4); --popover-background: var(--base2); --popover-border-colour: var(--base1); --code-background: var(--base3); diff --git a/src/web/stylesheets/utils/_overrides.css b/src/web/stylesheets/utils/_overrides.css index 129b840e..6239204f 100755 --- a/src/web/stylesheets/utils/_overrides.css +++ b/src/web/stylesheets/utils/_overrides.css @@ -148,6 +148,18 @@ optgroup { width: auto !important; } +.table { + color: var(--primary-font-colour); +} + +.table-bordered th, .table-bordered td { + border: 1px solid var(--table-border-colour); +} + +.table-hover tbody tr:hover { + color: var(--primary-font-colour) +} + .popover { background-color: var(--popover-background); border-color: var(--popover-border-colour); From d4c4e2599d8e73deef195d84c7fc4a94b24620d8 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 22 Jul 2019 23:16:17 +0100 Subject: [PATCH 10/39] Reduced redundancy --- src/web/stylesheets/utils/_overrides.css | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/web/stylesheets/utils/_overrides.css b/src/web/stylesheets/utils/_overrides.css index 6239204f..b1ca4c57 100755 --- a/src/web/stylesheets/utils/_overrides.css +++ b/src/web/stylesheets/utils/_overrides.css @@ -148,7 +148,8 @@ optgroup { width: auto !important; } -.table { +.table, +.table-hover tbody tr:hover { color: var(--primary-font-colour); } @@ -156,10 +157,6 @@ optgroup { border: 1px solid var(--table-border-colour); } -.table-hover tbody tr:hover { - color: var(--primary-font-colour) -} - .popover { background-color: var(--popover-background); border-color: var(--popover-border-colour); From b3a10d4f9e75fa013565a6dca51c24d3cf89fd59 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 23 Jul 2019 19:17:21 +0100 Subject: [PATCH 11/39] Made some better colour choices --- src/web/stylesheets/themes/_classic.css | 2 +- src/web/stylesheets/themes/_dark.css | 2 +- src/web/stylesheets/themes/_solarizedDark.css | 2 +- src/web/stylesheets/themes/_solarizedLight.css | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/web/stylesheets/themes/_classic.css b/src/web/stylesheets/themes/_classic.css index 3986a19e..3b3bd555 100755 --- a/src/web/stylesheets/themes/_classic.css +++ b/src/web/stylesheets/themes/_classic.css @@ -125,7 +125,7 @@ /* Misc. */ --drop-file-border-colour: #3a87ad; - --table-border-colour: rgb(0, 0, 0, 0.1); + --table-border-colour: #ccc; --popover-background: #fff; --popover-border-colour: #ccc; --code-background: #f9f2f4; diff --git a/src/web/stylesheets/themes/_dark.css b/src/web/stylesheets/themes/_dark.css index e37025d6..10340ea8 100755 --- a/src/web/stylesheets/themes/_dark.css +++ b/src/web/stylesheets/themes/_dark.css @@ -121,7 +121,7 @@ /* Misc. */ --drop-file-border-colour: #0e639c; - --table-border-colour: rgb(255, 255, 255, 0.10); + --table-border-colour: #555; --popover-background: #444; --popover-border-colour: #555; --code-background: #0e639c; diff --git a/src/web/stylesheets/themes/_solarizedDark.css b/src/web/stylesheets/themes/_solarizedDark.css index a370258a..3b7d4338 100755 --- a/src/web/stylesheets/themes/_solarizedDark.css +++ b/src/web/stylesheets/themes/_solarizedDark.css @@ -138,7 +138,7 @@ /* Misc. */ --drop-file-border-colour: var(--base01); - --table-border-colour: rgba(131, 148, 150, 0.4); + --table-border-colour: var(--base01); --popover-background: var(--base02); --popover-border-colour: var(--base01); --code-background: var(--base03); diff --git a/src/web/stylesheets/themes/_solarizedLight.css b/src/web/stylesheets/themes/_solarizedLight.css index 8ce4ac1f..00b86091 100755 --- a/src/web/stylesheets/themes/_solarizedLight.css +++ b/src/web/stylesheets/themes/_solarizedLight.css @@ -140,7 +140,7 @@ /* Misc. */ --drop-file-border-colour: var(--base1); - --table-border-colour: rgba(131, 148, 150, 0.4); + --table-border-colour: var(--base1); --popover-background: var(--base2); --popover-border-colour: var(--base1); --code-background: var(--base3); From 507c951f2826499a09f35a69fb974dcd8f482082 Mon Sep 17 00:00:00 2001 From: j433866 Date: Wed, 24 Jul 2019 09:12:16 +0100 Subject: [PATCH 12/39] 9.0.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 dfc402b9..06a7dcad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.1", + "version": "9.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5dea14a9..2a11f2bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.1", + "version": "9.0.2", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 36abaeb6fb595c8032fa10271e804d2abdbb14e3 Mon Sep 17 00:00:00 2001 From: j433866 Date: Wed, 24 Jul 2019 14:22:56 +0100 Subject: [PATCH 13/39] Fix tab bar shadows appearing when they shouldn't --- src/web/waiters/InputWaiter.mjs | 10 +++++++--- src/web/waiters/OutputWaiter.mjs | 14 +++++++++----- src/web/workers/InputWorker.mjs | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/web/waiters/InputWaiter.mjs b/src/web/waiters/InputWaiter.mjs index 573090d7..a261d294 100644 --- a/src/web/waiters/InputWaiter.mjs +++ b/src/web/waiters/InputWaiter.mjs @@ -988,9 +988,13 @@ class InputWaiter { this.manager.highlighter.removeHighlights(); getSelection().removeAllRanges(); - const tabsList = document.getElementById("input-tabs").children; - for (let i = tabsList.length - 1; i >= 0; i--) { - tabsList.item(i).remove(); + const tabsList = document.getElementById("input-tabs"); + const tabsListChildren = tabsList.children; + + tabsList.classList.remove("tabs-left"); + tabsList.classList.remove("tabs-right"); + for (let i = tabsListChildren.length - 1; i >= 0; i--) { + tabsListChildren.item(i).remove(); } this.showLoadingInfo({ diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs index 9697100c..e87e2fc6 100755 --- a/src/web/waiters/OutputWaiter.mjs +++ b/src/web/waiters/OutputWaiter.mjs @@ -217,9 +217,13 @@ class OutputWaiter { */ removeAllOutputs() { this.outputs = {}; - const tabs = document.getElementById("output-tabs").children; - for (let i = tabs.length - 1; i >= 0; i--) { - tabs.item(i).remove(); + const tabsList = document.getElementById("output-tabs"); + const tabsListChildren = tabsList.children; + + tabsList.classList.remove("tabs-left"); + tabsList.classList.remove("tabs-right"); + for (let i = tabsListChildren.length - 1; i >= 0; i--) { + tabsListChildren.item(i).remove(); } } @@ -935,8 +939,8 @@ class OutputWaiter { */ refreshTabs(activeTab, direction) { const newNums = this.getNearbyNums(activeTab, direction), - tabsLeft = (newNums[0] !== this.getSmallestInputNum()), - tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum()); + tabsLeft = (newNums[0] !== this.getSmallestInputNum() && newNums.length > 0), + tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum() && newNums.length > 0); this.manager.tabs.refreshOutputTabs(newNums, activeTab, tabsLeft, tabsRight); diff --git a/src/web/workers/InputWorker.mjs b/src/web/workers/InputWorker.mjs index d01a6bb2..4ec1d17f 100644 --- a/src/web/workers/InputWorker.mjs +++ b/src/web/workers/InputWorker.mjs @@ -493,8 +493,8 @@ self.setInput = function(inputData) { self.refreshTabs = function(inputNum, direction) { const nums = self.getNearbyNums(inputNum, direction), inputNums = Object.keys(self.inputs), - tabsLeft = (self.getSmallestInputNum(inputNums) !== nums[0]), - tabsRight = (self.getLargestInputNum(inputNums) !== nums[nums.length - 1]); + tabsLeft = (self.getSmallestInputNum(inputNums) !== nums[0] && nums.length > 0), + tabsRight = (self.getLargestInputNum(inputNums) !== nums[nums.length - 1] && nums.length > 0); self.postMessage({ action: "refreshTabs", From e4452b906e81f51809ed8d18f6e4254df45dc2c5 Mon Sep 17 00:00:00 2001 From: j433866 Date: Thu, 25 Jul 2019 15:14:12 +0100 Subject: [PATCH 14/39] Fix functions not being awaited --- src/web/waiters/OutputWaiter.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs index e87e2fc6..005d9533 100755 --- a/src/web/waiters/OutputWaiter.mjs +++ b/src/web/waiters/OutputWaiter.mjs @@ -1153,14 +1153,14 @@ class OutputWaiter { * Handler for copy click events. * Copies the output to the clipboard */ - copyClick() { + async copyClick() { const dish = this.getOutputDish(this.manager.tabs.getActiveOutputTab()); if (dish === null) { this.app.alert("Could not find data to copy. Has this output been baked yet?", 3000); return; } - const output = dish.get(Dish.STRING); + const output = await dish.get(Dish.STRING); // Create invisible textarea to populate with the raw dish string (not the printable version that // contains dots instead of the actual bytes) @@ -1335,7 +1335,7 @@ class OutputWaiter { if (Object.prototype.hasOwnProperty.call(output, "data") && output.data && Object.prototype.hasOwnProperty.call(output.data, "dish")) { - const data = output.data.dish.get(Dish.STRING); + const data = await output.data.dish.get(Dish.STRING); if (contentFilterExp.test(data)) { results.push({ inputNum: iNum, From 42cfed5fa81e6bcfa94fbce1b2cce1f8a3a5ac74 Mon Sep 17 00:00:00 2001 From: j433866 Date: Thu, 25 Jul 2019 15:16:07 +0100 Subject: [PATCH 15/39] Fix file inputs being overwritten with strings. Added force option in case we really need to overwrite --- src/web/waiters/InputWaiter.mjs | 8 +++++--- src/web/workers/InputWorker.mjs | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/web/waiters/InputWaiter.mjs b/src/web/waiters/InputWaiter.mjs index a261d294..40ec412f 100644 --- a/src/web/waiters/InputWaiter.mjs +++ b/src/web/waiters/InputWaiter.mjs @@ -515,8 +515,9 @@ class InputWaiter { * * @param {number} inputNum * @param {string | ArrayBuffer} value + * @param {boolean} [force=false] - If true, forces the value to be updated even if the type is different to the currently stored type */ - updateInputValue(inputNum, value) { + updateInputValue(inputNum, value, force=false) { let includeInput = false; const recipeStr = toBase64(value, "A-Za-z0-9+/"); // B64 alphabet with no padding if (recipeStr.length > 0 && recipeStr.length <= 68267) { @@ -534,7 +535,8 @@ class InputWaiter { action: "updateInputValue", data: { inputNum: inputNum, - value: value + value: value, + force: force } }, transferable); } @@ -1025,7 +1027,7 @@ class InputWaiter { this.manager.highlighter.removeHighlights(); getSelection().removeAllRanges(); - this.updateInputValue(inputNum, ""); + this.updateInputValue(inputNum, "", true); this.set({ inputNum: inputNum, diff --git a/src/web/workers/InputWorker.mjs b/src/web/workers/InputWorker.mjs index 4ec1d17f..cec68627 100644 --- a/src/web/workers/InputWorker.mjs +++ b/src/web/workers/InputWorker.mjs @@ -546,10 +546,13 @@ self.updateInputProgress = function(inputData) { * @param {object} inputData * @param {number} inputData.inputNum - The input that's having its value updated * @param {string | ArrayBuffer} inputData.value - The new value of the input + * @param {boolean} inputData.force - If true, still updates the input value if the input type is different to the stored value */ self.updateInputValue = function(inputData) { const inputNum = inputData.inputNum; if (inputNum < 1) return; + if (Object.prototype.hasOwnProperty.call(self.inputs[inputNum].data, "fileBuffer") && + typeof inputData.value === "string" && !inputData.force) return; const value = inputData.value; if (self.inputs[inputNum] !== undefined) { if (typeof value === "string") { From 82b94fad5db022933c301c18d4d46c37dda9442b Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 29 Jul 2019 15:14:29 +0100 Subject: [PATCH 16/39] Fixed BigNumber type coercion issues when passed between workers --- src/core/Dish.mjs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/core/Dish.mjs b/src/core/Dish.mjs index fbd5418a..9c878cf6 100755 --- a/src/core/Dish.mjs +++ b/src/core/Dish.mjs @@ -235,6 +235,10 @@ class Dish { case Dish.JSON: title = "application/json"; break; + case Dish.NUMBER: + case Dish.BIG_NUMBER: + title = this.value.toString(); + break; case Dish.ARRAY_BUFFER: case Dish.BYTE_ARRAY: title = this.detectDishType(); @@ -283,7 +287,21 @@ class Dish { case Dish.ARRAY_BUFFER: return this.value instanceof ArrayBuffer; case Dish.BIG_NUMBER: - return BigNumber.isBigNumber(this.value); + if (BigNumber.isBigNumber(this.value)) return true; + /* + If a BigNumber is passed between WebWorkers it is serialised as a JSON + object with a coefficient (c), exponent (e) and sign (s). We detect this + and reinitialise it as a BigNumber object. + */ + if (Object.keys(this.value).sort().equals(["c", "e", "s"])) { + const temp = new BigNumber(); + temp.c = this.value.c; + temp.e = this.value.e; + temp.s = this.value.s; + this.value = temp; + return true; + } + return false; case Dish.JSON: // All values can be serialised in some manner, so we return true in all cases return true; From 3a8b362dfd16355b84e875686b1af0bbdf114560 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 29 Jul 2019 15:15:34 +0100 Subject: [PATCH 17/39] 9.0.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 06a7dcad..682c1658 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.2", + "version": "9.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2a11f2bb..69de9d62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.2", + "version": "9.0.3", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 0e95ad8ed682510fcaa3827bafbcb9469bcd69bf Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 29 Jul 2019 17:09:46 +0100 Subject: [PATCH 18/39] Updated a range of operations to use ArrayBuffers instead of byteArrays to improve performance with large files. --- src/core/lib/Base64.mjs | 2 +- src/core/lib/BitwiseOp.mjs | 2 +- src/core/lib/Protobuf.mjs | 8 ++++---- src/core/lib/TLVParser.mjs | 2 +- src/core/operations/Adler32Checksum.mjs | 5 +++-- src/core/operations/BitShiftLeft.mjs | 11 ++++++----- src/core/operations/BitShiftRight.mjs | 11 ++++++----- src/core/operations/CitrixCTX1Decode.mjs | 5 +++-- src/core/operations/DecodeText.mjs | 6 +++--- src/core/operations/EncodeText.mjs | 9 ++++----- src/core/operations/Fletcher16Checksum.mjs | 5 +++-- src/core/operations/Fletcher32Checksum.mjs | 5 +++-- src/core/operations/Fletcher64Checksum.mjs | 5 +++-- src/core/operations/Fletcher8Checksum.mjs | 5 +++-- src/core/operations/FromBase64.mjs | 4 ++-- src/core/operations/GenerateHOTP.mjs | 4 ++-- src/core/operations/GenerateTOTP.mjs | 4 ++-- src/core/operations/NOT.mjs | 5 +++-- src/core/operations/OR.mjs | 5 +++-- src/core/operations/ParseTLV.mjs | 5 +++-- src/core/operations/ProtobufDecode.mjs | 5 +++-- src/core/operations/RemoveEXIF.mjs | 5 +++-- src/core/operations/RemoveNullBytes.mjs | 5 +++-- src/core/operations/SplitColourChannels.mjs | 5 +++-- src/core/operations/TCPIPChecksum.mjs | 5 +++-- src/core/operations/Tar.mjs | 6 ++++-- src/core/operations/ToBase32.mjs | 5 +++-- src/core/operations/ToBase58.mjs | 5 +++-- src/core/operations/ToBase62.mjs | 5 +++-- src/core/operations/ToBase85.mjs | 5 +++-- src/core/operations/ToBinary.mjs | 5 +++-- src/core/operations/ToDecimal.mjs | 5 +++-- src/core/operations/ToHexContent.mjs | 5 +++-- src/core/operations/ToQuotedPrintable.mjs | 7 ++++--- src/core/operations/Untar.mjs | 5 +++-- src/core/operations/XOR.mjs | 5 +++-- src/core/operations/XORBruteForce.mjs | 5 +++-- 37 files changed, 112 insertions(+), 84 deletions(-) diff --git a/src/core/lib/Base64.mjs b/src/core/lib/Base64.mjs index 5831ae9c..0d8788f9 100644 --- a/src/core/lib/Base64.mjs +++ b/src/core/lib/Base64.mjs @@ -63,7 +63,7 @@ export function toBase64(data, alphabet="A-Za-z0-9+/=") { /** * UnBase64's the input string using the given alphabet, returning a byte array. * - * @param {byteArray} data + * @param {string} data * @param {string} [alphabet="A-Za-z0-9+/="] * @param {string} [returnType="string"] - Either "string" or "byteArray" * @param {boolean} [removeNonAlphChars=true] diff --git a/src/core/lib/BitwiseOp.mjs b/src/core/lib/BitwiseOp.mjs index 84a7834b..fe33c812 100644 --- a/src/core/lib/BitwiseOp.mjs +++ b/src/core/lib/BitwiseOp.mjs @@ -9,7 +9,7 @@ /** * Runs bitwise operations across the input data. * - * @param {byteArray} input + * @param {byteArray|Uint8Array} input * @param {byteArray} key * @param {function} func - The bitwise calculation to carry out * @param {boolean} nullPreserving diff --git a/src/core/lib/Protobuf.mjs b/src/core/lib/Protobuf.mjs index f06b7822..03d5943e 100644 --- a/src/core/lib/Protobuf.mjs +++ b/src/core/lib/Protobuf.mjs @@ -16,14 +16,14 @@ class Protobuf { /** * Protobuf constructor * - * @param {byteArray} data + * @param {byteArray|Uint8Array} data */ constructor(data) { - // Check we have a byteArray - if (data instanceof Array) { + // Check we have a byteArray or Uint8Array + if (data instanceof Array || data instanceof Uint8Array) { this.data = data; } else { - throw new Error("Protobuf input must be a byteArray"); + throw new Error("Protobuf input must be a byteArray or Uint8Array"); } // Set up masks diff --git a/src/core/lib/TLVParser.mjs b/src/core/lib/TLVParser.mjs index 9e9395ff..cb8432c1 100644 --- a/src/core/lib/TLVParser.mjs +++ b/src/core/lib/TLVParser.mjs @@ -21,7 +21,7 @@ export default class TLVParser { /** * TLVParser constructor * - * @param {byteArray} input + * @param {byteArray|Uint8Array} input * @param {Object} options */ constructor(input, options) { diff --git a/src/core/operations/Adler32Checksum.mjs b/src/core/operations/Adler32Checksum.mjs index 75021854..80e6e340 100644 --- a/src/core/operations/Adler32Checksum.mjs +++ b/src/core/operations/Adler32Checksum.mjs @@ -22,13 +22,13 @@ class Adler32Checksum extends Operation { this.module = "Crypto"; this.description = "Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32."; this.infoURL = "https://wikipedia.org/wiki/Adler-32"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ @@ -36,6 +36,7 @@ class Adler32Checksum extends Operation { const MOD_ADLER = 65521; let a = 1, b = 0; + input = new Uint8Array(input); for (let i = 0; i < input.length; i++) { a += input[i]; diff --git a/src/core/operations/BitShiftLeft.mjs b/src/core/operations/BitShiftLeft.mjs index 2518e5c5..cd9f4568 100644 --- a/src/core/operations/BitShiftLeft.mjs +++ b/src/core/operations/BitShiftLeft.mjs @@ -21,8 +21,8 @@ class BitShiftLeft extends Operation { this.module = "Default"; this.description = "Shifts the bits in each byte towards the left by the specified amount."; this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; - this.inputType = "byteArray"; - this.outputType = "byteArray"; + this.inputType = "ArrayBuffer"; + this.outputType = "ArrayBuffer"; this.args = [ { "name": "Amount", @@ -33,16 +33,17 @@ class BitShiftLeft extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args - * @returns {byteArray} + * @returns {ArrayBuffer} */ run(input, args) { const amount = args[0]; + input = new Uint8Array(input); return input.map(b => { return (b << amount) & 0xff; - }); + }).buffer; } /** diff --git a/src/core/operations/BitShiftRight.mjs b/src/core/operations/BitShiftRight.mjs index a41bd8ca..2d70849e 100644 --- a/src/core/operations/BitShiftRight.mjs +++ b/src/core/operations/BitShiftRight.mjs @@ -21,8 +21,8 @@ class BitShiftRight extends Operation { this.module = "Default"; this.description = "Shifts the bits in each byte towards the right by the specified amount.

Logical shifts replace the leftmost bits with zeros.
Arithmetic shifts preserve the most significant bit (MSB) of the original byte keeping the sign the same (positive or negative)."; this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; - this.inputType = "byteArray"; - this.outputType = "byteArray"; + this.inputType = "ArrayBuffer"; + this.outputType = "ArrayBuffer"; this.args = [ { "name": "Amount", @@ -38,18 +38,19 @@ class BitShiftRight extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args - * @returns {byteArray} + * @returns {ArrayBuffer} */ run(input, args) { const amount = args[0], type = args[1], mask = type === "Logical shift" ? 0 : 0x80; + input = new Uint8Array(input); return input.map(b => { return (b >>> amount) ^ (b & mask); - }); + }).buffer; } /** diff --git a/src/core/operations/CitrixCTX1Decode.mjs b/src/core/operations/CitrixCTX1Decode.mjs index d117c9f5..33de4a36 100644 --- a/src/core/operations/CitrixCTX1Decode.mjs +++ b/src/core/operations/CitrixCTX1Decode.mjs @@ -23,17 +23,18 @@ class CitrixCTX1Decode extends Operation { this.module = "Encodings"; this.description = "Decodes strings in a Citrix CTX1 password format to plaintext."; this.infoURL = "https://www.reddit.com/r/AskNetsec/comments/1s3r6y/citrix_ctx1_hash_decoding/"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); if (input.length % 4 !== 0) { throw new OperationError("Incorrect hash length"); } diff --git a/src/core/operations/DecodeText.mjs b/src/core/operations/DecodeText.mjs index cd3ee954..489e40d3 100644 --- a/src/core/operations/DecodeText.mjs +++ b/src/core/operations/DecodeText.mjs @@ -30,7 +30,7 @@ class DecodeText extends Operation { "", ].join("\n"); this.infoURL = "https://wikipedia.org/wiki/Character_encoding"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -42,13 +42,13 @@ class DecodeText extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { const format = IO_FORMAT[args[0]]; - return cptable.utils.decode(format, input); + return cptable.utils.decode(format, new Uint8Array(input)); } } diff --git a/src/core/operations/EncodeText.mjs b/src/core/operations/EncodeText.mjs index c23906c2..8dd4d503 100644 --- a/src/core/operations/EncodeText.mjs +++ b/src/core/operations/EncodeText.mjs @@ -31,7 +31,7 @@ class EncodeText extends Operation { ].join("\n"); this.infoURL = "https://wikipedia.org/wiki/Character_encoding"; this.inputType = "string"; - this.outputType = "byteArray"; + this.outputType = "ArrayBuffer"; this.args = [ { "name": "Encoding", @@ -44,13 +44,12 @@ class EncodeText extends Operation { /** * @param {string} input * @param {Object[]} args - * @returns {byteArray} + * @returns {ArrayBuffer} */ run(input, args) { const format = IO_FORMAT[args[0]]; - let encoded = cptable.utils.encode(format, input); - encoded = Array.from(encoded); - return encoded; + const encoded = cptable.utils.encode(format, input); + return new Uint8Array(encoded).buffer; } } diff --git a/src/core/operations/Fletcher16Checksum.mjs b/src/core/operations/Fletcher16Checksum.mjs index 5be82fef..b91ec2a8 100644 --- a/src/core/operations/Fletcher16Checksum.mjs +++ b/src/core/operations/Fletcher16Checksum.mjs @@ -22,19 +22,20 @@ class Fletcher16Checksum extends Operation { this.module = "Crypto"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-16"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { let a = 0, b = 0; + input = new Uint8Array(input); for (let i = 0; i < input.length; i++) { a = (a + input[i]) % 0xff; diff --git a/src/core/operations/Fletcher32Checksum.mjs b/src/core/operations/Fletcher32Checksum.mjs index a23eace5..29c74535 100644 --- a/src/core/operations/Fletcher32Checksum.mjs +++ b/src/core/operations/Fletcher32Checksum.mjs @@ -22,19 +22,20 @@ class Fletcher32Checksum extends Operation { this.module = "Crypto"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-32"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { let a = 0, b = 0; + input = new Uint8Array(input); for (let i = 0; i < input.length; i++) { a = (a + input[i]) % 0xffff; diff --git a/src/core/operations/Fletcher64Checksum.mjs b/src/core/operations/Fletcher64Checksum.mjs index b655895d..1d0d5bd9 100644 --- a/src/core/operations/Fletcher64Checksum.mjs +++ b/src/core/operations/Fletcher64Checksum.mjs @@ -22,19 +22,20 @@ class Fletcher64Checksum extends Operation { this.module = "Crypto"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-64"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { let a = 0, b = 0; + input = new Uint8Array(input); for (let i = 0; i < input.length; i++) { a = (a + input[i]) % 0xffffffff; diff --git a/src/core/operations/Fletcher8Checksum.mjs b/src/core/operations/Fletcher8Checksum.mjs index 6159e86c..1200c00c 100644 --- a/src/core/operations/Fletcher8Checksum.mjs +++ b/src/core/operations/Fletcher8Checksum.mjs @@ -22,19 +22,20 @@ class Fletcher8Checksum extends Operation { this.module = "Crypto"; this.description = "The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques."; this.infoURL = "https://wikipedia.org/wiki/Fletcher%27s_checksum"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { let a = 0, b = 0; + input = new Uint8Array(input); for (let i = 0; i < input.length; i++) { a = (a + input[i]) % 0xf; diff --git a/src/core/operations/FromBase64.mjs b/src/core/operations/FromBase64.mjs index 7f11287b..6ee01b65 100644 --- a/src/core/operations/FromBase64.mjs +++ b/src/core/operations/FromBase64.mjs @@ -106,9 +106,9 @@ class FromBase64 extends Operation { } /** - * @param {ArrayBuffer} input + * @param {string} input * @param {Object[]} args - * @returns {string} + * @returns {byteArray} */ run(input, args) { const [alphabet, removeNonAlphChars] = args; diff --git a/src/core/operations/GenerateHOTP.mjs b/src/core/operations/GenerateHOTP.mjs index d6f03de1..b0ab5f1a 100644 --- a/src/core/operations/GenerateHOTP.mjs +++ b/src/core/operations/GenerateHOTP.mjs @@ -23,7 +23,7 @@ class GenerateHOTP extends Operation { this.module = "Default"; this.description = "The HMAC-based One-Time Password algorithm (HOTP) is an algorithm that computes a one-time password from a shared secret key and an incrementing counter. It has been adopted as Internet Engineering Task Force standard RFC 4226, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems.

Enter the secret as the input or leave it blank for a random secret to be generated."; this.infoURL = "https://wikipedia.org/wiki/HMAC-based_One-time_Password_algorithm"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -50,7 +50,7 @@ class GenerateHOTP extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ diff --git a/src/core/operations/GenerateTOTP.mjs b/src/core/operations/GenerateTOTP.mjs index 0870c98a..86fde30c 100644 --- a/src/core/operations/GenerateTOTP.mjs +++ b/src/core/operations/GenerateTOTP.mjs @@ -23,7 +23,7 @@ class GenerateTOTP extends Operation { this.module = "Default"; this.description = "The Time-based One-Time Password algorithm (TOTP) is an algorithm that computes a one-time password from a shared secret key and the current time. It has been adopted as Internet Engineering Task Force standard RFC 6238, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems. A TOTP is an HOTP where the counter is the current time.

Enter the secret as the input or leave it blank for a random secret to be generated. T0 and T1 are in seconds."; this.infoURL = "https://wikipedia.org/wiki/Time-based_One-time_Password_algorithm"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -55,7 +55,7 @@ class GenerateTOTP extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ diff --git a/src/core/operations/NOT.mjs b/src/core/operations/NOT.mjs index 7fa3710e..46fc1b8c 100644 --- a/src/core/operations/NOT.mjs +++ b/src/core/operations/NOT.mjs @@ -22,17 +22,18 @@ class NOT extends Operation { this.module = "Default"; this.description = "Returns the inverse of each byte."; this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#NOT"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "byteArray"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {byteArray} */ run(input, args) { + input = new Uint8Array(input); return bitOp(input, null, not); } diff --git a/src/core/operations/OR.mjs b/src/core/operations/OR.mjs index 5f07f08d..183fb1fe 100644 --- a/src/core/operations/OR.mjs +++ b/src/core/operations/OR.mjs @@ -23,7 +23,7 @@ class OR extends Operation { this.module = "Default"; this.description = "OR the input with the given key.
e.g. fe023da5"; this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#OR"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "byteArray"; this.args = [ { @@ -36,12 +36,13 @@ class OR extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {byteArray} */ run(input, args) { const key = Utils.convertToByteArray(args[0].string || "", args[0].option); + input = new Uint8Array(input); return bitOp(input, key, or); } diff --git a/src/core/operations/ParseTLV.mjs b/src/core/operations/ParseTLV.mjs index 7118b563..d4c4e11c 100644 --- a/src/core/operations/ParseTLV.mjs +++ b/src/core/operations/ParseTLV.mjs @@ -24,7 +24,7 @@ class ParseTLV extends Operation { this.module = "Default"; this.description = "Converts a Type-Length-Value (TLV) encoded string into a JSON object. Can optionally include a Key / Type entry.

Tags: Key-Length-Value, KLV, Length-Value, LV"; this.infoURL = "https://wikipedia.org/wiki/Type-length-value"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "JSON"; this.args = [ { @@ -46,12 +46,13 @@ class ParseTLV extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { const [bytesInKey, bytesInLength, basicEncodingRules] = args; + input = new Uint8Array(input); if (bytesInKey <= 0 && bytesInLength <= 0) throw new OperationError("Type or Length size must be greater than 0"); diff --git a/src/core/operations/ProtobufDecode.mjs b/src/core/operations/ProtobufDecode.mjs index 9c0cfadc..8470bdb7 100644 --- a/src/core/operations/ProtobufDecode.mjs +++ b/src/core/operations/ProtobufDecode.mjs @@ -23,17 +23,18 @@ class ProtobufDecode extends Operation { this.module = "Default"; this.description = "Decodes any Protobuf encoded data to a JSON representation of the data using the field number as the field key."; this.infoURL = "https://wikipedia.org/wiki/Protocol_Buffers"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "JSON"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {JSON} */ run(input, args) { + input = new Uint8Array(input); try { return Protobuf.decode(input); } catch (err) { diff --git a/src/core/operations/RemoveEXIF.mjs b/src/core/operations/RemoveEXIF.mjs index 3ea6c62f..fff4f6b5 100644 --- a/src/core/operations/RemoveEXIF.mjs +++ b/src/core/operations/RemoveEXIF.mjs @@ -27,17 +27,18 @@ class RemoveEXIF extends Operation { "EXIF data embedded in photos usually contains information about the image file itself as well as the device used to create it.", ].join("\n"); this.infoURL = "https://wikipedia.org/wiki/Exif"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "byteArray"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {byteArray} */ run(input, args) { + input = new Uint8Array(input); // Do nothing if input is empty if (input.length === 0) return input; diff --git a/src/core/operations/RemoveNullBytes.mjs b/src/core/operations/RemoveNullBytes.mjs index 6b190710..b633e82d 100644 --- a/src/core/operations/RemoveNullBytes.mjs +++ b/src/core/operations/RemoveNullBytes.mjs @@ -20,17 +20,18 @@ class RemoveNullBytes extends Operation { this.name = "Remove null bytes"; this.module = "Default"; this.description = "Removes all null bytes (0x00) from the input."; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "byteArray"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {byteArray} */ run(input, args) { + input = new Uint8Array(input); const output = []; for (let i = 0; i < input.length; i++) { if (input[i] !== 0) output.push(input[i]); diff --git a/src/core/operations/SplitColourChannels.mjs b/src/core/operations/SplitColourChannels.mjs index 558fdd58..e8d23ff0 100644 --- a/src/core/operations/SplitColourChannels.mjs +++ b/src/core/operations/SplitColourChannels.mjs @@ -26,18 +26,19 @@ class SplitColourChannels extends Operation { this.module = "Image"; this.description = "Splits the given image into its red, green and blue colour channels."; this.infoURL = "https://wikipedia.org/wiki/Channel_(digital_image)"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "List"; this.presentType = "html"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {List} */ async run(input, args) { + input = new Uint8Array(input); // Make sure that the input is an image if (!isImage(input)) throw new OperationError("Invalid file type."); diff --git a/src/core/operations/TCPIPChecksum.mjs b/src/core/operations/TCPIPChecksum.mjs index 03af77a8..0e5c6c60 100644 --- a/src/core/operations/TCPIPChecksum.mjs +++ b/src/core/operations/TCPIPChecksum.mjs @@ -22,17 +22,18 @@ class TCPIPChecksum extends Operation { this.module = "Crypto"; this.description = "Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes."; this.infoURL = "https://wikipedia.org/wiki/IPv4_header_checksum"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); let csum = 0; for (let i = 0; i < input.length; i++) { diff --git a/src/core/operations/Tar.mjs b/src/core/operations/Tar.mjs index 063e73cf..3078d959 100644 --- a/src/core/operations/Tar.mjs +++ b/src/core/operations/Tar.mjs @@ -22,7 +22,7 @@ class Tar extends Operation { this.module = "Compression"; this.description = "Packs the input into a tarball.

No support for multiple files at this time."; this.infoURL = "https://wikipedia.org/wiki/Tar_(computing)"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "File"; this.args = [ { @@ -34,11 +34,13 @@ class Tar extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {byteArray} */ run(input, args) { + input = new Uint8Array(input); + const Tarball = function() { this.bytes = new Array(512); this.position = 0; diff --git a/src/core/operations/ToBase32.mjs b/src/core/operations/ToBase32.mjs index c5a4fb59..fd36f550 100644 --- a/src/core/operations/ToBase32.mjs +++ b/src/core/operations/ToBase32.mjs @@ -22,7 +22,7 @@ class ToBase32 extends Operation { this.module = "Default"; this.description = "Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7."; this.infoURL = "https://wikipedia.org/wiki/Base32"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -34,12 +34,13 @@ class ToBase32 extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { if (!input) return ""; + input = new Uint8Array(input); const alphabet = args[0] ? Utils.expandAlphRange(args[0]).join("") : "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="; let output = "", diff --git a/src/core/operations/ToBase58.mjs b/src/core/operations/ToBase58.mjs index 0f04a778..5353c40e 100644 --- a/src/core/operations/ToBase58.mjs +++ b/src/core/operations/ToBase58.mjs @@ -24,7 +24,7 @@ class ToBase58 extends Operation { this.module = "Default"; this.description = "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.

This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).

e.g. hello world becomes StV1DL6CwTryKyV

Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc)."; this.infoURL = "https://wikipedia.org/wiki/Base58"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -36,11 +36,12 @@ class ToBase58 extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); let alphabet = args[0] || ALPHABET_OPTIONS[0].value, result = [0]; diff --git a/src/core/operations/ToBase62.mjs b/src/core/operations/ToBase62.mjs index 1f4a8732..c5d2f35e 100644 --- a/src/core/operations/ToBase62.mjs +++ b/src/core/operations/ToBase62.mjs @@ -24,7 +24,7 @@ class ToBase62 extends Operation { this.module = "Default"; this.description = "Base62 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system."; this.infoURL = "https://wikipedia.org/wiki/List_of_numeral_systems"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -36,11 +36,12 @@ class ToBase62 extends Operation { } /** - * @param {string} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); if (input.length < 1) return ""; const ALPHABET = Utils.expandAlphRange(args[0]).join(""); diff --git a/src/core/operations/ToBase85.mjs b/src/core/operations/ToBase85.mjs index 989d2788..839ef1e4 100644 --- a/src/core/operations/ToBase85.mjs +++ b/src/core/operations/ToBase85.mjs @@ -24,7 +24,7 @@ class ToBase85 extends Operation { this.module = "Default"; this.description = "Base85 (also called Ascii85) is a notation for encoding arbitrary byte data. It is usually more efficient that Base64.

This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).

e.g. hello world becomes BOu!rD]j7BEbo7

Base85 is commonly used in Adobe's PostScript and PDF file formats.

Options
Alphabet
  • Standard - The standard alphabet, referred to as Ascii85
  • Z85 (ZeroMQ) - A string-safe variant of Base85, which avoids quote marks and backslash characters
  • IPv6 - A variant of Base85 suitable for encoding IPv6 addresses (RFC 1924)
Include delimiter
Adds a '<~' and '~>' delimiter to the start and end of the data. This is standard for Adobe's implementation of Base85."; this.infoURL = "https://wikipedia.org/wiki/Ascii85"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -41,11 +41,12 @@ class ToBase85 extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); const alphabet = Utils.expandAlphRange(args[0]).join(""), encoding = alphabetName(alphabet), includeDelim = args[1]; diff --git a/src/core/operations/ToBinary.mjs b/src/core/operations/ToBinary.mjs index 97622d35..95d004b0 100644 --- a/src/core/operations/ToBinary.mjs +++ b/src/core/operations/ToBinary.mjs @@ -24,7 +24,7 @@ class ToBinary extends Operation { this.module = "Default"; this.description = "Displays the input data as a binary string.

e.g. Hi becomes 01001000 01101001"; this.infoURL = "https://wikipedia.org/wiki/Binary_code"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -36,11 +36,12 @@ class ToBinary extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); return toBinary(input, args[0]); } diff --git a/src/core/operations/ToDecimal.mjs b/src/core/operations/ToDecimal.mjs index 34b88bc4..65798a7c 100644 --- a/src/core/operations/ToDecimal.mjs +++ b/src/core/operations/ToDecimal.mjs @@ -23,7 +23,7 @@ class ToDecimal extends Operation { this.name = "To Decimal"; this.module = "Default"; this.description = "Converts the input data to an ordinal integer array.

e.g. Hello becomes 72 101 108 108 111"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -40,11 +40,12 @@ class ToDecimal extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); const delim = Utils.charRep(args[0]), signed = args[1]; if (signed) { diff --git a/src/core/operations/ToHexContent.mjs b/src/core/operations/ToHexContent.mjs index d2e05b45..9af09f24 100644 --- a/src/core/operations/ToHexContent.mjs +++ b/src/core/operations/ToHexContent.mjs @@ -23,7 +23,7 @@ class ToHexContent extends Operation { this.module = "Default"; this.description = "Converts special characters in a string to hexadecimal. This format is used by SNORT for representing hex within ASCII text.

e.g. foo=bar becomes foo|3d|bar."; this.infoURL = "http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node32.html#SECTION00451000000000000000"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -40,11 +40,12 @@ class ToHexContent extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); const convert = args[0]; const spaces = args[1]; if (convert === "All chars") { diff --git a/src/core/operations/ToQuotedPrintable.mjs b/src/core/operations/ToQuotedPrintable.mjs index 36dddcba..e26f3c67 100644 --- a/src/core/operations/ToQuotedPrintable.mjs +++ b/src/core/operations/ToQuotedPrintable.mjs @@ -25,17 +25,18 @@ class ToQuotedPrintable extends Operation { this.module = "Default"; this.description = "Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length."; this.infoURL = "https://wikipedia.org/wiki/Quoted-printable"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = []; } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); let mimeEncodedStr = this.mimeEncode(input); // fix line breaks @@ -73,7 +74,7 @@ class ToQuotedPrintable extends Operation { /** * Encodes mime data. * - * @param {byteArray} buffer + * @param {byteArray|Uint8Array} buffer * @returns {string} */ mimeEncode(buffer) { diff --git a/src/core/operations/Untar.mjs b/src/core/operations/Untar.mjs index c986b451..78a469ce 100644 --- a/src/core/operations/Untar.mjs +++ b/src/core/operations/Untar.mjs @@ -23,7 +23,7 @@ class Untar extends Operation { this.module = "Compression"; this.description = "Unpacks a tarball and displays it per file."; this.infoURL = "https://wikipedia.org/wiki/Tar_(computing)"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "List"; this.presentType = "html"; this.args = []; @@ -37,11 +37,12 @@ class Untar extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {List} */ run(input, args) { + input = new Uint8Array(input); const stream = new Stream(input), files = []; diff --git a/src/core/operations/XOR.mjs b/src/core/operations/XOR.mjs index 50150a39..aa228842 100644 --- a/src/core/operations/XOR.mjs +++ b/src/core/operations/XOR.mjs @@ -23,7 +23,7 @@ class XOR extends Operation { this.module = "Default"; this.description = "XOR the input with the given key.
e.g. fe023da5

Options
Null preserving: If the current byte is 0x00 or the same as the key, skip it.

Scheme:
  • Standard - key is unchanged after each round
  • Input differential - key is set to the value of the previous unprocessed byte
  • Output differential - key is set to the value of the previous processed byte
  • Cascade - key is set to the input byte shifted by one
"; this.infoURL = "https://wikipedia.org/wiki/XOR"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "byteArray"; this.args = [ { @@ -46,11 +46,12 @@ class XOR extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {byteArray} */ run(input, args) { + input = new Uint8Array(input); const key = Utils.convertToByteArray(args[0].string || "", args[0].option), [, scheme, nullPreserving] = args; diff --git a/src/core/operations/XORBruteForce.mjs b/src/core/operations/XORBruteForce.mjs index a4d91e29..9b548df8 100644 --- a/src/core/operations/XORBruteForce.mjs +++ b/src/core/operations/XORBruteForce.mjs @@ -25,7 +25,7 @@ class XORBruteForce extends Operation { this.module = "Default"; this.description = "Enumerate all possible XOR solutions. Current maximum key length is 2 due to browser performance.

Optionally enter a string that you expect to find in the plaintext to filter results (crib)."; this.infoURL = "https://wikipedia.org/wiki/Exclusive_or"; - this.inputType = "byteArray"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -72,11 +72,12 @@ class XORBruteForce extends Operation { } /** - * @param {byteArray} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ run(input, args) { + input = new Uint8Array(input); const [ keyLength, sampleLength, From 2ffd2c6b7a2a604ad423b79e6a87665668c0a475 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 29 Jul 2019 17:09:52 +0100 Subject: [PATCH 19/39] 9.0.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 682c1658..febdc74b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.3", + "version": "9.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 69de9d62..2212c50a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.3", + "version": "9.0.4", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 8548d39318511fd50bdf21234c51329610475ca4 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Fri, 2 Aug 2019 11:10:15 +0100 Subject: [PATCH 20/39] add node consumer tests to travis --- .travis.yml | 1 + Gruntfile.js | 46 +++++++++- package-lock.json | 84 +++++++++---------- package.json | 4 +- tests/node/consumers/cjs-consumer.js | 29 +++++++ tests/node/consumers/esm-consumer.mjs | 28 +++++++ .../consumers/esm-deep-import-consumer.mjs | 28 +++++++ 7 files changed, 174 insertions(+), 46 deletions(-) create mode 100644 tests/node/consumers/cjs-consumer.js create mode 100644 tests/node/consumers/esm-consumer.mjs create mode 100644 tests/node/consumers/esm-deep-import-consumer.mjs diff --git a/.travis.yml b/.travis.yml index c1929a9d..e99e3903 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ script: - grunt docs - grunt prod --msg="$COMPILE_MSG" - xvfb-run --server-args="-screen 0 1200x800x24" grunt testui + - grunt testnodeconsumer before_deploy: - grunt exec:sitemap - grunt copy:ghPages diff --git a/Gruntfile.js b/Gruntfile.js index df68bee4..e228d785 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,6 +48,10 @@ module.exports = function (grunt) { "A task which runs all the UI tests in the tests directory. The prod task must already have been run.", ["connect:prod", "exec:browserTests"]); + grunt.registerTask("testnodeconsumer", + "A task which checks whether consuming CJS and ESM apps work with the CyberChef build", + ["exec:setupNodeConsumers", "exec:testCJSNodeConsumer", "exec:testESMNodeConsumer", "exec:testESMDeepImportNodeConsumer", "exec:teardownNodeConsumers"]); + grunt.registerTask("docs", "Compiles documentation in the /docs directory.", ["clean:docs", "jsdoc", "chmod:docs"]); @@ -87,7 +91,8 @@ module.exports = function (grunt) { COMPILE_MSG: JSON.stringify(grunt.option("compile-msg") || grunt.option("msg") || ""), PKG_VERSION: JSON.stringify(pkg.version), }, - moduleEntryPoints = listEntryModules(); + moduleEntryPoints = listEntryModules(), + nodeConsumerTestPath = "~/tmp-cyberchef"; /** @@ -385,7 +390,44 @@ module.exports = function (grunt) { }, nodeTests: { command: "node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs" - } + }, + setupNodeConsumers: { + command: [ + "echo '\n--- Testing node conumers ---'", + "npm link", + `mkdir ${nodeConsumerTestPath}`, + `cp tests/node/consumers/* ${nodeConsumerTestPath}`, + `cd ${nodeConsumerTestPath}`, + "npm link cyberchef" + ].join(";"), + }, + teardownNodeConsumers: { + command: [ + `rm -rf ${nodeConsumerTestPath}`, + "echo '\n--- Node consumer tests complete ---'" + ].join(";"), + }, + testCJSNodeConsumer: { + command: [ + `cd ${nodeConsumerTestPath}`, + "node --no-warnings cjs-consumer.js", + ].join(";"), + stdout: false, + }, + testESMNodeConsumer: { + command: [ + `cd ${nodeConsumerTestPath}`, + "node --no-warnings --experimental-modules esm-consumer.mjs", + ].join(";"), + stdout: false, + }, + testESMDeepImportNodeConsumer: { + command: [ + `cd ${nodeConsumerTestPath}`, + "node --no-warnings --experimental-modules esm-deep-import-consumer.mjs", + ].join(";"), + stdout: false, + }, }, }); }; diff --git a/package-lock.json b/package-lock.json index ca59a9cf..8dc3cf36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3146,15 +3146,6 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, - "catharsis": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.10.tgz", - "integrity": "sha512-l2OUaz/3PU3MZylspVFJvwHCVfWyvcduPq4lv3AzZ2pJzZCo7kNKFNyatwujD7XgvGkNAE/Jhhbh2uARNwNkfw==", - "dev": true, - "requires": { - "lodash": "^4.17.11" - } - }, "chai-nightwatch": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/chai-nightwatch/-/chai-nightwatch-0.3.0.tgz", @@ -8529,27 +8520,36 @@ } }, "jsdoc": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.2.tgz", - "integrity": "sha512-S2vzg99C5+gb7FWlrK4TVdyzVPGGkdvpDkCEJH1JABi2PKzPeLu5/zZffcJUifgWUJqXWl41Hoc+MmuM2GukIg==", + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.3.tgz", + "integrity": "sha512-Yf1ZKA3r9nvtMWHO1kEuMZTlHOF8uoQ0vyo5eH7SQy5YeIiHM+B0DgKnn+X6y6KDYZcF7G2SPkKF+JORCXWE/A==", "dev": true, "requires": { "@babel/parser": "^7.4.4", "bluebird": "^3.5.4", - "catharsis": "^0.8.10", + "catharsis": "^0.8.11", "escape-string-regexp": "^2.0.0", "js2xmlparser": "^4.0.0", "klaw": "^3.0.0", "markdown-it": "^8.4.2", "markdown-it-anchor": "^5.0.2", - "marked": "^0.6.2", + "marked": "^0.7.0", "mkdirp": "^0.5.1", - "requizzle": "^0.2.2", + "requizzle": "^0.2.3", "strip-json-comments": "^3.0.1", "taffydb": "2.6.2", "underscore": "~1.9.1" }, "dependencies": { + "catharsis": { + "version": "0.8.11", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.11.tgz", + "integrity": "sha512-a+xUyMV7hD1BrDQA/3iPV7oc+6W26BgVJO05PGEoatMyIuPScQKsde6i3YorWX1qs+AZjnJ18NqdKoCtKiNh1g==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + }, "escape-string-regexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", @@ -8565,6 +8565,21 @@ "graceful-fs": "^4.1.9" } }, + "marked": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", + "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", + "dev": true + }, + "requizzle": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz", + "integrity": "sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + }, "strip-json-comments": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", @@ -8994,9 +9009,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash._arraycopy": { "version": "3.0.0", @@ -9088,9 +9103,9 @@ "dev": true }, "lodash.defaultsdeep": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.0.tgz", - "integrity": "sha1-vsECT4WxvZbL6kBbI8FK1kQ6b4E=", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", + "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", "dev": true }, "lodash.escaperegexp": { @@ -9159,15 +9174,15 @@ } }, "lodash.merge": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", - "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, "lodash.mergewith": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", - "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", "dev": true }, "lodash.once": { @@ -9309,12 +9324,6 @@ "integrity": "sha512-n8zCGjxA3T+Mx1pG8HEgbJbkB8JFUuRkeTZQuIM8iPY6oQ8sWOPRZJDFC9a/pNg2QkHEjjGkhBEl/RSyzaDZ3A==", "dev": true }, - "marked": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.2.tgz", - "integrity": "sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA==", - "dev": true - }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -11976,15 +11985,6 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, - "requizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.2.tgz", - "integrity": "sha512-oJ6y7JcUJkblRGhMByGNcszeLgU0qDxNKFCiUZR1XyzHyVsev+Mxb1tyygxLd1ORsKee1SA5BInFdUwY64GE/A==", - "dev": true, - "requires": { - "lodash": "^4.17.11" - } - }, "resolve": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", diff --git a/package.json b/package.json index bb5d5833..0c964b6c 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "kbpgp": "2.1.2", "libbzip2-wasm": "0.0.4", "libyara-wasm": "0.0.12", - "lodash": "^4.17.11", + "lodash": "^4.17.15", "loglevel": "^1.6.3", "loglevel-message-prefix": "^3.0.0", "moment": "^2.24.0", @@ -159,7 +159,7 @@ "build": "grunt prod", "repl": "node src/node/repl.js", "test": "grunt test", - "test-node": "grunt test-node", + "test-node-consumer": "grunt testnodeconsumer", "testui": "grunt testui", "docs": "grunt docs", "lint": "grunt lint", diff --git a/tests/node/consumers/cjs-consumer.js b/tests/node/consumers/cjs-consumer.js new file mode 100644 index 00000000..16232312 --- /dev/null +++ b/tests/node/consumers/cjs-consumer.js @@ -0,0 +1,29 @@ +/** + * Tests to ensure that a consuming app can use CJS require + * + * @author d98762625 [d98762625@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +const chef = require("cyberchef"); +const assert = require("assert"); + +const d = chef.bake("Testing, 1 2 3", [ + chef.toHex, + chef.reverse, + { + op: chef.unique, + args: { + delimiter: "Space", + } + }, + { + op: chef.multiply, + args: { + delimiter: "Space", + } + } +]); + +assert.equal(d.value, "630957449041920"); diff --git a/tests/node/consumers/esm-consumer.mjs b/tests/node/consumers/esm-consumer.mjs new file mode 100644 index 00000000..3536ef00 --- /dev/null +++ b/tests/node/consumers/esm-consumer.mjs @@ -0,0 +1,28 @@ +/** + * Tests to ensure that a consuming app can use ESM imports + * + * @author d98762625 [d98762625@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ +import assert from "assert"; +import chef from "cyberchef"; + +const d = chef.bake("Testing, 1 2 3", [ + chef.toHex, + chef.reverse, + { + op: chef.unique, + args: { + delimiter: "Space", + } + }, + { + op: chef.multiply, + args: { + delimiter: "Space", + } + } +]); + +assert.equal(d.value, "630957449041920"); diff --git a/tests/node/consumers/esm-deep-import-consumer.mjs b/tests/node/consumers/esm-deep-import-consumer.mjs new file mode 100644 index 00000000..58fd921a --- /dev/null +++ b/tests/node/consumers/esm-deep-import-consumer.mjs @@ -0,0 +1,28 @@ +/** + * Tests to ensure that a consuming app can use named imports from deep import patch + * + * @author d98762625 [d98762625@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ +import assert from "assert"; +import { bake, toHex, reverse, unique, multiply } from "cyberchef/src/node/index.mjs"; + +const d = bake("Testing, 1 2 3", [ + toHex, + reverse, + { + op: unique, + args: { + delimiter: "Space", + } + }, + { + op: multiply, + args: { + delimiter: "Space", + } + } +]); + +assert.equal(d.value, "630957449041920"); From 780eecf35bd7c2c7b354f0a4e05403116d19d8d8 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Fri, 2 Aug 2019 14:36:40 +0100 Subject: [PATCH 21/39] update readme with Node.js compatibility --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4029fc23..299b5d87 100755 --- a/README.md +++ b/README.md @@ -81,6 +81,10 @@ CyberChef is built to support - Mozilla Firefox 35+ - Microsoft Edge 14+ +## Node.js support + +CyberChef is built to fully support Node.js `v10` and partially supports `v12`. Named imports using a deep import specifier does not work in `v12`. For more information, see the Node API page in the project [wiki pages](https://github.com/gchq/CyberChef/wiki) + ## Contributing From cdb30d86b00a921202e4dc57fd2e4d15cce6f511 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 12 Aug 2019 15:27:45 +0100 Subject: [PATCH 22/39] 9.0.5 --- 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 bce927f1..5e31acdd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.4", + "version": "9.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 47d353ee..cece0e40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.4", + "version": "9.0.5", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 863675e63643fb5338c254d0e93a09cf9d479d3b Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 13 Aug 2019 13:37:21 +0100 Subject: [PATCH 23/39] Update nodeApi test. 'base 64' now returns 11 results as the SSH host key module mentions it --- tests/node/tests/nodeApi.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/node/tests/nodeApi.mjs b/tests/node/tests/nodeApi.mjs index e775f3a0..954a19ce 100644 --- a/tests/node/tests/nodeApi.mjs +++ b/tests/node/tests/nodeApi.mjs @@ -136,7 +136,7 @@ TestRegister.addApiTests([ it("chef.help: returns multiple results", () => { const result = chef.help("base 64"); - assert.strictEqual(result.length, 10); + assert.strictEqual(result.length, 11); }), it("chef.help: looks in description for matches too", () => { From 4bc4db82329958f3d5c2bd94266a4a630fb6355b Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 13 Aug 2019 13:39:21 +0100 Subject: [PATCH 24/39] Fix incorrect import of TestRegister --- tests/operations/tests/ParseSSHHostKey.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/operations/tests/ParseSSHHostKey.mjs b/tests/operations/tests/ParseSSHHostKey.mjs index d6668e40..00e13c6c 100644 --- a/tests/operations/tests/ParseSSHHostKey.mjs +++ b/tests/operations/tests/ParseSSHHostKey.mjs @@ -5,7 +5,7 @@ * @copyright Crown Copyright 2019 * @license Apache-2.0 */ -import TestRegister from "../TestRegister"; +import TestRegister from "../../lib/TestRegister.mjs"; TestRegister.addTests([ { From 91cdd50ba753131265da6350204ea9949f3c6d49 Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 13 Aug 2019 14:03:21 +0100 Subject: [PATCH 25/39] Increase size limit for inlined fonts / icons --- webpack.config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 46878282..1258a5c4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -103,11 +103,17 @@ module.exports = { "sass-loader", ] }, + /** + * The limit for these files has been increased to 60,000 (60KB) + * to ensure the material icons font is inlined. + * + * See: https://github.com/gchq/CyberChef/issues/612 + */ { test: /\.(ico|eot|ttf|woff|woff2)$/, loader: "url-loader", options: { - limit: 10000, + limit: 60000, name: "[hash].[ext]", outputPath: "assets" } From d90a23bfd5ed2c0cb6cc43930fb089899eb5b8ea Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 13 Aug 2019 14:11:52 +0100 Subject: [PATCH 26/39] Added 'Parse SSH Host Key' operation to the Networking category --- src/core/config/Categories.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index f590b02c..d9305639 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -167,6 +167,7 @@ "Parse IP range", "Parse IPv6 address", "Parse IPv4 header", + "Parse SSH Host Key", "Parse URI", "URL Encode", "URL Decode", From 6b9e93e3108335f3705d39a96d726a0a8230beeb Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 13 Aug 2019 14:13:59 +0100 Subject: [PATCH 27/39] Updated CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb1a807..23e25f39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master). +### [9.1.0] - 2019-08-13 +- 'Parse SSH Host Key' operation added [@j433866] | [#595] + ## [9.0.0] - 2019-07-09 - [Multiple inputs](https://github.com/gchq/CyberChef/wiki/Multiple-Inputs) are now supported in the main web UI, allowing you to upload and process multiple files at once [@j433866] | [#566] - A [Node.js API](https://github.com/gchq/CyberChef/wiki/Node-API) has been implemented, meaning that CyberChef can now be used as a library, either to provide specific operations, or an entire baking environment [@d98762625] | [#291] @@ -158,6 +161,7 @@ All major and minor version changes will be documented in this file. Details of +[9.1.0]: https://github.com/gchq/CyberChef/releases/tag/v9.1.0 [9.0.0]: https://github.com/gchq/CyberChef/releases/tag/v9.0.0 [8.38.0]: https://github.com/gchq/CyberChef/releases/tag/v8.38.0 [8.37.0]: https://github.com/gchq/CyberChef/releases/tag/v8.37.0 @@ -279,3 +283,4 @@ All major and minor version changes will be documented in this file. Details of [#571]: https://github.com/gchq/CyberChef/pull/571 [#585]: https://github.com/gchq/CyberChef/pull/585 [#591]: https://github.com/gchq/CyberChef/pull/591 +[#595]: https://github.com/gchq/CyberChef/pull/595 From 43472394c79025bb5cc96c1ea3873bb87ffd7577 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 13 Aug 2019 14:23:41 +0100 Subject: [PATCH 28/39] Tidied up 'Defang IP Addresses' operation --- src/core/config/Categories.json | 2 +- .../{DefangIP.mjs => DefangIPAddresses.mjs} | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) rename src/core/operations/{DefangIP.mjs => DefangIPAddresses.mjs} (80%) diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 44ec9b78..f1a7b815 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -180,7 +180,7 @@ "Encode NetBIOS Name", "Decode NetBIOS Name", "Defang URL", - "Defang IP" + "Defang IP Addresses" ] }, { diff --git a/src/core/operations/DefangIP.mjs b/src/core/operations/DefangIPAddresses.mjs similarity index 80% rename from src/core/operations/DefangIP.mjs rename to src/core/operations/DefangIPAddresses.mjs index 03bfc6da..74e03500 100644 --- a/src/core/operations/DefangIP.mjs +++ b/src/core/operations/DefangIPAddresses.mjs @@ -8,19 +8,19 @@ import Operation from "../Operation"; /** - * Defang IP operation + * Defang IP Addresses operation */ -class DefangIP extends Operation { +class DefangIPAddresses extends Operation { /** - * DefangIP constructor + * DefangIPAddresses constructor */ constructor() { super(); - this.name = "Defang IP"; + this.name = "Defang IP Addresses"; this.module = "Default"; - this.description = "Takes a IPV4 or IPV6 address and 'Defangs' it; meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address."; + this.description = "Takes a IPv4 or IPv6 address and 'Defangs' it, meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address."; this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/"; this.inputType = "string"; this.outputType = "string"; @@ -34,13 +34,10 @@ class DefangIP extends Operation { * @returns {string} */ run(input, args) { - - input = input.replace(IPV4_REGEX, x => { return x.replace(/\./g, "[.]"); }); - input = input.replace(IPV6_REGEX, x => { return x.replace(/:/g, "[:]"); }); @@ -49,7 +46,7 @@ class DefangIP extends Operation { } } -export default DefangIP; +export default DefangIPAddresses; /** From ec70d8a3a2b3045f32835776eaedbb320dc1ab13 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 13 Aug 2019 14:25:36 +0100 Subject: [PATCH 29/39] Updated CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e25f39..a19eec80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master). +### [9.2.0] - 2019-08-13 +- 'Defang IP Addresses' operation added [@h345983745] | [#556] + ### [9.1.0] - 2019-08-13 - 'Parse SSH Host Key' operation added [@j433866] | [#595] @@ -161,6 +164,7 @@ All major and minor version changes will be documented in this file. Details of +[9.2.0]: https://github.com/gchq/CyberChef/releases/tag/v9.2.0 [9.1.0]: https://github.com/gchq/CyberChef/releases/tag/v9.1.0 [9.0.0]: https://github.com/gchq/CyberChef/releases/tag/v9.0.0 [8.38.0]: https://github.com/gchq/CyberChef/releases/tag/v8.38.0 @@ -279,6 +283,7 @@ All major and minor version changes will be documented in this file. Details of [#531]: https://github.com/gchq/CyberChef/pull/531 [#533]: https://github.com/gchq/CyberChef/pull/533 [#535]: https://github.com/gchq/CyberChef/pull/535 +[#556]: https://github.com/gchq/CyberChef/pull/556 [#566]: https://github.com/gchq/CyberChef/pull/566 [#571]: https://github.com/gchq/CyberChef/pull/571 [#585]: https://github.com/gchq/CyberChef/pull/585 From e2c7d8c6785b7f45378a64e14de29c583707ff7d Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 13 Aug 2019 16:03:52 +0100 Subject: [PATCH 30/39] Increase size limit for inlined fonts / icons --- webpack.config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 46878282..1258a5c4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -103,11 +103,17 @@ module.exports = { "sass-loader", ] }, + /** + * The limit for these files has been increased to 60,000 (60KB) + * to ensure the material icons font is inlined. + * + * See: https://github.com/gchq/CyberChef/issues/612 + */ { test: /\.(ico|eot|ttf|woff|woff2)$/, loader: "url-loader", options: { - limit: 10000, + limit: 60000, name: "[hash].[ext]", outputPath: "assets" } From 59864e37811cc3dda1948c2b2e1247ddc6a23f10 Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 13 Aug 2019 16:45:53 +0100 Subject: [PATCH 31/39] Fix Defang IP tests causing the tests to fail --- tests/operations/tests/DefangIP.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/operations/tests/DefangIP.mjs b/tests/operations/tests/DefangIP.mjs index 7c3ce1e8..60005c54 100644 --- a/tests/operations/tests/DefangIP.mjs +++ b/tests/operations/tests/DefangIP.mjs @@ -6,7 +6,7 @@ * @copyright Crown Copyright 2019 * @license Apache-2.0 */ -import TestRegister from "../TestRegister"; +import TestRegister from "../../lib/TestRegister.mjs"; TestRegister.addTests([ { @@ -15,7 +15,7 @@ TestRegister.addTests([ expectedOutput: "192[.]168[.]1[.]1", recipeConfig: [ { - op: "Defang IP", + op: "Defang IP Addresses", args: [], }, ], @@ -25,7 +25,7 @@ TestRegister.addTests([ expectedOutput: "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343", recipeConfig: [ { - op: "Defang IP", + op: "Defang IP Addresses", args: [], }, ], @@ -35,7 +35,7 @@ TestRegister.addTests([ expectedOutput: "2001[:]db8[:]3c4d[:]15[:][:]1a2f[:]1a2b", recipeConfig: [ { - op: "Defang IP", + op: "Defang IP Addresses", args: [], }, ], From 1fb6bffe1c50ebebeefd5426ed5f4e7a9e15947f Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 13 Aug 2019 16:46:17 +0100 Subject: [PATCH 32/39] 9.0.6 --- 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 5e31acdd..b79260b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.5", + "version": "9.0.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cece0e40..99819c8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "9.0.5", + "version": "9.0.6", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From ae1cd8ba3e52ab5bdfc5eaeb2f85e681b85a0301 Mon Sep 17 00:00:00 2001 From: j433866 Date: Thu, 15 Aug 2019 15:03:13 +0100 Subject: [PATCH 33/39] Add fade animation to modals --- src/web/html/index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/web/html/index.html b/src/web/html/index.html index 7fcb7415..011742d3 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -382,7 +382,7 @@ -