cyberchef 9.46.6 → 9.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,9 @@ All major and minor version changes will be documented in this file. Details of
13
13
 
14
14
  ## Details
15
15
 
16
+ ### [9.47.0] - 2022-10-14
17
+ - Added 'LZMA Decompress' and 'LZMA Compress' operations [@mattnotmitt] | [#1421]
18
+
16
19
  ### [9.46.0] - 2022-07-08
17
20
  - Added 'Cetacean Cipher Encode' and 'Cetacean Cipher Decode' operations [@valdelaseras] | [#1308]
18
21
 
@@ -315,6 +318,7 @@ All major and minor version changes will be documented in this file. Details of
315
318
 
316
319
 
317
320
 
321
+ [9.47.0]: https://github.com/gchq/CyberChef/releases/tag/v9.47.0
318
322
  [9.46.0]: https://github.com/gchq/CyberChef/releases/tag/v9.46.0
319
323
  [9.45.0]: https://github.com/gchq/CyberChef/releases/tag/v9.45.0
320
324
  [9.44.0]: https://github.com/gchq/CyberChef/releases/tag/v9.44.0
@@ -552,4 +556,5 @@ All major and minor version changes will be documented in this file. Details of
552
556
  [#1266]: https://github.com/gchq/CyberChef/pull/1266
553
557
  [#1250]: https://github.com/gchq/CyberChef/pull/1250
554
558
  [#1308]: https://github.com/gchq/CyberChef/pull/1308
559
+ [#1421]: https://github.com/gchq/CyberChef/pull/1421
555
560
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberchef",
3
- "version": "9.46.6",
3
+ "version": "9.47.0",
4
4
  "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
5
5
  "author": "n1474335 <n1474335@gmail.com>",
6
6
  "homepage": "https://gchq.github.io/CyberChef",
@@ -87,6 +87,7 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@babel/polyfill": "^7.12.1",
90
+ "@blu3r4y/lzma": "^2.3.3",
90
91
  "arrive": "^2.4.1",
91
92
  "avsc": "^5.7.4",
92
93
  "bcryptjs": "^2.4.3",
@@ -330,8 +330,10 @@
330
330
  "Bzip2 Compress",
331
331
  "Tar",
332
332
  "Untar",
333
+ "LZString Decompress",
333
334
  "LZString Compress",
334
- "LZString Decompress"
335
+ "LZMA Decompress",
336
+ "LZMA Compress"
335
337
  ]
336
338
  },
337
339
  {
@@ -8013,6 +8013,43 @@
8013
8013
  }
8014
8014
  ]
8015
8015
  },
8016
+ "LZMA Compress": {
8017
+ "module": "Compression",
8018
+ "description": "Compresses data using the Lempel–Ziv–Markov chain algorithm. Compression mode determines the speed and effectiveness of the compression: 1 is fastest and less effective, 9 is slowest and most effective",
8019
+ "infoURL": "https://wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm",
8020
+ "inputType": "ArrayBuffer",
8021
+ "outputType": "ArrayBuffer",
8022
+ "flowControl": false,
8023
+ "manualBake": false,
8024
+ "args": [
8025
+ {
8026
+ "name": "Compression Mode",
8027
+ "type": "option",
8028
+ "value": [
8029
+ "1",
8030
+ "2",
8031
+ "3",
8032
+ "4",
8033
+ "5",
8034
+ "6",
8035
+ "7",
8036
+ "8",
8037
+ "9"
8038
+ ],
8039
+ "defaultIndex": 6
8040
+ }
8041
+ ]
8042
+ },
8043
+ "LZMA Decompress": {
8044
+ "module": "Compression",
8045
+ "description": "Decompresses data using the Lempel-Ziv-Markov chain Algorithm.",
8046
+ "infoURL": "https://wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm",
8047
+ "inputType": "ArrayBuffer",
8048
+ "outputType": "ArrayBuffer",
8049
+ "flowControl": false,
8050
+ "manualBake": false,
8051
+ "args": []
8052
+ },
8016
8053
  "LZString Compress": {
8017
8054
  "module": "Compression",
8018
8055
  "description": "Compress the input with lz-string.",
@@ -9721,7 +9758,7 @@
9721
9758
  },
9722
9759
  "Parse SSH Host Key": {
9723
9760
  "module": "Default",
9724
- "description": "Parses a SSH host key and extracts fields from it.<br>The key type can be:<ul><li>ssh-rsa</li><li>ssh-dss</li><li>ecdsa-sha2</li></ul>The key format can be either Hex or Base64.",
9761
+ "description": "Parses a SSH host key and extracts fields from it.<br>The key type can be:<ul><li>ssh-rsa</li><li>ssh-dss</li><li>ecdsa-sha2</li><li>ssh-ed25519</li></ul>The key format can be either Hex or Base64.",
9725
9762
  "infoURL": "https://wikipedia.org/wiki/Secure_Shell",
9726
9763
  "inputType": "string",
9727
9764
  "outputType": "string",
@@ -9,6 +9,8 @@ import Bzip2Compress from "../../operations/Bzip2Compress.mjs";
9
9
  import Bzip2Decompress from "../../operations/Bzip2Decompress.mjs";
10
10
  import Gunzip from "../../operations/Gunzip.mjs";
11
11
  import Gzip from "../../operations/Gzip.mjs";
12
+ import LZMACompress from "../../operations/LZMACompress.mjs";
13
+ import LZMADecompress from "../../operations/LZMADecompress.mjs";
12
14
  import LZStringCompress from "../../operations/LZStringCompress.mjs";
13
15
  import LZStringDecompress from "../../operations/LZStringDecompress.mjs";
14
16
  import RawDeflate from "../../operations/RawDeflate.mjs";
@@ -27,6 +29,8 @@ OpModules.Compression = {
27
29
  "Bzip2 Decompress": Bzip2Decompress,
28
30
  "Gunzip": Gunzip,
29
31
  "Gzip": Gzip,
32
+ "LZMA Compress": LZMACompress,
33
+ "LZMA Decompress": LZMADecompress,
30
34
  "LZString Compress": LZStringCompress,
31
35
  "LZString Decompress": LZStringDecompress,
32
36
  "Raw Deflate": RawDeflate,
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @author Matt C [me@mitt.dev]
3
+ * @copyright Crown Copyright 2022
4
+ * @license Apache-2.0
5
+ */
6
+
7
+ import Operation from "../Operation.mjs";
8
+ import OperationError from "../errors/OperationError.mjs";
9
+
10
+ import { compress } from "@blu3r4y/lzma";
11
+ import {isWorkerEnvironment} from "../Utils.mjs";
12
+
13
+ /**
14
+ * LZMA Compress operation
15
+ */
16
+ class LZMACompress extends Operation {
17
+
18
+ /**
19
+ * LZMACompress constructor
20
+ */
21
+ constructor() {
22
+ super();
23
+
24
+ this.name = "LZMA Compress";
25
+ this.module = "Compression";
26
+ this.description = "Compresses data using the Lempel\u2013Ziv\u2013Markov chain algorithm. Compression mode determines the speed and effectiveness of the compression: 1 is fastest and less effective, 9 is slowest and most effective";
27
+ this.infoURL = "https://wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm";
28
+ this.inputType = "ArrayBuffer";
29
+ this.outputType = "ArrayBuffer";
30
+ this.args = [
31
+ {
32
+ name: "Compression Mode",
33
+ type: "option",
34
+ value: [
35
+ "1", "2", "3", "4", "5", "6", "7", "8", "9"
36
+ ],
37
+ "defaultIndex": 6
38
+ }
39
+ ];
40
+ }
41
+
42
+ /**
43
+ * @param {ArrayBuffer} input
44
+ * @param {Object[]} args
45
+ * @returns {ArrayBuffer}
46
+ */
47
+ async run(input, args) {
48
+ const mode = Number(args[0]);
49
+ return new Promise((resolve, reject) => {
50
+ compress(new Uint8Array(input), mode, (result, error) => {
51
+ if (error) {
52
+ reject(new OperationError(`Failed to compress input: ${error.message}`));
53
+ }
54
+ // The compression returns as an Int8Array, but we can just get the unsigned data from the buffer
55
+ resolve(new Int8Array(result).buffer);
56
+ }, (percent) => {
57
+ if (isWorkerEnvironment()) self.sendStatusMessage(`Compressing input: ${(percent*100).toFixed(2)}%`);
58
+ });
59
+ });
60
+ }
61
+
62
+ }
63
+
64
+ export default LZMACompress;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @author Matt C [me@mitt.dev]
3
+ * @copyright Crown Copyright 2022
4
+ * @license Apache-2.0
5
+ */
6
+
7
+ import Operation from "../Operation.mjs";
8
+ import OperationError from "../errors/OperationError.mjs";
9
+ import {decompress} from "@blu3r4y/lzma";
10
+ import Utils, {isWorkerEnvironment} from "../Utils.mjs";
11
+
12
+ /**
13
+ * LZMA Decompress operation
14
+ */
15
+ class LZMADecompress extends Operation {
16
+
17
+ /**
18
+ * LZMADecompress constructor
19
+ */
20
+ constructor() {
21
+ super();
22
+
23
+ this.name = "LZMA Decompress";
24
+ this.module = "Compression";
25
+ this.description = "Decompresses data using the Lempel-Ziv-Markov chain Algorithm.";
26
+ this.infoURL = "https://wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm";
27
+ this.inputType = "ArrayBuffer";
28
+ this.outputType = "ArrayBuffer";
29
+ }
30
+
31
+ /**
32
+ * @param {ArrayBuffer} input
33
+ * @param {Object[]} args
34
+ * @returns {ArrayBuffer}
35
+ */
36
+ async run(input, args) {
37
+ return new Promise((resolve, reject) => {
38
+ decompress(new Uint8Array(input), (result, error) => {
39
+ if (error) {
40
+ reject(new OperationError(`Failed to decompress input: ${error.message}`));
41
+ }
42
+ // The decompression returns either a String or an untyped unsigned int8 array, but we can just get the unsigned data from the buffer
43
+
44
+ if (typeof result == "string") {
45
+ resolve(Utils.strToArrayBuffer(result));
46
+ } else {
47
+ resolve(new Int8Array(result).buffer);
48
+ }
49
+ }, (percent) => {
50
+ if (isWorkerEnvironment()) self.sendStatusMessage(`Decompressing input: ${(percent*100).toFixed(2)}%`);
51
+ });
52
+ });
53
+ }
54
+
55
+ }
56
+
57
+ export default LZMADecompress;
@@ -23,7 +23,7 @@ class ParseSSHHostKey extends Operation {
23
23
 
24
24
  this.name = "Parse SSH Host Key";
25
25
  this.module = "Default";
26
- this.description = "Parses a SSH host key and extracts fields from it.<br>The key type can be:<ul><li>ssh-rsa</li><li>ssh-dss</li><li>ecdsa-sha2</li></ul>The key format can be either Hex or Base64.";
26
+ this.description = "Parses a SSH host key and extracts fields from it.<br>The key type can be:<ul><li>ssh-rsa</li><li>ssh-dss</li><li>ecdsa-sha2</li><li>ssh-ed25519</li></ul>The key format can be either Hex or Base64.";
27
27
  this.infoURL = "https://wikipedia.org/wiki/Secure_Shell";
28
28
  this.inputType = "string";
29
29
  this.outputType = "string";
@@ -71,6 +71,8 @@ class ParseSSHHostKey extends Operation {
71
71
  } else if (keyType.startsWith("ecdsa-sha2")) {
72
72
  output += `\nCurve: ${Utils.byteArrayToChars(fromHex(fields[1]))}`;
73
73
  output += `\nPoint: 0x${fields.slice(2)}`;
74
+ } else if (keyType === "ssh-ed25519") {
75
+ output += `\nx: 0x${fields[1]}`;
74
76
  } else {
75
77
  output += "\nUnsupported key type.";
76
78
  output += `\nParameters: ${fields.slice(1)}`;
@@ -196,6 +196,8 @@ import Jump from "./Jump.mjs";
196
196
  import Keccak from "./Keccak.mjs";
197
197
  import LS47Decrypt from "./LS47Decrypt.mjs";
198
198
  import LS47Encrypt from "./LS47Encrypt.mjs";
199
+ import LZMACompress from "./LZMACompress.mjs";
200
+ import LZMADecompress from "./LZMADecompress.mjs";
199
201
  import LZStringCompress from "./LZStringCompress.mjs";
200
202
  import LZStringDecompress from "./LZStringDecompress.mjs";
201
203
  import Label from "./Label.mjs";
@@ -581,6 +583,8 @@ export {
581
583
  Keccak,
582
584
  LS47Decrypt,
583
585
  LS47Encrypt,
586
+ LZMACompress,
587
+ LZMADecompress,
584
588
  LZStringCompress,
585
589
  LZStringDecompress,
586
590
  Label,
@@ -199,6 +199,8 @@ import {
199
199
  Keccak as core_Keccak,
200
200
  LS47Decrypt as core_LS47Decrypt,
201
201
  LS47Encrypt as core_LS47Encrypt,
202
+ LZMACompress as core_LZMACompress,
203
+ LZMADecompress as core_LZMADecompress,
202
204
  LZStringCompress as core_LZStringCompress,
203
205
  LZStringDecompress as core_LZStringDecompress,
204
206
  Lorenz as core_Lorenz,
@@ -584,6 +586,8 @@ function generateChef() {
584
586
  "keccak": _wrap(core_Keccak),
585
587
  "LS47Decrypt": _wrap(core_LS47Decrypt),
586
588
  "LS47Encrypt": _wrap(core_LS47Encrypt),
589
+ "LZMACompress": _wrap(core_LZMACompress),
590
+ "LZMADecompress": _wrap(core_LZMADecompress),
587
591
  "LZStringCompress": _wrap(core_LZStringCompress),
588
592
  "LZStringDecompress": _wrap(core_LZStringDecompress),
589
593
  "lorenz": _wrap(core_Lorenz),
@@ -984,6 +988,8 @@ const jump = chef.jump;
984
988
  const keccak = chef.keccak;
985
989
  const LS47Decrypt = chef.LS47Decrypt;
986
990
  const LS47Encrypt = chef.LS47Encrypt;
991
+ const LZMACompress = chef.LZMACompress;
992
+ const LZMADecompress = chef.LZMADecompress;
987
993
  const LZStringCompress = chef.LZStringCompress;
988
994
  const LZStringDecompress = chef.LZStringDecompress;
989
995
  const label = chef.label;
@@ -1371,6 +1377,8 @@ const operations = [
1371
1377
  keccak,
1372
1378
  LS47Decrypt,
1373
1379
  LS47Encrypt,
1380
+ LZMACompress,
1381
+ LZMADecompress,
1374
1382
  LZStringCompress,
1375
1383
  LZStringDecompress,
1376
1384
  label,
@@ -1762,6 +1770,8 @@ export {
1762
1770
  keccak,
1763
1771
  LS47Decrypt,
1764
1772
  LS47Encrypt,
1773
+ LZMACompress,
1774
+ LZMADecompress,
1765
1775
  LZStringCompress,
1766
1776
  LZStringDecompress,
1767
1777
  label,
@@ -23,4 +23,56 @@ TestRegister.addTests([
23
23
  }
24
24
  ],
25
25
  },
26
+ {
27
+ name: "LZMA compress & decompress",
28
+ input: "The cat sat on the mat.",
29
+ // Generated using command `echo -n "The cat sat on the mat." | lzma -z -6 | xxd -p`
30
+ expectedOutput: "The cat sat on the mat.",
31
+ recipeConfig: [
32
+ {
33
+ "op": "LZMA Compress",
34
+ "args": ["6"]
35
+ },
36
+ {
37
+ "op": "LZMA Decompress",
38
+ "args": []
39
+ },
40
+ ],
41
+ },
42
+ {
43
+ name: "LZMA decompress: binary",
44
+ // Generated using command `echo "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10" | xxd -r -p | lzma -z -6 | xxd -p`
45
+ input: "5d00008000ffffffffffffffff00000052500a84f99bb28021a969d627e03e8a922effffbd160000",
46
+ expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10",
47
+ recipeConfig: [
48
+ {
49
+ "op": "From Hex",
50
+ "args": ["Space"]
51
+ },
52
+ {
53
+ "op": "LZMA Decompress",
54
+ "args": []
55
+ },
56
+ {
57
+ "op": "To Hex",
58
+ "args": ["Space", 0]
59
+ }
60
+ ],
61
+ },
62
+ {
63
+ name: "LZMA decompress: string",
64
+ // Generated using command `echo -n "The cat sat on the mat." | lzma -z -6 | xxd -p`
65
+ input: "5d00008000ffffffffffffffff002a1a08a202b1a4b814b912c94c4152e1641907d3fd8cd903ffff4fec0000",
66
+ expectedOutput: "The cat sat on the mat.",
67
+ recipeConfig: [
68
+ {
69
+ "op": "From Hex",
70
+ "args": ["Space"]
71
+ },
72
+ {
73
+ "op": "LZMA Decompress",
74
+ "args": []
75
+ }
76
+ ],
77
+ },
26
78
  ]);
@@ -49,6 +49,18 @@ Point: 0x046c59592006272250a15070142a6be36d1e45464313f930d985a6e6f0eba3cd39d0367
49
49
  }
50
50
  ]
51
51
  },
52
+ {
53
+ name: "SSH Host Key: Ed25519",
54
+ input: "AAAAC3NzaC1lZDI1NTE5AAAAIBOF6r99IkvqGu1kwZrHHIqjpTB5w79bpv67B/Aw3+WJ",
55
+ expectedOutput: `Key type: ssh-ed25519
56
+ x: 0x1385eabf7d224bea1aed64c19ac71c8aa3a53079c3bf5ba6febb07f030dfe589`,
57
+ recipeConfig: [
58
+ {
59
+ op: "Parse SSH Host Key",
60
+ args: ["Base64"]
61
+ }
62
+ ]
63
+ },
52
64
  {
53
65
  name: "SSH Host Key: Extract key",
54
66
  input: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiJZ/9W9Ix/Dk9b+K4E+RGCug1AtkGXaJ9vNIY0YHFHLpWsB8DAuh/cGEI9TLbL1gzR2wG+RJNQ2EAQVWe6ypkK63Jm4zw4re+vhEiszpnP889J0h5N9yzyTndesrl4d3cQtv861FcKDPxUJbRALdtl6gwOB7BCL8gsXJLLVLO4EesrbPXD454qpVt7CgJXEXByOFjcIm3XwkdOnXMPHHnMSD7EIN1SvQMD6PfIDrbDd6KQt5QXW/Rc/BsfX5cbUIV1QW5A/GbepXHHKmWRtLC2J/mH3hW2Zq/hITPEaJdG1CtIilQmJaZGXpfGIwFeb0Av9pSL926arZZ6vDi9ctF test@test",