cyberchef 11.0.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 (63) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/Dockerfile +2 -2
  3. package/Gruntfile.js +10 -5
  4. package/README.md +3 -1
  5. package/SECURITY.md +8 -18
  6. package/package.json +35 -34
  7. package/src/core/config/Categories.json +6 -0
  8. package/src/core/config/OperationConfig.json +140 -16
  9. package/src/core/config/modules/Default.mjs +8 -0
  10. package/src/core/config/modules/PGP.mjs +2 -0
  11. package/src/core/config/scripts/generateOpsIndex.mjs +63 -0
  12. package/src/core/config/scripts/newOperation.mjs +31 -4
  13. package/src/core/operations/AESDecrypt.mjs +61 -16
  14. package/src/core/operations/AESEncrypt.mjs +26 -11
  15. package/src/core/operations/BLAKE3.mjs +13 -7
  16. package/src/core/operations/BSONDeserialise.mjs +2 -2
  17. package/src/core/operations/BSONSerialise.mjs +3 -2
  18. package/src/core/operations/Bcrypt.mjs +1 -1
  19. package/src/core/operations/BcryptCompare.mjs +1 -1
  20. package/src/core/operations/DecodeText.mjs +4 -0
  21. package/src/core/operations/EncodeText.mjs +4 -0
  22. package/src/core/operations/EscapeSmartCharacters.mjs +129 -0
  23. package/src/core/operations/GenerateLoremIpsum.mjs +34 -3
  24. package/src/core/operations/GeneratePGPKeyPair.mjs +8 -7
  25. package/src/core/operations/PGPSign.mjs +83 -0
  26. package/src/core/operations/ParseEthernetFrame.mjs +1 -1
  27. package/src/core/operations/ParseIPv4Header.mjs +1 -1
  28. package/src/core/operations/ParseObjectIDTimestamp.mjs +2 -2
  29. package/src/core/operations/ParseUserAgent.mjs +1 -1
  30. package/src/core/operations/ROR13.mjs +83 -0
  31. package/src/core/operations/RemoveANSIEscapeCodes.mjs +41 -0
  32. package/src/core/operations/SeriesChart.mjs +16 -0
  33. package/src/core/operations/Wrap.mjs +47 -0
  34. package/src/core/operations/index.mjs +10 -0
  35. package/src/node/index.mjs +25 -0
  36. package/src/web/App.mjs +19 -1
  37. package/src/web/HTMLIngredient.mjs +1 -0
  38. package/src/web/html/index.html +3 -3
  39. package/src/web/static/sitemap.mjs +3 -3
  40. package/src/web/waiters/RecipeWaiter.mjs +9 -1
  41. package/tests/browser/02_ops.js +7 -7
  42. package/tests/browser/03_recipe_load.js +48 -0
  43. package/tests/browser/browserUtils.js +6 -3
  44. package/tests/node/index.mjs +1 -0
  45. package/tests/node/tests/PGP.mjs +69 -0
  46. package/tests/node/tests/operations.mjs +41 -2
  47. package/tests/operations/index.mjs +71 -66
  48. package/tests/operations/tests/BLAKE3.mjs +18 -0
  49. package/tests/operations/tests/CharEnc.mjs +26 -0
  50. package/tests/operations/tests/Charts.mjs +11 -0
  51. package/tests/operations/tests/Crypt.mjs +288 -62
  52. package/tests/operations/tests/EscapeSmartCharacters.mjs +132 -0
  53. package/tests/operations/tests/FlaskSession.mjs +11 -8
  54. package/tests/operations/tests/GenerateLoremIpsum.mjs +80 -0
  55. package/tests/operations/tests/IPv6Transition.mjs +4 -4
  56. package/tests/operations/tests/PGP.mjs +178 -154
  57. package/tests/operations/tests/ParseEthernetFrame.mjs +11 -0
  58. package/tests/operations/tests/ParseIPv4Header.mjs +23 -0
  59. package/tests/operations/tests/ParseX509CRL.mjs +16 -16
  60. package/tests/operations/tests/ROR13.mjs +45 -0
  61. package/tests/operations/tests/Register.mjs +3 -1
  62. package/tests/operations/tests/RemoveANSIEscapeCodes.mjs +62 -0
  63. package/tests/operations/tests/Wrap.mjs +44 -0
@@ -79,7 +79,46 @@ TestRegister.addApiTests([
79
79
  string: "some iv some iv1",
80
80
  option: "utf8",
81
81
  },
82
+ ivLength: 16,
82
83
  mode: "OFB",
84
+ inputType: "Hex",
85
+ outputType: "Raw",
86
+ gcmTag: {
87
+ option: "Hex",
88
+ string: ""
89
+ },
90
+ aad: {
91
+ option: "Hex",
92
+ string: ""
93
+ },
94
+ ivFromInput: "Off"
95
+ });
96
+ assert.equal(result.toString(), "a slightly longer sampleinput?");
97
+ }),
98
+
99
+ it("AES decrypt: IV from input", () => {
100
+ const result = AESDecrypt("4a123af235a507bbc9d5871721d61b98504d569a9a5a7847e2d78315fec7736f6d6520697620736f6d6520697631", {
101
+ key: {
102
+ string: "some longer key1",
103
+ option: "utf8",
104
+ },
105
+ iv: {
106
+ string: "",
107
+ option: "Hex",
108
+ },
109
+ ivLength: 16,
110
+ mode: "OFB",
111
+ inputType: "Hex",
112
+ outputType: "Raw",
113
+ gcmTag: {
114
+ option: "Hex",
115
+ string: ""
116
+ },
117
+ aad: {
118
+ option: "Hex",
119
+ string: ""
120
+ },
121
+ ivFromInput: "From end"
83
122
  });
84
123
  assert.equal(result.toString(), "a slightly longer sampleinput?");
85
124
  }),
@@ -136,8 +175,8 @@ Tiger-128`;
136
175
  it("Bcrypt", async () => {
137
176
  const result = await chef.bcrypt("Put a Sock In It");
138
177
  const strResult = result.toString();
139
- assert.equal(strResult.length, 60);
140
- assert.equal(strResult.slice(0, 7), "$2a$10$");
178
+ assert.match(strResult, /^\$2b\$10\$[./A-Za-z0-9]{53}$/);
179
+ assert.equal(strResult.split("$").length, 4);
141
180
  }),
142
181
 
143
182
  it("bcryptCompare", async() => {
@@ -1,25 +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
16
  import "../lib/wasmFetchPolyfill.mjs";
15
- import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
16
17
 
17
18
  import TestRegister from "../lib/TestRegister.mjs";
18
19
  import "./tests/A1Z26CipherDecode.mjs";
19
20
  import "./tests/AESKeyWrap.mjs";
20
- import "./tests/AnalyseUUID.mjs";
21
21
  import "./tests/AlternatingCaps.mjs";
22
+ import "./tests/AnalyseUUID.mjs";
22
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";
23
29
  import "./tests/BaconCipher.mjs";
24
30
  import "./tests/Base32.mjs";
25
31
  import "./tests/Base45.mjs";
@@ -28,29 +34,26 @@ import "./tests/Base62.mjs";
28
34
  import "./tests/Base64.mjs";
29
35
  import "./tests/Base85.mjs";
30
36
  import "./tests/Base92.mjs";
31
- import "./tests/BCD.mjs";
32
37
  import "./tests/Bech32.mjs";
33
38
  import "./tests/BitwiseOp.mjs";
34
- import "./tests/BLAKE2b.mjs";
35
- import "./tests/BLAKE2s.mjs";
36
- import "./tests/BLAKE3.mjs";
37
39
  import "./tests/Bombe.mjs";
38
- import "./tests/BSON.mjs";
39
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";
40
46
  import "./tests/CaesarBoxCipher.mjs";
41
47
  import "./tests/CaretMdecode.mjs";
42
48
  import "./tests/CartesianProduct.mjs";
43
- import "./tests/CBORDecode.mjs";
44
- import "./tests/CBOREncode.mjs";
45
49
  import "./tests/CetaceanCipherDecode.mjs";
46
50
  import "./tests/CetaceanCipherEncode.mjs";
47
51
  import "./tests/ChaCha.mjs";
48
52
  import "./tests/ChangeIPFormat.mjs";
49
53
  import "./tests/CharEnc.mjs";
50
54
  import "./tests/Charts.mjs";
51
- import "./tests/Ciphers.mjs";
52
55
  import "./tests/CipherSaber2.mjs";
53
- import "./tests/CMAC.mjs";
56
+ import "./tests/Ciphers.mjs";
54
57
  import "./tests/Code.mjs";
55
58
  import "./tests/Colossus.mjs";
56
59
  import "./tests/Comment.mjs";
@@ -59,9 +62,7 @@ import "./tests/ConditionalJump.mjs";
59
62
  import "./tests/ConvertCoordinateFormat.mjs";
60
63
  import "./tests/ConvertLeetSpeak.mjs";
61
64
  import "./tests/ConvertToNATOAlphabet.mjs";
62
- import "./tests/CRCChecksum.mjs";
63
65
  import "./tests/Crypt.mjs";
64
- import "./tests/CSV.mjs";
65
66
  import "./tests/DateTime.mjs";
66
67
  import "./tests/DefangIP.mjs";
67
68
  import "./tests/DisassembleARM.mjs";
@@ -69,64 +70,77 @@ import "./tests/DropNthBytes.mjs";
69
70
  import "./tests/ECDSA.mjs";
70
71
  import "./tests/ELFInfo.mjs";
71
72
  import "./tests/Enigma.mjs";
73
+ import "./tests/EscapeSmartCharacters.mjs";
72
74
  import "./tests/ExtractAudioMetadata.mjs";
73
75
  import "./tests/ExtractEmailAddresses.mjs";
74
76
  import "./tests/ExtractHashes.mjs";
75
77
  import "./tests/ExtractIPAddresses.mjs";
76
78
  import "./tests/Fernet.mjs";
77
- import "./tests/Float.mjs";
78
79
  import "./tests/FileTree.mjs";
80
+ import "./tests/FlaskSession.mjs";
79
81
  import "./tests/FletcherChecksum.mjs";
82
+ import "./tests/Float.mjs";
80
83
  import "./tests/Fork.mjs";
81
84
  import "./tests/FromDecimal.mjs";
85
+ import "./tests/GOST.mjs";
82
86
  import "./tests/GenerateAllChecksums.mjs";
83
87
  import "./tests/GenerateAllHashes.mjs";
84
88
  import "./tests/GenerateDeBruijnSequence.mjs";
89
+ import "./tests/GenerateLoremIpsum.mjs";
85
90
  import "./tests/GenerateQRCode.mjs";
86
91
  import "./tests/GetAllCasings.mjs";
87
- import "./tests/GOST.mjs";
88
92
  import "./tests/Gunzip.mjs";
89
93
  import "./tests/Gzip.mjs";
90
- import "./tests/Hash.mjs";
91
94
  import "./tests/HASSH.mjs";
95
+ import "./tests/HKDF.mjs";
96
+ import "./tests/Hash.mjs";
92
97
  import "./tests/HaversineDistance.mjs";
93
98
  import "./tests/Hex.mjs";
94
99
  import "./tests/Hexdump.mjs";
95
- import "./tests/HKDF.mjs";
100
+ import "./tests/IPv6Transition.mjs";
96
101
  import "./tests/Image.mjs";
97
102
  import "./tests/IndexOfCoincidence.mjs";
98
103
  import "./tests/JA3Fingerprint.mjs";
99
- import "./tests/JA4.mjs";
100
104
  import "./tests/JA3SFingerprint.mjs";
101
- import "./tests/Jsonata.mjs";
105
+ import "./tests/JA4.mjs";
102
106
  import "./tests/JSONBeautify.mjs";
103
107
  import "./tests/JSONMinify.mjs";
104
108
  import "./tests/JSONtoCSV.mjs";
105
- import "./tests/Jump.mjs";
109
+ import "./tests/JSONtoYAML.mjs";
106
110
  import "./tests/JWK.mjs";
107
111
  import "./tests/JWTDecode.mjs";
108
112
  import "./tests/JWTSign.mjs";
109
113
  import "./tests/JWTVerify.mjs";
110
- import "./tests/LevenshteinDistance.mjs";
111
- import "./tests/Lorenz.mjs";
114
+ import "./tests/Jq.mjs";
115
+ import "./tests/Jsonata.mjs";
116
+ import "./tests/Jump.mjs";
112
117
  import "./tests/LS47.mjs";
113
- import "./tests/LuhnChecksum.mjs";
114
118
  import "./tests/LZNT1Decompress.mjs";
115
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";
116
125
  import "./tests/Magic.mjs";
117
126
  import "./tests/Media.mjs";
118
- import "./tests/MIMEDecoding.mjs";
119
127
  import "./tests/Modhex.mjs";
120
128
  import "./tests/MorseCode.mjs";
121
- import "./tests/MS.mjs";
122
129
  import "./tests/MultipleBombe.mjs";
123
130
  import "./tests/MurmurHash3.mjs";
131
+ import "./tests/NTLM.mjs";
124
132
  import "./tests/NetBIOS.mjs";
125
133
  import "./tests/NormaliseUnicode.mjs";
126
- import "./tests/NTLM.mjs";
127
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";
128
141
  import "./tests/ParseEthernetFrame.mjs";
129
142
  import "./tests/ParseIPRange.mjs";
143
+ import "./tests/ParseIPv4Header.mjs";
130
144
  import "./tests/ParseObjectIDTimestamp.mjs";
131
145
  import "./tests/ParseQRCode.mjs";
132
146
  import "./tests/ParseSSHHostKey.mjs";
@@ -134,37 +148,35 @@ import "./tests/ParseTCP.mjs";
134
148
  import "./tests/ParseTLSRecord.mjs";
135
149
  import "./tests/ParseTLV.mjs";
136
150
  import "./tests/ParseUDP.mjs";
137
- import "./tests/PEMtoHex.mjs";
138
- import "./tests/PGP.mjs";
139
- import "./tests/PHP.mjs";
140
- import "./tests/ParityBit.mjs";
141
- import "./tests/PHPSerialize.mjs";
151
+ import "./tests/ParseX509CRL.mjs";
142
152
  import "./tests/PowerSet.mjs";
143
153
  import "./tests/Protobuf.mjs";
144
154
  import "./tests/PubKeyFromCert.mjs";
145
155
  import "./tests/PubKeyFromPrivKey.mjs";
146
- import "./tests/Rabbit.mjs";
147
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";
148
161
  import "./tests/Regex.mjs";
149
162
  import "./tests/Register.mjs";
150
163
  import "./tests/RegularExpression.mjs";
164
+ import "./tests/RemoveANSIEscapeCodes.mjs";
151
165
  import "./tests/RenderMarkdown.mjs";
152
166
  import "./tests/RisonEncodeDecode.mjs";
153
167
  import "./tests/Rotate.mjs";
154
- import "./tests/RSA.mjs";
168
+ import "./tests/SIGABA.mjs";
169
+ import "./tests/SM2.mjs";
170
+ import "./tests/SM4.mjs";
171
+ import "./tests/SQLBeautify.mjs";
155
172
  import "./tests/Salsa20.mjs";
156
- import "./tests/XSalsa20.mjs";
157
173
  import "./tests/SeqUtils.mjs";
158
174
  import "./tests/SetDifference.mjs";
159
175
  import "./tests/SetIntersection.mjs";
160
176
  import "./tests/SetUnion.mjs";
161
177
  import "./tests/Shuffle.mjs";
162
- import "./tests/SIGABA.mjs";
163
- import "./tests/SM2.mjs";
164
- import "./tests/SM4.mjs";
165
- import "./tests/RC6.mjs";
166
- // import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet
167
- import "./tests/SQLBeautify.mjs";
178
+ // Cannot test operations that use the File type yet
179
+ // import "./tests/SplitColourChannels.mjs";
168
180
  import "./tests/StrUtils.mjs";
169
181
  import "./tests/StripIPv4Header.mjs";
170
182
  import "./tests/StripTCPHeader.mjs";
@@ -179,35 +191,28 @@ import "./tests/TextIntegerConverter.mjs";
179
191
  import "./tests/ToFromInsensitiveRegex.mjs";
180
192
  import "./tests/TranslateDateTimeFormat.mjs";
181
193
  import "./tests/Typex.mjs";
194
+ import "./tests/URLEncodeDecode.mjs";
182
195
  import "./tests/UnescapeString.mjs";
183
196
  import "./tests/Unicode.mjs";
184
- import "./tests/URLEncodeDecode.mjs";
185
- import "./tests/RSA.mjs";
186
- import "./tests/CBOREncode.mjs";
187
- import "./tests/CBORDecode.mjs";
188
- import "./tests/JA3Fingerprint.mjs";
189
- import "./tests/JA3SFingerprint.mjs";
190
- import "./tests/HASSH.mjs";
191
- import "./tests/JSONtoYAML.mjs";
192
-
193
- // Cannot test operations that use the File type yet
194
- // import "./tests/SplitColourChannels.mjs";
195
- import "./tests/YARA.mjs";
196
- import "./tests/ParseCSR.mjs";
197
+ import "./tests/Wrap.mjs";
198
+ import "./tests/XORChecksum.mjs";
199
+ import "./tests/XSalsa20.mjs";
197
200
  import "./tests/XXTEA.mjs";
201
+ import "./tests/YARA.mjs";
202
+
198
203
 
199
204
  const testStatus = {
200
205
  allTestsPassing: true,
201
206
  counts: {
202
207
  total: 0,
203
- },
208
+ }
204
209
  };
205
210
 
206
211
  setLongTestFailure();
207
212
 
208
213
  const logOpsTestReport = logTestReport.bind(null, testStatus);
209
214
 
210
- (async function () {
215
+ (async function() {
211
216
  const results = await TestRegister.runTests();
212
217
  logOpsTestReport(results);
213
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
  ]);
@@ -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",