cyberchef 9.47.4 → 9.48.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.48.0] - 2022-10-14
17
+ - Added 'LM Hash' and 'NT Hash' operations [@n1474335] [@brun0ne] | [#1427]
18
+
16
19
  ### [9.47.0] - 2022-10-14
17
20
  - Added 'LZMA Decompress' and 'LZMA Compress' operations [@mattnotmitt] | [#1421]
18
21
 
@@ -318,6 +321,7 @@ All major and minor version changes will be documented in this file. Details of
318
321
 
319
322
 
320
323
 
324
+ [9.48.0]: https://github.com/gchq/CyberChef/releases/tag/v9.48.0
321
325
  [9.47.0]: https://github.com/gchq/CyberChef/releases/tag/v9.47.0
322
326
  [9.46.0]: https://github.com/gchq/CyberChef/releases/tag/v9.46.0
323
327
  [9.45.0]: https://github.com/gchq/CyberChef/releases/tag/v9.45.0
@@ -454,6 +458,7 @@ All major and minor version changes will be documented in this file. Details of
454
458
  [@crespyl]: https://github.com/crespyl
455
459
  [@thomasleplus]: https://github.com/thomasleplus
456
460
  [@valdelaseras]: https://github.com/valdelaseras
461
+ [@brun0ne]: https://github.com/brun0ne
457
462
 
458
463
  [8ad18b]: https://github.com/gchq/CyberChef/commit/8ad18bc7db6d9ff184ba3518686293a7685bf7b7
459
464
  [9a33498]: https://github.com/gchq/CyberChef/commit/9a33498fed26a8df9c9f35f39a78a174bf50a513
@@ -557,4 +562,5 @@ All major and minor version changes will be documented in this file. Details of
557
562
  [#1250]: https://github.com/gchq/CyberChef/pull/1250
558
563
  [#1308]: https://github.com/gchq/CyberChef/pull/1308
559
564
  [#1421]: https://github.com/gchq/CyberChef/pull/1421
565
+ [#1427]: https://github.com/gchq/CyberChef/pull/1427
560
566
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberchef",
3
- "version": "9.47.4",
3
+ "version": "9.48.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",
@@ -142,6 +142,7 @@
142
142
  "node-md6": "^0.1.0",
143
143
  "nodom": "^2.4.0",
144
144
  "notepack.io": "^3.0.1",
145
+ "ntlm": "^0.1.3",
145
146
  "nwmatcher": "^1.4.4",
146
147
  "otp": "0.1.3",
147
148
  "path": "^0.12.7",
@@ -170,7 +171,7 @@
170
171
  "build": "npx grunt prod",
171
172
  "node": "npx grunt node",
172
173
  "repl": "node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-warnings src/node/repl.mjs",
173
- "test": "npx grunt configTests && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation tests/node/index.mjs && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation tests/operations/index.mjs",
174
+ "test": "npx grunt configTests && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation --openssl-legacy-provider tests/node/index.mjs && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation --openssl-legacy-provider tests/operations/index.mjs",
174
175
  "testnodeconsumer": "npx grunt testnodeconsumer",
175
176
  "testui": "npx grunt testui",
176
177
  "testuidev": "npx nightwatch --env=dev",
@@ -206,7 +206,7 @@ class Utils {
206
206
  * Utils.parseEscapedChars("\\n");
207
207
  */
208
208
  static parseEscapedChars(str) {
209
- return str.replace(/\\([bfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g, function(m, a) {
209
+ return str.replace(/\\([abfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g, function(m, a) {
210
210
  switch (a[0]) {
211
211
  case "\\":
212
212
  return "\\";
@@ -219,6 +219,8 @@ class Utils {
219
219
  case "6":
220
220
  case "7":
221
221
  return String.fromCharCode(parseInt(a, 8));
222
+ case "a":
223
+ return String.fromCharCode(7);
222
224
  case "b":
223
225
  return "\b";
224
226
  case "t":
@@ -369,6 +369,8 @@
369
369
  "Bcrypt compare",
370
370
  "Bcrypt parse",
371
371
  "Scrypt",
372
+ "NT Hash",
373
+ "LM Hash",
372
374
  "Fletcher-8 Checksum",
373
375
  "Fletcher-16 Checksum",
374
376
  "Fletcher-32 Checksum",
@@ -8010,6 +8010,16 @@
8010
8010
  }
8011
8011
  ]
8012
8012
  },
8013
+ "LM Hash": {
8014
+ "module": "Crypto",
8015
+ "description": "An LM Hash, or LAN Manager Hash, is a deprecated way of storing passwords on old Microsoft operating systems. It is particularly weak and can be cracked in seconds on modern hardware using rainbow tables.",
8016
+ "infoURL": "https://wikipedia.org/wiki/LAN_Manager#Password_hashing_algorithm",
8017
+ "inputType": "string",
8018
+ "outputType": "string",
8019
+ "flowControl": false,
8020
+ "manualBake": false,
8021
+ "args": []
8022
+ },
8013
8023
  "LS47 Decrypt": {
8014
8024
  "module": "Crypto",
8015
8025
  "description": "This is a slight improvement of the ElsieFour cipher as described by Alan Kaminsky. We use 7x7 characters instead of original (barely fitting) 6x6, to be able to encrypt some structured information. We also describe a simple key-expansion algorithm, because remembering passwords is popular. Similar security considerations as with ElsieFour hold.<br>The LS47 alphabet consists of following characters: <code>_abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()</code><br>An LS47 key is a permutation of the alphabet that is then represented in a 7x7 grid used for the encryption or decryption.",
@@ -8742,6 +8752,16 @@
8742
8752
  "manualBake": false,
8743
8753
  "args": []
8744
8754
  },
8755
+ "NT Hash": {
8756
+ "module": "Crypto",
8757
+ "description": "An NT Hash, sometimes referred to as an NTLM hash, is a method of storing passwords on Windows systems. It works by running MD4 on UTF-16LE encoded input. NTLM hashes are considered weak because they can be brute-forced very easily with modern hardware.",
8758
+ "infoURL": "https://wikipedia.org/wiki/NT_LAN_Manager",
8759
+ "inputType": "string",
8760
+ "outputType": "string",
8761
+ "flowControl": false,
8762
+ "manualBake": false,
8763
+ "args": []
8764
+ },
8745
8765
  "Normalise Image": {
8746
8766
  "module": "Image",
8747
8767
  "description": "Normalise the image colours.",
@@ -34,12 +34,14 @@ import JWTDecode from "../../operations/JWTDecode.mjs";
34
34
  import JWTSign from "../../operations/JWTSign.mjs";
35
35
  import JWTVerify from "../../operations/JWTVerify.mjs";
36
36
  import Keccak from "../../operations/Keccak.mjs";
37
+ import LMHash from "../../operations/LMHash.mjs";
37
38
  import LS47Decrypt from "../../operations/LS47Decrypt.mjs";
38
39
  import LS47Encrypt from "../../operations/LS47Encrypt.mjs";
39
40
  import MD2 from "../../operations/MD2.mjs";
40
41
  import MD4 from "../../operations/MD4.mjs";
41
42
  import MD5 from "../../operations/MD5.mjs";
42
43
  import MD6 from "../../operations/MD6.mjs";
44
+ import NTHash from "../../operations/NTHash.mjs";
43
45
  import RIPEMD from "../../operations/RIPEMD.mjs";
44
46
  import SHA0 from "../../operations/SHA0.mjs";
45
47
  import SHA1 from "../../operations/SHA1.mjs";
@@ -85,12 +87,14 @@ OpModules.Crypto = {
85
87
  "JWT Sign": JWTSign,
86
88
  "JWT Verify": JWTVerify,
87
89
  "Keccak": Keccak,
90
+ "LM Hash": LMHash,
88
91
  "LS47 Decrypt": LS47Decrypt,
89
92
  "LS47 Encrypt": LS47Encrypt,
90
93
  "MD2": MD2,
91
94
  "MD4": MD4,
92
95
  "MD5": MD5,
93
96
  "MD6": MD6,
97
+ "NT Hash": NTHash,
94
98
  "RIPEMD": RIPEMD,
95
99
  "SHA0": SHA0,
96
100
  "SHA1": SHA1,
@@ -34,6 +34,8 @@ import BLAKE2b from "./BLAKE2b.mjs";
34
34
  import BLAKE2s from "./BLAKE2s.mjs";
35
35
  import Streebog from "./Streebog.mjs";
36
36
  import GOSTHash from "./GOSTHash.mjs";
37
+ import LMHash from "./LMHash.mjs";
38
+ import NTHash from "./NTHash.mjs";
37
39
  import OperationError from "../errors/OperationError.mjs";
38
40
 
39
41
  /**
@@ -107,6 +109,8 @@ class GenerateAllHashes extends Operation {
107
109
  {name: "Streebog-256", algo: (new Streebog), inputType: "arrayBuffer", params: ["256"]},
108
110
  {name: "Streebog-512", algo: (new Streebog), inputType: "arrayBuffer", params: ["512"]},
109
111
  {name: "GOST", algo: (new GOSTHash), inputType: "arrayBuffer", params: ["D-A"]},
112
+ {name: "LM Hash", algo: (new LMHash), inputType: "str", params: []},
113
+ {name: "NT Hash", algo: (new NTHash), inputType: "str", params: []},
110
114
  {name: "SSDEEP", algo: (new SSDEEP()), inputType: "str"},
111
115
  {name: "CTPH", algo: (new CTPH()), inputType: "str"}
112
116
  ];
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @author n1474335 [n1474335@gmail.com]
3
+ * @copyright Crown Copyright 2022
4
+ * @license Apache-2.0
5
+ */
6
+
7
+ import Operation from "../Operation.mjs";
8
+ import {smbhash} from "ntlm";
9
+
10
+ /**
11
+ * LM Hash operation
12
+ */
13
+ class LMHash extends Operation {
14
+
15
+ /**
16
+ * LMHash constructor
17
+ */
18
+ constructor() {
19
+ super();
20
+
21
+ this.name = "LM Hash";
22
+ this.module = "Crypto";
23
+ this.description = "An LM Hash, or LAN Manager Hash, is a deprecated way of storing passwords on old Microsoft operating systems. It is particularly weak and can be cracked in seconds on modern hardware using rainbow tables.";
24
+ this.infoURL = "https://wikipedia.org/wiki/LAN_Manager#Password_hashing_algorithm";
25
+ this.inputType = "string";
26
+ this.outputType = "string";
27
+ this.args = [];
28
+ }
29
+
30
+ /**
31
+ * @param {string} input
32
+ * @param {Object[]} args
33
+ * @returns {string}
34
+ */
35
+ run(input, args) {
36
+ return smbhash.lmhash(input);
37
+ }
38
+
39
+ }
40
+
41
+ export default LMHash;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @author brun0ne [brunonblok@gmail.com]
3
+ * @copyright Crown Copyright 2022
4
+ * @license Apache-2.0
5
+ */
6
+
7
+ import Operation from "../Operation.mjs";
8
+
9
+ import cptable from "codepage";
10
+ import {runHash} from "../lib/Hash.mjs";
11
+
12
+ /**
13
+ * NT Hash operation
14
+ */
15
+ class NTHash extends Operation {
16
+
17
+ /**
18
+ * NTHash constructor
19
+ */
20
+ constructor() {
21
+ super();
22
+
23
+ this.name = "NT Hash";
24
+ this.module = "Crypto";
25
+ this.description = "An NT Hash, sometimes referred to as an NTLM hash, is a method of storing passwords on Windows systems. It works by running MD4 on UTF-16LE encoded input. NTLM hashes are considered weak because they can be brute-forced very easily with modern hardware.";
26
+ this.infoURL = "https://wikipedia.org/wiki/NT_LAN_Manager";
27
+ this.inputType = "string";
28
+ this.outputType = "string";
29
+ this.args = [];
30
+ }
31
+
32
+ /**
33
+ * @param {string} input
34
+ * @param {Object[]} args
35
+ * @returns {string}
36
+ */
37
+ run(input, args) {
38
+ const format = 1200; // UTF-16LE
39
+ const encoded = cptable.utils.encode(format, input);
40
+ const hashed = runHash("md4", encoded);
41
+
42
+ return hashed.toUpperCase();
43
+ }
44
+ }
45
+
46
+ export default NTHash;
@@ -194,6 +194,7 @@ import JavaScriptMinify from "./JavaScriptMinify.mjs";
194
194
  import JavaScriptParser from "./JavaScriptParser.mjs";
195
195
  import Jump from "./Jump.mjs";
196
196
  import Keccak from "./Keccak.mjs";
197
+ import LMHash from "./LMHash.mjs";
197
198
  import LS47Decrypt from "./LS47Decrypt.mjs";
198
199
  import LS47Encrypt from "./LS47Encrypt.mjs";
199
200
  import LZMACompress from "./LZMACompress.mjs";
@@ -215,6 +216,7 @@ import MicrosoftScriptDecoder from "./MicrosoftScriptDecoder.mjs";
215
216
  import MultipleBombe from "./MultipleBombe.mjs";
216
217
  import Multiply from "./Multiply.mjs";
217
218
  import NOT from "./NOT.mjs";
219
+ import NTHash from "./NTHash.mjs";
218
220
  import NormaliseImage from "./NormaliseImage.mjs";
219
221
  import NormaliseUnicode from "./NormaliseUnicode.mjs";
220
222
  import Numberwang from "./Numberwang.mjs";
@@ -581,6 +583,7 @@ export {
581
583
  JavaScriptParser,
582
584
  Jump,
583
585
  Keccak,
586
+ LMHash,
584
587
  LS47Decrypt,
585
588
  LS47Encrypt,
586
589
  LZMACompress,
@@ -602,6 +605,7 @@ export {
602
605
  MultipleBombe,
603
606
  Multiply,
604
607
  NOT,
608
+ NTHash,
605
609
  NormaliseImage,
606
610
  NormaliseUnicode,
607
611
  Numberwang,
@@ -197,6 +197,7 @@ import {
197
197
  JWTSign as core_JWTSign,
198
198
  JWTVerify as core_JWTVerify,
199
199
  Keccak as core_Keccak,
200
+ LMHash as core_LMHash,
200
201
  LS47Decrypt as core_LS47Decrypt,
201
202
  LS47Encrypt as core_LS47Encrypt,
202
203
  LZMACompress as core_LZMACompress,
@@ -216,6 +217,7 @@ import {
216
217
  MultipleBombe as core_MultipleBombe,
217
218
  Multiply as core_Multiply,
218
219
  NOT as core_NOT,
220
+ NTHash as core_NTHash,
219
221
  NormaliseImage as core_NormaliseImage,
220
222
  NormaliseUnicode as core_NormaliseUnicode,
221
223
  Numberwang as core_Numberwang,
@@ -584,6 +586,7 @@ function generateChef() {
584
586
  "JWTSign": _wrap(core_JWTSign),
585
587
  "JWTVerify": _wrap(core_JWTVerify),
586
588
  "keccak": _wrap(core_Keccak),
589
+ "LMHash": _wrap(core_LMHash),
587
590
  "LS47Decrypt": _wrap(core_LS47Decrypt),
588
591
  "LS47Encrypt": _wrap(core_LS47Encrypt),
589
592
  "LZMACompress": _wrap(core_LZMACompress),
@@ -603,6 +606,7 @@ function generateChef() {
603
606
  "multipleBombe": _wrap(core_MultipleBombe),
604
607
  "multiply": _wrap(core_Multiply),
605
608
  "NOT": _wrap(core_NOT),
609
+ "NTHash": _wrap(core_NTHash),
606
610
  "normaliseImage": _wrap(core_NormaliseImage),
607
611
  "normaliseUnicode": _wrap(core_NormaliseUnicode),
608
612
  "numberwang": _wrap(core_Numberwang),
@@ -986,6 +990,7 @@ const javaScriptMinify = chef.javaScriptMinify;
986
990
  const javaScriptParser = chef.javaScriptParser;
987
991
  const jump = chef.jump;
988
992
  const keccak = chef.keccak;
993
+ const LMHash = chef.LMHash;
989
994
  const LS47Decrypt = chef.LS47Decrypt;
990
995
  const LS47Encrypt = chef.LS47Encrypt;
991
996
  const LZMACompress = chef.LZMACompress;
@@ -1007,6 +1012,7 @@ const microsoftScriptDecoder = chef.microsoftScriptDecoder;
1007
1012
  const multipleBombe = chef.multipleBombe;
1008
1013
  const multiply = chef.multiply;
1009
1014
  const NOT = chef.NOT;
1015
+ const NTHash = chef.NTHash;
1010
1016
  const normaliseImage = chef.normaliseImage;
1011
1017
  const normaliseUnicode = chef.normaliseUnicode;
1012
1018
  const numberwang = chef.numberwang;
@@ -1375,6 +1381,7 @@ const operations = [
1375
1381
  javaScriptParser,
1376
1382
  jump,
1377
1383
  keccak,
1384
+ LMHash,
1378
1385
  LS47Decrypt,
1379
1386
  LS47Encrypt,
1380
1387
  LZMACompress,
@@ -1396,6 +1403,7 @@ const operations = [
1396
1403
  multipleBombe,
1397
1404
  multiply,
1398
1405
  NOT,
1406
+ NTHash,
1399
1407
  normaliseImage,
1400
1408
  normaliseUnicode,
1401
1409
  numberwang,
@@ -1768,6 +1776,7 @@ export {
1768
1776
  javaScriptParser,
1769
1777
  jump,
1770
1778
  keccak,
1779
+ LMHash,
1771
1780
  LS47Decrypt,
1772
1781
  LS47Encrypt,
1773
1782
  LZMACompress,
@@ -1789,6 +1798,7 @@ export {
1789
1798
  multipleBombe,
1790
1799
  multiply,
1791
1800
  NOT,
1801
+ NTHash,
1792
1802
  normaliseImage,
1793
1803
  normaliseUnicode,
1794
1804
  numberwang,
@@ -120,9 +120,10 @@ import "./tests/SIGABA.mjs";
120
120
  import "./tests/ELFInfo.mjs";
121
121
  import "./tests/Subsection.mjs";
122
122
  import "./tests/CaesarBoxCipher.mjs";
123
+ import "./tests/UnescapeString.mjs";
123
124
  import "./tests/LS47.mjs";
124
125
  import "./tests/LZString.mjs";
125
-
126
+ import "./tests/NTLM.mjs";
126
127
 
127
128
  // Cannot test operations that use the File type yet
128
129
  // import "./tests/SplitColourChannels.mjs";
@@ -50,6 +50,8 @@ BLAKE2s-256: f308fc02ce9172ad02a7d75800ecfc027109bc67987ea32aba9b8dcc7b10150e
50
50
  Streebog-256: 12a50838191b5504f1e5f2fd078714cf6b592b9d29af99d0b10d8d02881c3857
51
51
  Streebog-512: 7200bf5dea560f0d7960d07fdc8874ad9f3b86ece2e45f5502ae2e176f2c928e0e581152281f5aee818318bed7cbe6aa69999589234723ceb33175598365b5c8
52
52
  GOST: ee67303696d205ddd2b2363e8e01b4b7199a80957d94d7678eaad3fc834c5a27
53
+ LM Hash: 01FC5A6BE7BC6929AAD3B435B51404EE
54
+ NT Hash: 0CB6948805F797BF2A82807973B89537
53
55
  SSDEEP: 3:Hn:Hn
54
56
  CTPH: A:E:E
55
57
 
@@ -79,6 +81,8 @@ MD5: 098f6bcd4621d373cade4e832627b4f6
79
81
  RIPEMD-128: f1abb5083c9ff8a9dbbca9cd2b11fead
80
82
  BLAKE2b-128: 44a8995dd50b6657a037a7839304535b
81
83
  BLAKE2s-128: e9ddd9926b9dcb382e09be39ba403d2c
84
+ LM Hash: 01FC5A6BE7BC6929AAD3B435B51404EE
85
+ NT Hash: 0CB6948805F797BF2A82807973B89537
82
86
  `,
83
87
  recipeConfig: [
84
88
  {
@@ -0,0 +1,34 @@
1
+ /**
2
+ * NTLM test.
3
+ *
4
+ * @author brun0ne [brunonblok@gmail.com]
5
+ * @copyright Crown Copyright 2022
6
+ * @license Apache-2.0
7
+ */
8
+ import TestRegister from "../../lib/TestRegister.mjs";
9
+
10
+ TestRegister.addTests([
11
+ {
12
+ name: "NT Hash",
13
+ input: "QWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()_+.,?/",
14
+ expectedOutput: "C5FA1C40E55734A8E528DBFE21766D23",
15
+ recipeConfig: [
16
+ {
17
+ op: "NT Hash",
18
+ args: [],
19
+ },
20
+ ],
21
+ },
22
+ {
23
+ name: "LM Hash",
24
+ input: "QWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()_+.,?/",
25
+ expectedOutput: "6D9DF16655336CA75A3C13DD18BA8156",
26
+ recipeConfig: [
27
+ {
28
+ op: "LM Hash",
29
+ args: [],
30
+ },
31
+ ],
32
+ },
33
+
34
+ ]);
@@ -0,0 +1,55 @@
1
+ /**
2
+ * UnescapeString tests.
3
+ *
4
+ * @copyright Crown Copyright 2022
5
+ * @license Apache-2.0
6
+ */
7
+ import TestRegister from "../../lib/TestRegister.mjs";
8
+
9
+ TestRegister.addTests([
10
+ {
11
+ name: "UnescapeString: escape sequences",
12
+ input: "\\a\\b\\f\\n\\r\\t\\v\\'\\\"",
13
+ expectedOutput: String.fromCharCode(0x07, 0x08, 0x0c, 0x0a, 0x0d, 0x09,
14
+ 0x0b, 0x27, 0x22),
15
+ recipeConfig: [
16
+ {
17
+ op: "Unescape string",
18
+ args: [],
19
+ },
20
+ ],
21
+ },
22
+ {
23
+ name: "UnescapeString: octals",
24
+ input: "\\0\\01\\012\\1\\12",
25
+ expectedOutput: String.fromCharCode(0, 1, 10, 1, 10),
26
+ recipeConfig: [
27
+ {
28
+ op: "Unescape string",
29
+ args: [],
30
+ },
31
+ ],
32
+ },
33
+ {
34
+ name: "UnescapeString: hexadecimals",
35
+ input: "\\x00\\xAA\\xaa",
36
+ expectedOutput: String.fromCharCode(0, 170, 170),
37
+ recipeConfig: [
38
+ {
39
+ op: "Unescape string",
40
+ args: [],
41
+ },
42
+ ],
43
+ },
44
+ {
45
+ name: "UnescapeString: unicode",
46
+ input: "\\u0061\\u{0062}",
47
+ expectedOutput: "ab",
48
+ recipeConfig: [
49
+ {
50
+ op: "Unescape string",
51
+ args: [],
52
+ },
53
+ ],
54
+ },
55
+ ]);