cyberchef 9.44.0 → 9.45.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.44.0] - 2022-07-08
17
+ - Added 'LZString Compress' and 'LZString Decompress' operations [@crespyl] | [#1266]
18
+
16
19
  ### [9.43.0] - 2022-07-08
17
20
  - Added 'ROT13 Brute Force' and 'ROT47 Brute Force' operations [@mikecat] | [#1264]
18
21
 
@@ -306,6 +309,7 @@ All major and minor version changes will be documented in this file. Details of
306
309
 
307
310
 
308
311
 
312
+ [9.44.0]: https://github.com/gchq/CyberChef/releases/tag/v9.44.0
309
313
  [9.43.0]: https://github.com/gchq/CyberChef/releases/tag/v9.43.0
310
314
  [9.42.0]: https://github.com/gchq/CyberChef/releases/tag/v9.42.0
311
315
  [9.41.0]: https://github.com/gchq/CyberChef/releases/tag/v9.41.0
@@ -435,6 +439,7 @@ All major and minor version changes will be documented in this file. Details of
435
439
  [@hettysymes]: https://github.com/hettysymes
436
440
  [@swesven]: https://github.com/swesven
437
441
  [@mikecat]: https://github.com/mikecat
442
+ [@crespyl]: https://github.com/crespyl
438
443
 
439
444
  [8ad18b]: https://github.com/gchq/CyberChef/commit/8ad18bc7db6d9ff184ba3518686293a7685bf7b7
440
445
  [9a33498]: https://github.com/gchq/CyberChef/commit/9a33498fed26a8df9c9f35f39a78a174bf50a513
@@ -534,4 +539,5 @@ All major and minor version changes will be documented in this file. Details of
534
539
  [#1326]: https://github.com/gchq/CyberChef/pull/1326
535
540
  [#1364]: https://github.com/gchq/CyberChef/pull/1364
536
541
  [#1264]: https://github.com/gchq/CyberChef/pull/1264
542
+ [#1266]: https://github.com/gchq/CyberChef/pull/1266
537
543
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberchef",
3
- "version": "9.44.0",
3
+ "version": "9.45.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",
@@ -91,6 +91,7 @@
91
91
  "ROT13 Brute Force",
92
92
  "ROT47",
93
93
  "ROT47 Brute Force",
94
+ "ROT8000",
94
95
  "XOR",
95
96
  "XOR Brute Force",
96
97
  "Vigenère Encode",
@@ -181,7 +182,8 @@
181
182
  "Bit shift right",
182
183
  "Rotate left",
183
184
  "Rotate right",
184
- "ROT13"
185
+ "ROT13",
186
+ "ROT8000"
185
187
  ]
186
188
  },
187
189
  {
@@ -10311,6 +10311,16 @@
10311
10311
  }
10312
10312
  ]
10313
10313
  },
10314
+ "ROT8000": {
10315
+ "module": "Default",
10316
+ "description": "The simple Caesar-cypher encryption that replaces each Unicode character with the one 0x8000 places forward or back along the alphabet.",
10317
+ "infoURL": "https://rot8000.com/info",
10318
+ "inputType": "string",
10319
+ "outputType": "string",
10320
+ "flowControl": false,
10321
+ "manualBake": false,
10322
+ "args": []
10323
+ },
10314
10324
  "RSA Decrypt": {
10315
10325
  "module": "Ciphers",
10316
10326
  "description": "Decrypt an RSA encrypted message with a PEM encoded private key.",
@@ -110,6 +110,7 @@ import ROT13 from "../../operations/ROT13.mjs";
110
110
  import ROT13BruteForce from "../../operations/ROT13BruteForce.mjs";
111
111
  import ROT47 from "../../operations/ROT47.mjs";
112
112
  import ROT47BruteForce from "../../operations/ROT47BruteForce.mjs";
113
+ import ROT8000 from "../../operations/ROT8000.mjs";
113
114
  import RemoveDiacritics from "../../operations/RemoveDiacritics.mjs";
114
115
  import RemoveLineNumbers from "../../operations/RemoveLineNumbers.mjs";
115
116
  import RemoveNullBytes from "../../operations/RemoveNullBytes.mjs";
@@ -282,6 +283,7 @@ OpModules.Default = {
282
283
  "ROT13 Brute Force": ROT13BruteForce,
283
284
  "ROT47": ROT47,
284
285
  "ROT47 Brute Force": ROT47BruteForce,
286
+ "ROT8000": ROT8000,
285
287
  "Remove Diacritics": RemoveDiacritics,
286
288
  "Remove line numbers": RemoveLineNumbers,
287
289
  "Remove null bytes": RemoveNullBytes,
@@ -0,0 +1,123 @@
1
+ /**
2
+ * @author Daniel Temkin [http://danieltemkin.com]
3
+ * @author Thomas Leplus [https://www.leplus.org]
4
+ * @copyright Crown Copyright 2021
5
+ * @license Apache-2.0
6
+ */
7
+
8
+ import Operation from "../Operation.mjs";
9
+
10
+ /**
11
+ * ROT8000 operation.
12
+ */
13
+ class ROT8000 extends Operation {
14
+
15
+ /**
16
+ * ROT8000 constructor
17
+ */
18
+ constructor() {
19
+ super();
20
+ this.name = "ROT8000";
21
+ this.module = "Default";
22
+ this.description = "The simple Caesar-cypher encryption that replaces each Unicode character with the one 0x8000 places forward or back along the alphabet.";
23
+ this.infoURL = "https://rot8000.com/info";
24
+ this.inputType = "string";
25
+ this.outputType = "string";
26
+ this.args = [];
27
+ }
28
+
29
+ /**
30
+ * @param {byteArray} input
31
+ * @param {Object[]} args
32
+ * @returns {byteArray}
33
+ */
34
+ run(input, args) {
35
+ // Inspired from https://github.com/rottytooth/rot8000/blob/main/rot8000.js
36
+ // these come from the valid-code-point-transitions.json file generated from the c# proj
37
+ // this is done bc: 1) don't trust JS's understanging of surrogate pairs and 2) consistency with original rot8000
38
+ const validCodePoints = {
39
+ "33": true,
40
+ "127": false,
41
+ "161": true,
42
+ "5760": false,
43
+ "5761": true,
44
+ "8192": false,
45
+ "8203": true,
46
+ "8232": false,
47
+ "8234": true,
48
+ "8239": false,
49
+ "8240": true,
50
+ "8287": false,
51
+ "8288": true,
52
+ "12288": false,
53
+ "12289": true,
54
+ "55296": false,
55
+ "57344": true
56
+ };
57
+ const bmpSize = 0x10000;
58
+ const rotList = {}; // the mapping of char to rotated char
59
+ const hiddenBlocks = [];
60
+ let startBlock = 0;
61
+ for (const key in validCodePoints) {
62
+ if (Object.prototype.hasOwnProperty.call(validCodePoints, key)) {
63
+ if (validCodePoints[key] === true)
64
+ hiddenBlocks.push({ start: startBlock, end: parseInt(key, 10) - 1 });
65
+ else
66
+ startBlock = parseInt(key, 10);
67
+ }
68
+ }
69
+ const validIntList = []; // list of all valid chars
70
+ let currValid = false;
71
+ for (let i = 0; i < bmpSize; i++) {
72
+ if (validCodePoints[i] !== undefined) {
73
+ currValid = validCodePoints[i];
74
+ }
75
+ if (currValid) validIntList.push(i);
76
+ }
77
+ const rotateNum = Object.keys(validIntList).length / 2;
78
+ // go through every valid char and find its match
79
+ for (let i = 0; i < validIntList.length; i++) {
80
+ rotList[String.fromCharCode(validIntList[i])] =
81
+ String.fromCharCode(validIntList[(i + rotateNum) % (rotateNum * 2)]);
82
+ }
83
+ let output = "";
84
+ for (let count = 0; count < input.length; count++) {
85
+ // if it is not in the mappings list, just add it directly (no rotation)
86
+ if (rotList[input[count]] === undefined) {
87
+ output += input[count];
88
+ continue;
89
+ }
90
+ // otherwise, rotate it and add it to the string
91
+ output += rotList[input[count]];
92
+ }
93
+ return output;
94
+ }
95
+
96
+ /**
97
+ * Highlight ROT8000
98
+ *
99
+ * @param {Object[]} pos
100
+ * @param {number} pos[].start
101
+ * @param {number} pos[].end
102
+ * @param {Object[]} args
103
+ * @returns {Object[]} pos
104
+ */
105
+ highlight(pos, args) {
106
+ return pos;
107
+ }
108
+
109
+ /**
110
+ * Highlight ROT8000 in reverse
111
+ *
112
+ * @param {Object[]} pos
113
+ * @param {number} pos[].start
114
+ * @param {number} pos[].end
115
+ * @param {Object[]} args
116
+ * @returns {Object[]} pos
117
+ */
118
+ highlightReverse(pos, args) {
119
+ return pos;
120
+ }
121
+ }
122
+
123
+ export default ROT8000;
@@ -257,6 +257,7 @@ import ROT13 from "./ROT13.mjs";
257
257
  import ROT13BruteForce from "./ROT13BruteForce.mjs";
258
258
  import ROT47 from "./ROT47.mjs";
259
259
  import ROT47BruteForce from "./ROT47BruteForce.mjs";
260
+ import ROT8000 from "./ROT8000.mjs";
260
261
  import RSADecrypt from "./RSADecrypt.mjs";
261
262
  import RSAEncrypt from "./RSAEncrypt.mjs";
262
263
  import RSASign from "./RSASign.mjs";
@@ -639,6 +640,7 @@ export {
639
640
  ROT13BruteForce,
640
641
  ROT47,
641
642
  ROT47BruteForce,
643
+ ROT8000,
642
644
  RSADecrypt,
643
645
  RSAEncrypt,
644
646
  RSASign,
@@ -258,6 +258,7 @@ import {
258
258
  ROT13BruteForce as core_ROT13BruteForce,
259
259
  ROT47 as core_ROT47,
260
260
  ROT47BruteForce as core_ROT47BruteForce,
261
+ ROT8000 as core_ROT8000,
261
262
  RSADecrypt as core_RSADecrypt,
262
263
  RSAEncrypt as core_RSAEncrypt,
263
264
  RSASign as core_RSASign,
@@ -640,6 +641,7 @@ function generateChef() {
640
641
  "ROT13BruteForce": _wrap(core_ROT13BruteForce),
641
642
  "ROT47": _wrap(core_ROT47),
642
643
  "ROT47BruteForce": _wrap(core_ROT47BruteForce),
644
+ "ROT8000": _wrap(core_ROT8000),
643
645
  "RSADecrypt": _wrap(core_RSADecrypt),
644
646
  "RSAEncrypt": _wrap(core_RSAEncrypt),
645
647
  "RSASign": _wrap(core_RSASign),
@@ -1039,6 +1041,7 @@ const ROT13 = chef.ROT13;
1039
1041
  const ROT13BruteForce = chef.ROT13BruteForce;
1040
1042
  const ROT47 = chef.ROT47;
1041
1043
  const ROT47BruteForce = chef.ROT47BruteForce;
1044
+ const ROT8000 = chef.ROT8000;
1042
1045
  const RSADecrypt = chef.RSADecrypt;
1043
1046
  const RSAEncrypt = chef.RSAEncrypt;
1044
1047
  const RSASign = chef.RSASign;
@@ -1423,6 +1426,7 @@ const operations = [
1423
1426
  ROT13BruteForce,
1424
1427
  ROT47,
1425
1428
  ROT47BruteForce,
1429
+ ROT8000,
1426
1430
  RSADecrypt,
1427
1431
  RSAEncrypt,
1428
1432
  RSASign,
@@ -1811,6 +1815,7 @@ export {
1811
1815
  ROT13BruteForce,
1812
1816
  ROT47,
1813
1817
  ROT47BruteForce,
1818
+ ROT8000,
1814
1819
  RSADecrypt,
1815
1820
  RSAEncrypt,
1816
1821
  RSASign,
@@ -249,6 +249,7 @@ module.exports = {
249
249
  // testOp(browser, "RIPEMD", "test input", "test_output");
250
250
  // testOp(browser, "ROT13", "test input", "test_output");
251
251
  // testOp(browser, "ROT47", "test input", "test_output");
252
+ // testOp(browser, "ROT8000", "test input", "test_output");
252
253
  // testOp(browser, "Rail Fence Cipher Decode", "test input", "test_output");
253
254
  // testOp(browser, "Rail Fence Cipher Encode", "test input", "test_output");
254
255
  // testOp(browser, "Randomize Colour Palette", "test input", "test_output");
@@ -212,4 +212,37 @@ TestRegister.addTests([
212
212
  },
213
213
  ],
214
214
  },
215
+ {
216
+ name: "ROT8000: nothing",
217
+ input: "",
218
+ expectedOutput: "",
219
+ recipeConfig: [
220
+ {
221
+ op: "ROT8000",
222
+ args: []
223
+ },
224
+ ],
225
+ },
226
+ {
227
+ name: "ROT8000: normal",
228
+ input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
229
+ expectedOutput: "籝籱籮 籚籾籲籬籴 籋类籸粀籷 籏籸粁 籓籾籶籹籮籭 籘籿籮类 籝籱籮 籕籪粃粂 籍籸籰簷",
230
+ recipeConfig: [
231
+ {
232
+ op: "ROT8000",
233
+ args: []
234
+ },
235
+ ],
236
+ },
237
+ {
238
+ name: "ROT8000: backward",
239
+ input: "籝籱籮 籚籾籲籬籴 籋类籸粀籷 籏籸粁 籓籾籶籹籮籭 籘籿籮类 籝籱籮 籕籪粃粂 籍籸籰簷",
240
+ expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog.",
241
+ recipeConfig: [
242
+ {
243
+ op: "ROT8000",
244
+ args: []
245
+ },
246
+ ],
247
+ },
215
248
  ]);