cyberchef 10.24.0 → 11.1.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.
Files changed (81) hide show
  1. package/.devcontainer/devcontainer.json +1 -1
  2. package/.nvmrc +1 -1
  3. package/CHANGELOG.md +172 -0
  4. package/Dockerfile +2 -2
  5. package/Gruntfile.js +11 -6
  6. package/README.md +6 -4
  7. package/SECURITY.md +8 -18
  8. package/babel.config.js +4 -1
  9. package/package.json +48 -43
  10. package/src/core/ChefWorker.js +1 -1
  11. package/src/core/Recipe.mjs +1 -1
  12. package/src/core/config/Categories.json +6 -0
  13. package/src/core/config/OperationConfig.json +140 -16
  14. package/src/core/config/modules/Default.mjs +8 -0
  15. package/src/core/config/modules/PGP.mjs +2 -0
  16. package/src/core/config/scripts/generateOpsIndex.mjs +63 -0
  17. package/src/core/config/scripts/newOperation.mjs +31 -4
  18. package/src/core/lib/Magic.mjs +1 -1
  19. package/src/core/operations/AESDecrypt.mjs +61 -16
  20. package/src/core/operations/AESEncrypt.mjs +26 -11
  21. package/src/core/operations/BLAKE3.mjs +13 -7
  22. package/src/core/operations/BSONDeserialise.mjs +2 -2
  23. package/src/core/operations/BSONSerialise.mjs +3 -2
  24. package/src/core/operations/Bcrypt.mjs +1 -1
  25. package/src/core/operations/BcryptCompare.mjs +1 -1
  26. package/src/core/operations/DecodeText.mjs +4 -0
  27. package/src/core/operations/EncodeText.mjs +4 -0
  28. package/src/core/operations/EscapeSmartCharacters.mjs +129 -0
  29. package/src/core/operations/FromPunycode.mjs +1 -1
  30. package/src/core/operations/GenerateLoremIpsum.mjs +34 -3
  31. package/src/core/operations/GeneratePGPKeyPair.mjs +8 -7
  32. package/src/core/operations/PGPSign.mjs +83 -0
  33. package/src/core/operations/ParseEthernetFrame.mjs +1 -1
  34. package/src/core/operations/ParseIPv4Header.mjs +1 -1
  35. package/src/core/operations/ParseObjectIDTimestamp.mjs +2 -2
  36. package/src/core/operations/ParseUserAgent.mjs +1 -1
  37. package/src/core/operations/ROR13.mjs +83 -0
  38. package/src/core/operations/RemoveANSIEscapeCodes.mjs +41 -0
  39. package/src/core/operations/SeriesChart.mjs +16 -0
  40. package/src/core/operations/ShowBase64Offsets.mjs +28 -28
  41. package/src/core/operations/ToPunycode.mjs +1 -1
  42. package/src/core/operations/Wrap.mjs +47 -0
  43. package/src/core/operations/index.mjs +10 -0
  44. package/src/node/NodeRecipe.mjs +8 -7
  45. package/src/node/api.mjs +4 -4
  46. package/src/node/index.mjs +25 -0
  47. package/src/web/App.mjs +19 -1
  48. package/src/web/HTMLIngredient.mjs +1 -0
  49. package/src/web/html/index.html +3 -3
  50. package/src/web/index.js +2 -2
  51. package/src/web/static/sitemap.mjs +4 -4
  52. package/src/web/waiters/RecipeWaiter.mjs +9 -1
  53. package/tests/browser/02_ops.js +7 -7
  54. package/tests/browser/03_recipe_load.js +48 -0
  55. package/tests/browser/browserUtils.js +6 -3
  56. package/tests/lib/wasmFetchPolyfill.mjs +31 -0
  57. package/tests/node/consumers/cjs-consumer.js +2 -2
  58. package/tests/node/consumers/esm-consumer.mjs +2 -2
  59. package/tests/node/index.mjs +1 -0
  60. package/tests/node/tests/Categories.mjs +2 -2
  61. package/tests/node/tests/PGP.mjs +69 -0
  62. package/tests/node/tests/nodeApi.mjs +55 -58
  63. package/tests/node/tests/operations.mjs +41 -2
  64. package/tests/operations/index.mjs +72 -66
  65. package/tests/operations/tests/BLAKE3.mjs +18 -0
  66. package/tests/operations/tests/Base64.mjs +11 -0
  67. package/tests/operations/tests/CharEnc.mjs +26 -0
  68. package/tests/operations/tests/Charts.mjs +11 -0
  69. package/tests/operations/tests/Crypt.mjs +288 -62
  70. package/tests/operations/tests/EscapeSmartCharacters.mjs +132 -0
  71. package/tests/operations/tests/FlaskSession.mjs +11 -8
  72. package/tests/operations/tests/GenerateLoremIpsum.mjs +80 -0
  73. package/tests/operations/tests/IPv6Transition.mjs +4 -4
  74. package/tests/operations/tests/PGP.mjs +178 -154
  75. package/tests/operations/tests/ParseEthernetFrame.mjs +11 -0
  76. package/tests/operations/tests/ParseIPv4Header.mjs +23 -0
  77. package/tests/operations/tests/ParseX509CRL.mjs +16 -16
  78. package/tests/operations/tests/ROR13.mjs +45 -0
  79. package/tests/operations/tests/Register.mjs +3 -1
  80. package/tests/operations/tests/RemoveANSIEscapeCodes.mjs +62 -0
  81. package/tests/operations/tests/Wrap.mjs +44 -0
@@ -1,24 +1,31 @@
1
- /* eslint no-console: 0 */
2
-
3
1
  /**
4
- * Test Runner
5
- *
6
- * For running the tests in the test register.
7
- *
8
- * @author tlwr [toby@toby.codes]
9
- * @author n1474335 [n1474335@gmail.com]
10
- * @copyright Crown Copyright 2017
11
- * @license Apache-2.0
12
- */
2
+ * THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateOpsIndex.mjs
3
+ *
4
+ * @author john [john19696@protonmail.com]
5
+ * @author tlwr [toby@toby.codes]
6
+ * @author n1474335 [n1474335@gmail.com]
7
+ * @copyright Crown Copyright 2026
8
+ * @license Apache-2.0
9
+ */
10
+
11
+ import {
12
+ setLongTestFailure,
13
+ logTestReport,
14
+ } from "../lib/utils.mjs";
13
15
 
14
- import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
16
+ import "../lib/wasmFetchPolyfill.mjs";
15
17
 
16
18
  import TestRegister from "../lib/TestRegister.mjs";
17
19
  import "./tests/A1Z26CipherDecode.mjs";
18
20
  import "./tests/AESKeyWrap.mjs";
19
- import "./tests/AnalyseUUID.mjs";
20
21
  import "./tests/AlternatingCaps.mjs";
22
+ import "./tests/AnalyseUUID.mjs";
21
23
  import "./tests/AvroToJSON.mjs";
24
+ import "./tests/BCD.mjs";
25
+ import "./tests/BLAKE2b.mjs";
26
+ import "./tests/BLAKE2s.mjs";
27
+ import "./tests/BLAKE3.mjs";
28
+ import "./tests/BSON.mjs";
22
29
  import "./tests/BaconCipher.mjs";
23
30
  import "./tests/Base32.mjs";
24
31
  import "./tests/Base45.mjs";
@@ -27,29 +34,26 @@ import "./tests/Base62.mjs";
27
34
  import "./tests/Base64.mjs";
28
35
  import "./tests/Base85.mjs";
29
36
  import "./tests/Base92.mjs";
30
- import "./tests/BCD.mjs";
31
37
  import "./tests/Bech32.mjs";
32
38
  import "./tests/BitwiseOp.mjs";
33
- import "./tests/BLAKE2b.mjs";
34
- import "./tests/BLAKE2s.mjs";
35
- import "./tests/BLAKE3.mjs";
36
39
  import "./tests/Bombe.mjs";
37
- import "./tests/BSON.mjs";
38
40
  import "./tests/ByteRepr.mjs";
41
+ import "./tests/CBORDecode.mjs";
42
+ import "./tests/CBOREncode.mjs";
43
+ import "./tests/CMAC.mjs";
44
+ import "./tests/CRCChecksum.mjs";
45
+ import "./tests/CSV.mjs";
39
46
  import "./tests/CaesarBoxCipher.mjs";
40
47
  import "./tests/CaretMdecode.mjs";
41
48
  import "./tests/CartesianProduct.mjs";
42
- import "./tests/CBORDecode.mjs";
43
- import "./tests/CBOREncode.mjs";
44
49
  import "./tests/CetaceanCipherDecode.mjs";
45
50
  import "./tests/CetaceanCipherEncode.mjs";
46
51
  import "./tests/ChaCha.mjs";
47
52
  import "./tests/ChangeIPFormat.mjs";
48
53
  import "./tests/CharEnc.mjs";
49
54
  import "./tests/Charts.mjs";
50
- import "./tests/Ciphers.mjs";
51
55
  import "./tests/CipherSaber2.mjs";
52
- import "./tests/CMAC.mjs";
56
+ import "./tests/Ciphers.mjs";
53
57
  import "./tests/Code.mjs";
54
58
  import "./tests/Colossus.mjs";
55
59
  import "./tests/Comment.mjs";
@@ -58,9 +62,7 @@ import "./tests/ConditionalJump.mjs";
58
62
  import "./tests/ConvertCoordinateFormat.mjs";
59
63
  import "./tests/ConvertLeetSpeak.mjs";
60
64
  import "./tests/ConvertToNATOAlphabet.mjs";
61
- import "./tests/CRCChecksum.mjs";
62
65
  import "./tests/Crypt.mjs";
63
- import "./tests/CSV.mjs";
64
66
  import "./tests/DateTime.mjs";
65
67
  import "./tests/DefangIP.mjs";
66
68
  import "./tests/DisassembleARM.mjs";
@@ -68,64 +70,77 @@ import "./tests/DropNthBytes.mjs";
68
70
  import "./tests/ECDSA.mjs";
69
71
  import "./tests/ELFInfo.mjs";
70
72
  import "./tests/Enigma.mjs";
73
+ import "./tests/EscapeSmartCharacters.mjs";
71
74
  import "./tests/ExtractAudioMetadata.mjs";
72
75
  import "./tests/ExtractEmailAddresses.mjs";
73
76
  import "./tests/ExtractHashes.mjs";
74
77
  import "./tests/ExtractIPAddresses.mjs";
75
78
  import "./tests/Fernet.mjs";
76
- import "./tests/Float.mjs";
77
79
  import "./tests/FileTree.mjs";
80
+ import "./tests/FlaskSession.mjs";
78
81
  import "./tests/FletcherChecksum.mjs";
82
+ import "./tests/Float.mjs";
79
83
  import "./tests/Fork.mjs";
80
84
  import "./tests/FromDecimal.mjs";
85
+ import "./tests/GOST.mjs";
81
86
  import "./tests/GenerateAllChecksums.mjs";
82
87
  import "./tests/GenerateAllHashes.mjs";
83
88
  import "./tests/GenerateDeBruijnSequence.mjs";
89
+ import "./tests/GenerateLoremIpsum.mjs";
84
90
  import "./tests/GenerateQRCode.mjs";
85
91
  import "./tests/GetAllCasings.mjs";
86
- import "./tests/GOST.mjs";
87
92
  import "./tests/Gunzip.mjs";
88
93
  import "./tests/Gzip.mjs";
89
- import "./tests/Hash.mjs";
90
94
  import "./tests/HASSH.mjs";
95
+ import "./tests/HKDF.mjs";
96
+ import "./tests/Hash.mjs";
91
97
  import "./tests/HaversineDistance.mjs";
92
98
  import "./tests/Hex.mjs";
93
99
  import "./tests/Hexdump.mjs";
94
- import "./tests/HKDF.mjs";
100
+ import "./tests/IPv6Transition.mjs";
95
101
  import "./tests/Image.mjs";
96
102
  import "./tests/IndexOfCoincidence.mjs";
97
103
  import "./tests/JA3Fingerprint.mjs";
98
- import "./tests/JA4.mjs";
99
104
  import "./tests/JA3SFingerprint.mjs";
100
- import "./tests/Jsonata.mjs";
105
+ import "./tests/JA4.mjs";
101
106
  import "./tests/JSONBeautify.mjs";
102
107
  import "./tests/JSONMinify.mjs";
103
108
  import "./tests/JSONtoCSV.mjs";
104
- import "./tests/Jump.mjs";
109
+ import "./tests/JSONtoYAML.mjs";
105
110
  import "./tests/JWK.mjs";
106
111
  import "./tests/JWTDecode.mjs";
107
112
  import "./tests/JWTSign.mjs";
108
113
  import "./tests/JWTVerify.mjs";
109
- import "./tests/LevenshteinDistance.mjs";
110
- import "./tests/Lorenz.mjs";
114
+ import "./tests/Jq.mjs";
115
+ import "./tests/Jsonata.mjs";
116
+ import "./tests/Jump.mjs";
111
117
  import "./tests/LS47.mjs";
112
- import "./tests/LuhnChecksum.mjs";
113
118
  import "./tests/LZNT1Decompress.mjs";
114
119
  import "./tests/LZString.mjs";
120
+ import "./tests/LevenshteinDistance.mjs";
121
+ import "./tests/Lorenz.mjs";
122
+ import "./tests/LuhnChecksum.mjs";
123
+ import "./tests/MIMEDecoding.mjs";
124
+ import "./tests/MS.mjs";
115
125
  import "./tests/Magic.mjs";
116
126
  import "./tests/Media.mjs";
117
- import "./tests/MIMEDecoding.mjs";
118
127
  import "./tests/Modhex.mjs";
119
128
  import "./tests/MorseCode.mjs";
120
- import "./tests/MS.mjs";
121
129
  import "./tests/MultipleBombe.mjs";
122
130
  import "./tests/MurmurHash3.mjs";
131
+ import "./tests/NTLM.mjs";
123
132
  import "./tests/NetBIOS.mjs";
124
133
  import "./tests/NormaliseUnicode.mjs";
125
- import "./tests/NTLM.mjs";
126
134
  import "./tests/OTP.mjs";
135
+ import "./tests/PEMtoHex.mjs";
136
+ import "./tests/PGP.mjs";
137
+ import "./tests/PHP.mjs";
138
+ import "./tests/PHPSerialize.mjs";
139
+ import "./tests/ParityBit.mjs";
140
+ import "./tests/ParseCSR.mjs";
127
141
  import "./tests/ParseEthernetFrame.mjs";
128
142
  import "./tests/ParseIPRange.mjs";
143
+ import "./tests/ParseIPv4Header.mjs";
129
144
  import "./tests/ParseObjectIDTimestamp.mjs";
130
145
  import "./tests/ParseQRCode.mjs";
131
146
  import "./tests/ParseSSHHostKey.mjs";
@@ -133,37 +148,35 @@ import "./tests/ParseTCP.mjs";
133
148
  import "./tests/ParseTLSRecord.mjs";
134
149
  import "./tests/ParseTLV.mjs";
135
150
  import "./tests/ParseUDP.mjs";
136
- import "./tests/PEMtoHex.mjs";
137
- import "./tests/PGP.mjs";
138
- import "./tests/PHP.mjs";
139
- import "./tests/ParityBit.mjs";
140
- import "./tests/PHPSerialize.mjs";
151
+ import "./tests/ParseX509CRL.mjs";
141
152
  import "./tests/PowerSet.mjs";
142
153
  import "./tests/Protobuf.mjs";
143
154
  import "./tests/PubKeyFromCert.mjs";
144
155
  import "./tests/PubKeyFromPrivKey.mjs";
145
- import "./tests/Rabbit.mjs";
146
156
  import "./tests/RAKE.mjs";
157
+ import "./tests/RC6.mjs";
158
+ import "./tests/ROR13.mjs";
159
+ import "./tests/RSA.mjs";
160
+ import "./tests/Rabbit.mjs";
147
161
  import "./tests/Regex.mjs";
148
162
  import "./tests/Register.mjs";
149
163
  import "./tests/RegularExpression.mjs";
164
+ import "./tests/RemoveANSIEscapeCodes.mjs";
150
165
  import "./tests/RenderMarkdown.mjs";
151
166
  import "./tests/RisonEncodeDecode.mjs";
152
167
  import "./tests/Rotate.mjs";
153
- import "./tests/RSA.mjs";
168
+ import "./tests/SIGABA.mjs";
169
+ import "./tests/SM2.mjs";
170
+ import "./tests/SM4.mjs";
171
+ import "./tests/SQLBeautify.mjs";
154
172
  import "./tests/Salsa20.mjs";
155
- import "./tests/XSalsa20.mjs";
156
173
  import "./tests/SeqUtils.mjs";
157
174
  import "./tests/SetDifference.mjs";
158
175
  import "./tests/SetIntersection.mjs";
159
176
  import "./tests/SetUnion.mjs";
160
177
  import "./tests/Shuffle.mjs";
161
- import "./tests/SIGABA.mjs";
162
- import "./tests/SM2.mjs";
163
- import "./tests/SM4.mjs";
164
- import "./tests/RC6.mjs";
165
- // import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet
166
- import "./tests/SQLBeautify.mjs";
178
+ // Cannot test operations that use the File type yet
179
+ // import "./tests/SplitColourChannels.mjs";
167
180
  import "./tests/StrUtils.mjs";
168
181
  import "./tests/StripIPv4Header.mjs";
169
182
  import "./tests/StripTCPHeader.mjs";
@@ -178,35 +191,28 @@ import "./tests/TextIntegerConverter.mjs";
178
191
  import "./tests/ToFromInsensitiveRegex.mjs";
179
192
  import "./tests/TranslateDateTimeFormat.mjs";
180
193
  import "./tests/Typex.mjs";
194
+ import "./tests/URLEncodeDecode.mjs";
181
195
  import "./tests/UnescapeString.mjs";
182
196
  import "./tests/Unicode.mjs";
183
- import "./tests/URLEncodeDecode.mjs";
184
- import "./tests/RSA.mjs";
185
- import "./tests/CBOREncode.mjs";
186
- import "./tests/CBORDecode.mjs";
187
- import "./tests/JA3Fingerprint.mjs";
188
- import "./tests/JA3SFingerprint.mjs";
189
- import "./tests/HASSH.mjs";
190
- import "./tests/JSONtoYAML.mjs";
191
-
192
- // Cannot test operations that use the File type yet
193
- // import "./tests/SplitColourChannels.mjs";
194
- import "./tests/YARA.mjs";
195
- import "./tests/ParseCSR.mjs";
197
+ import "./tests/Wrap.mjs";
198
+ import "./tests/XORChecksum.mjs";
199
+ import "./tests/XSalsa20.mjs";
196
200
  import "./tests/XXTEA.mjs";
201
+ import "./tests/YARA.mjs";
202
+
197
203
 
198
204
  const testStatus = {
199
205
  allTestsPassing: true,
200
206
  counts: {
201
207
  total: 0,
202
- },
208
+ }
203
209
  };
204
210
 
205
211
  setLongTestFailure();
206
212
 
207
213
  const logOpsTestReport = logTestReport.bind(null, testStatus);
208
214
 
209
- (async function () {
215
+ (async function() {
210
216
  const results = await TestRegister.runTests();
211
217
  logOpsTestReport(results);
212
218
  })();
@@ -51,5 +51,23 @@ TestRegister.addTests([
51
51
  { "op": "BLAKE3",
52
52
  "args": [8, "ThiskeyisexactlythirtytwoByteslo"] }
53
53
  ]
54
+ },
55
+ {
56
+ name: "BLAKE3: 16390 - test",
57
+ input: "test",
58
+ expectedMatch: /4878.{32760}555fe06b242738d5/,
59
+ recipeConfig: [
60
+ { "op": "BLAKE3",
61
+ "args": [16390, ""] }
62
+ ]
63
+ },
64
+ {
65
+ name: "BLAKE3: 16390 - key test",
66
+ input: "test",
67
+ expectedMatch: /a8d0.{32760}19ccd9b9726b46ae/,
68
+ recipeConfig: [
69
+ { "op": "BLAKE3",
70
+ "args": [16390, "ThiskeyisexactlythirtytwoBytesLo"] }
71
+ ]
54
72
  }
55
73
  ]);
@@ -116,4 +116,15 @@ TestRegister.addTests([
116
116
  },
117
117
  ],
118
118
  },
119
+ {
120
+ name: "Show Base64 offsets: escapes static output",
121
+ input: "\x00\x10\x83\x10\x51\x87",
122
+ expectedOutput: "<script>\n<AQmsBRk66\n<ia1AEIM6",
123
+ recipeConfig: [
124
+ {
125
+ op: "Show Base64 offsets",
126
+ args: ["<script>ale(1)/.ABCDEFGHIJKLMNOPQRSTUVWXYZbdfghjkmnoquvwxyz023456", false, "Raw"],
127
+ },
128
+ ],
129
+ },
119
130
  ]);
@@ -68,6 +68,32 @@ TestRegister.addTests([
68
68
  },
69
69
  ],
70
70
  },
71
+ {
72
+ name: "Encode text: empty encoding",
73
+ input: "hello",
74
+ expectedOutput: "Invalid encoding",
75
+ recipeConfig: [
76
+ {
77
+ "op": "Encode text",
78
+ "args": [""]
79
+ },
80
+ ],
81
+ },
82
+ {
83
+ name: "Decode text: empty encoding",
84
+ input: "68 65 6c 6c 6f",
85
+ expectedOutput: "Invalid encoding",
86
+ recipeConfig: [
87
+ {
88
+ "op": "From Hex",
89
+ "args": ["Space"]
90
+ },
91
+ {
92
+ "op": "Decode text",
93
+ "args": [""]
94
+ },
95
+ ],
96
+ },
71
97
  {
72
98
  name: "Generate Base64 Windows PowerShell",
73
99
  input: "ZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA==",
@@ -41,6 +41,17 @@ TestRegister.addTests([
41
41
  }
42
42
  ],
43
43
  },
44
+ {
45
+ name: "Series chart escapes x-axis values in serialized SVG",
46
+ input: `s,x"><script>globalThis.seriesChartInjected=1</script><g a=",1`,
47
+ unexpectedMatch: /<script>|__data__=/,
48
+ recipeConfig: [
49
+ {
50
+ "op": "Series chart",
51
+ "args": ["Line feed", "Comma", "", 1, "red"]
52
+ }
53
+ ],
54
+ },
44
55
  {
45
56
  name: "Heatmap chart",
46
57
  input: "100 100\n200 200\n300 300\n400 400\n500 500",