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.
- package/.devcontainer/devcontainer.json +1 -1
- package/.nvmrc +1 -1
- package/CHANGELOG.md +172 -0
- package/Dockerfile +2 -2
- package/Gruntfile.js +11 -6
- package/README.md +6 -4
- package/SECURITY.md +8 -18
- package/babel.config.js +4 -1
- package/package.json +48 -43
- package/src/core/ChefWorker.js +1 -1
- package/src/core/Recipe.mjs +1 -1
- package/src/core/config/Categories.json +6 -0
- package/src/core/config/OperationConfig.json +140 -16
- package/src/core/config/modules/Default.mjs +8 -0
- package/src/core/config/modules/PGP.mjs +2 -0
- package/src/core/config/scripts/generateOpsIndex.mjs +63 -0
- package/src/core/config/scripts/newOperation.mjs +31 -4
- package/src/core/lib/Magic.mjs +1 -1
- package/src/core/operations/AESDecrypt.mjs +61 -16
- package/src/core/operations/AESEncrypt.mjs +26 -11
- package/src/core/operations/BLAKE3.mjs +13 -7
- package/src/core/operations/BSONDeserialise.mjs +2 -2
- package/src/core/operations/BSONSerialise.mjs +3 -2
- package/src/core/operations/Bcrypt.mjs +1 -1
- package/src/core/operations/BcryptCompare.mjs +1 -1
- package/src/core/operations/DecodeText.mjs +4 -0
- package/src/core/operations/EncodeText.mjs +4 -0
- package/src/core/operations/EscapeSmartCharacters.mjs +129 -0
- package/src/core/operations/FromPunycode.mjs +1 -1
- package/src/core/operations/GenerateLoremIpsum.mjs +34 -3
- package/src/core/operations/GeneratePGPKeyPair.mjs +8 -7
- package/src/core/operations/PGPSign.mjs +83 -0
- package/src/core/operations/ParseEthernetFrame.mjs +1 -1
- package/src/core/operations/ParseIPv4Header.mjs +1 -1
- package/src/core/operations/ParseObjectIDTimestamp.mjs +2 -2
- package/src/core/operations/ParseUserAgent.mjs +1 -1
- package/src/core/operations/ROR13.mjs +83 -0
- package/src/core/operations/RemoveANSIEscapeCodes.mjs +41 -0
- package/src/core/operations/SeriesChart.mjs +16 -0
- package/src/core/operations/ShowBase64Offsets.mjs +28 -28
- package/src/core/operations/ToPunycode.mjs +1 -1
- package/src/core/operations/Wrap.mjs +47 -0
- package/src/core/operations/index.mjs +10 -0
- package/src/node/NodeRecipe.mjs +8 -7
- package/src/node/api.mjs +4 -4
- package/src/node/index.mjs +25 -0
- package/src/web/App.mjs +19 -1
- package/src/web/HTMLIngredient.mjs +1 -0
- package/src/web/html/index.html +3 -3
- package/src/web/index.js +2 -2
- package/src/web/static/sitemap.mjs +4 -4
- package/src/web/waiters/RecipeWaiter.mjs +9 -1
- package/tests/browser/02_ops.js +7 -7
- package/tests/browser/03_recipe_load.js +48 -0
- package/tests/browser/browserUtils.js +6 -3
- package/tests/lib/wasmFetchPolyfill.mjs +31 -0
- package/tests/node/consumers/cjs-consumer.js +2 -2
- package/tests/node/consumers/esm-consumer.mjs +2 -2
- package/tests/node/index.mjs +1 -0
- package/tests/node/tests/Categories.mjs +2 -2
- package/tests/node/tests/PGP.mjs +69 -0
- package/tests/node/tests/nodeApi.mjs +55 -58
- package/tests/node/tests/operations.mjs +41 -2
- package/tests/operations/index.mjs +72 -66
- package/tests/operations/tests/BLAKE3.mjs +18 -0
- package/tests/operations/tests/Base64.mjs +11 -0
- package/tests/operations/tests/CharEnc.mjs +26 -0
- package/tests/operations/tests/Charts.mjs +11 -0
- package/tests/operations/tests/Crypt.mjs +288 -62
- package/tests/operations/tests/EscapeSmartCharacters.mjs +132 -0
- package/tests/operations/tests/FlaskSession.mjs +11 -8
- package/tests/operations/tests/GenerateLoremIpsum.mjs +80 -0
- package/tests/operations/tests/IPv6Transition.mjs +4 -4
- package/tests/operations/tests/PGP.mjs +178 -154
- package/tests/operations/tests/ParseEthernetFrame.mjs +11 -0
- package/tests/operations/tests/ParseIPv4Header.mjs +23 -0
- package/tests/operations/tests/ParseX509CRL.mjs +16 -16
- package/tests/operations/tests/ROR13.mjs +45 -0
- package/tests/operations/tests/Register.mjs +3 -1
- package/tests/operations/tests/RemoveANSIEscapeCodes.mjs +62 -0
- package/tests/operations/tests/Wrap.mjs +44 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape Smart Characters tests
|
|
3
|
+
*
|
|
4
|
+
* @author HarelKatz [github.com/HarelKatz]
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
9
|
+
|
|
10
|
+
TestRegister.addTests([
|
|
11
|
+
{
|
|
12
|
+
"name": "Escape Smart Characters: smart quotes and apostrophes",
|
|
13
|
+
"input": "“Hello,” she said, ‘yes.’",
|
|
14
|
+
"expectedOutput": "\"Hello,\" she said, 'yes.'",
|
|
15
|
+
"recipeConfig": [
|
|
16
|
+
{
|
|
17
|
+
"op": "Escape Smart Characters",
|
|
18
|
+
"args": ["Include"]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Escape Smart Characters: em dash, en dash and ellipsis",
|
|
24
|
+
"input": "page 1–3 — wait…",
|
|
25
|
+
"expectedOutput": "page 1-3 -- wait...",
|
|
26
|
+
"recipeConfig": [
|
|
27
|
+
{
|
|
28
|
+
"op": "Escape Smart Characters",
|
|
29
|
+
"args": ["Include"]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "Escape Smart Characters: trademark symbols",
|
|
35
|
+
"input": "Foo© Bar® Baz™",
|
|
36
|
+
"expectedOutput": "Foo(c) Bar(r) Baz(tm)",
|
|
37
|
+
"recipeConfig": [
|
|
38
|
+
{
|
|
39
|
+
"op": "Escape Smart Characters",
|
|
40
|
+
"args": ["Include"]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "Escape Smart Characters: arrows and guillemets",
|
|
46
|
+
"input": "← → ↔ ⇒ « »",
|
|
47
|
+
"expectedOutput": "<-- --> <-> ==> << >>",
|
|
48
|
+
"recipeConfig": [
|
|
49
|
+
{
|
|
50
|
+
"op": "Escape Smart Characters",
|
|
51
|
+
"args": ["Include"]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "Escape Smart Characters: math and misc",
|
|
57
|
+
"input": "3 × 4 ÷ 2 = 6, ±0.5 • item",
|
|
58
|
+
"expectedOutput": "3 x 4 / 2 = 6, +/-0.5 * item",
|
|
59
|
+
"recipeConfig": [
|
|
60
|
+
{
|
|
61
|
+
"op": "Escape Smart Characters",
|
|
62
|
+
"args": ["Include"]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "Escape Smart Characters: NBSP becomes regular space",
|
|
68
|
+
"input": "a b c",
|
|
69
|
+
"expectedOutput": "a b c",
|
|
70
|
+
"recipeConfig": [
|
|
71
|
+
{
|
|
72
|
+
"op": "Escape Smart Characters",
|
|
73
|
+
"args": ["Include"]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "Escape Smart Characters: unmappable Include preserves char",
|
|
79
|
+
"input": "warning: ☣ hazard",
|
|
80
|
+
"expectedOutput": "warning: ☣ hazard",
|
|
81
|
+
"recipeConfig": [
|
|
82
|
+
{
|
|
83
|
+
"op": "Escape Smart Characters",
|
|
84
|
+
"args": ["Include"]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "Escape Smart Characters: unmappable Remove drops char",
|
|
90
|
+
"input": "warning: ☣ hazard",
|
|
91
|
+
"expectedOutput": "warning: hazard",
|
|
92
|
+
"recipeConfig": [
|
|
93
|
+
{
|
|
94
|
+
"op": "Escape Smart Characters",
|
|
95
|
+
"args": ["Remove"]
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "Escape Smart Characters: unmappable Replace substitutes dot",
|
|
101
|
+
"input": "warning: ☣ hazard",
|
|
102
|
+
"expectedOutput": "warning: . hazard",
|
|
103
|
+
"recipeConfig": [
|
|
104
|
+
{
|
|
105
|
+
"op": "Escape Smart Characters",
|
|
106
|
+
"args": ["Replace with '.'"]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "Escape Smart Characters: pure ASCII passes through",
|
|
112
|
+
"input": "hello world! 123",
|
|
113
|
+
"expectedOutput": "hello world! 123",
|
|
114
|
+
"recipeConfig": [
|
|
115
|
+
{
|
|
116
|
+
"op": "Escape Smart Characters",
|
|
117
|
+
"args": ["Include"]
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "Escape Smart Characters: empty input",
|
|
123
|
+
"input": "",
|
|
124
|
+
"expectedOutput": "",
|
|
125
|
+
"recipeConfig": [
|
|
126
|
+
{
|
|
127
|
+
"op": "Escape Smart Characters",
|
|
128
|
+
"args": ["Include"]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
]);
|
|
@@ -14,15 +14,18 @@ const validTokenSha256 = "eyJyb2xlIjoic3VwZXJ1c2VyIiwidXNlciI6ImFkbWluIn0.aab3Ew
|
|
|
14
14
|
const validKey = "mysecretkey";
|
|
15
15
|
const wrongKey = "notTheKey";
|
|
16
16
|
|
|
17
|
-
const outputObject = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
17
|
+
const outputObject = `{
|
|
18
|
+
"role": "superuser",
|
|
19
|
+
"user": "admin"
|
|
20
|
+
}`;
|
|
21
21
|
|
|
22
|
-
const outputVerify = {
|
|
23
|
-
valid: true,
|
|
24
|
-
payload:
|
|
25
|
-
|
|
22
|
+
const outputVerify = `{
|
|
23
|
+
"valid": true,
|
|
24
|
+
"payload": {
|
|
25
|
+
"role": "superuser",
|
|
26
|
+
"user": "admin"
|
|
27
|
+
}
|
|
28
|
+
}`;
|
|
26
29
|
|
|
27
30
|
TestRegister.addTests([
|
|
28
31
|
{
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate Lorem Ipsum tests
|
|
3
|
+
*
|
|
4
|
+
* @author GCHQDeveloper581
|
|
5
|
+
* @copyright Crown Copyright 2025
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
9
|
+
|
|
10
|
+
TestRegister.addTests([
|
|
11
|
+
{
|
|
12
|
+
name: "Generate Lorem Ipsum: Exceeds Word Limit",
|
|
13
|
+
input: "",
|
|
14
|
+
expectedOutput: "Length must be less than 100000",
|
|
15
|
+
recipeConfig: [
|
|
16
|
+
{
|
|
17
|
+
"op": "Generate Lorem Ipsum",
|
|
18
|
+
"args": [999_999, "Words"]
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "Generate Lorem Ipsum: Within Word Limit",
|
|
24
|
+
input: "",
|
|
25
|
+
// each word is >= 3 characters long, so expect at least 3000 characters
|
|
26
|
+
expectedMatch: /.{3000,}/s,
|
|
27
|
+
recipeConfig: [
|
|
28
|
+
{
|
|
29
|
+
"op": "Generate Lorem Ipsum",
|
|
30
|
+
"args": [1000, "Words"]
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "Generate Lorem Ipsum: Exceeds Byte Limit",
|
|
36
|
+
input: "",
|
|
37
|
+
expectedOutput: "Length must be less than 1000000",
|
|
38
|
+
recipeConfig: [
|
|
39
|
+
{
|
|
40
|
+
"op": "Generate Lorem Ipsum",
|
|
41
|
+
"args": [1_000_001, "Bytes"]
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "Generate Lorem Ipsum: Exceeds Sentence Limit",
|
|
47
|
+
input: "",
|
|
48
|
+
expectedOutput: "Length must be less than 100000",
|
|
49
|
+
recipeConfig: [
|
|
50
|
+
{
|
|
51
|
+
"op": "Generate Lorem Ipsum",
|
|
52
|
+
"args": [999_999, "Sentences"]
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Generate Lorem Ipsum: Exceeds Paragraph Limit",
|
|
58
|
+
input: "",
|
|
59
|
+
expectedOutput: "Length must be less than 100000",
|
|
60
|
+
recipeConfig: [
|
|
61
|
+
{
|
|
62
|
+
"op": "Generate Lorem Ipsum",
|
|
63
|
+
"args": [999_999, "Paragraphs"]
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "Generate Lorem Ipsum: Incorrect lengthType",
|
|
69
|
+
input: "",
|
|
70
|
+
expectedOutput: "Invalid length type",
|
|
71
|
+
recipeConfig: [
|
|
72
|
+
{
|
|
73
|
+
"op": "Generate Lorem Ipsum",
|
|
74
|
+
"args": [999_999, "Novels"]
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
]);
|
|
@@ -12,7 +12,7 @@ TestRegister.addTests([
|
|
|
12
12
|
{
|
|
13
13
|
name: "IPv6 Transition: IPv4 to IPv6",
|
|
14
14
|
input: "198.51.100.7",
|
|
15
|
-
expectedOutput: "6to4: 2002:c633:6407::/48\nIPv4 Mapped: ::ffff:c633:6407\nIPv4 Translated: ::ffff:0:c633:6407\nNat 64: 64:ff9b::c633:6407",
|
|
15
|
+
expectedOutput: "6to4: 2002:c633:6407::/48\nIPv4 Mapped: ::ffff:c633:6407\nIPv4 Translated: ::ffff:0:c633:6407\nNat 64: 64:ff9b::c633:6407\n",
|
|
16
16
|
recipeConfig: [
|
|
17
17
|
{
|
|
18
18
|
op: "IPv6 Transition Addresses",
|
|
@@ -22,7 +22,7 @@ TestRegister.addTests([
|
|
|
22
22
|
}, {
|
|
23
23
|
name: "IPv6 Transition: IPv4 /24 Range to IPv6",
|
|
24
24
|
input: "198.51.100.0/24",
|
|
25
|
-
expectedOutput: "6to4: 2002:c633:6400::/40\nIPv4 Mapped: ::ffff:c633:6400/120\nIPv4 Translated: ::ffff:0:c633:6400/120\nNat 64: 64:ff9b::c633:6400/120",
|
|
25
|
+
expectedOutput: "6to4: 2002:c633:6400::/40\nIPv4 Mapped: ::ffff:c633:6400/120\nIPv4 Translated: ::ffff:0:c633:6400/120\nNat 64: 64:ff9b::c633:6400/120\n",
|
|
26
26
|
recipeConfig: [
|
|
27
27
|
{
|
|
28
28
|
op: "IPv6 Transition Addresses",
|
|
@@ -32,7 +32,7 @@ TestRegister.addTests([
|
|
|
32
32
|
}, {
|
|
33
33
|
name: "IPv6 Transition: IPv4 to IPv6 Remove headers",
|
|
34
34
|
input: "198.51.100.7",
|
|
35
|
-
expectedOutput: "2002:c633:6407::/48\n::ffff:c633:6407\n::ffff:0:c633:6407\n64:ff9b::c633:6407",
|
|
35
|
+
expectedOutput: "2002:c633:6407::/48\n::ffff:c633:6407\n::ffff:0:c633:6407\n64:ff9b::c633:6407\n",
|
|
36
36
|
recipeConfig: [
|
|
37
37
|
{
|
|
38
38
|
op: "IPv6 Transition Addresses",
|
|
@@ -42,7 +42,7 @@ TestRegister.addTests([
|
|
|
42
42
|
}, {
|
|
43
43
|
name: "IPv6 Transition: IPv6 to IPv4",
|
|
44
44
|
input: "64:ff9b::c633:6407",
|
|
45
|
-
expectedOutput: "IPv4: 198.51.100.7",
|
|
45
|
+
expectedOutput: "IPv4: 198.51.100.7\n",
|
|
46
46
|
recipeConfig: [
|
|
47
47
|
{
|
|
48
48
|
op: "IPv6 Transition Addresses",
|