cyberchef 9.34.0 → 9.35.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 +5 -0
- package/Gruntfile.js +28 -43
- package/README.md +0 -1
- package/package.json +35 -40
- package/src/core/Utils.mjs +26 -1
- package/src/core/config/Categories.json +2 -0
- package/src/core/config/OperationConfig.json +36 -0
- package/src/core/config/modules/Default.mjs +4 -0
- package/src/core/lib/Base45.mjs +27 -0
- package/src/core/operations/DeriveEVPKey.mjs +1 -1
- package/src/core/operations/FromBase45.mjs +89 -0
- package/src/core/operations/ToBase45.mjs +78 -0
- package/src/core/operations/index.mjs +4 -0
- package/src/node/index.mjs +10 -0
- package/src/web/html/index.html +7 -7
- package/tests/browser/nightwatch.js +4 -4
- package/tests/browser/ops.js +4 -4
- package/tests/node/tests/operations.mjs +2 -2
- package/tests/operations/index.mjs +1 -0
- package/tests/operations/tests/Base45.mjs +103 -0
- package/webpack.config.js +20 -38
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.35.0] - 2022-03-28
|
|
17
|
+
- 'To Base45' and 'From Base45' operations added [@t-8ch] | [#1242]
|
|
18
|
+
|
|
16
19
|
### [9.34.0] - 2022-03-28
|
|
17
20
|
- 'Get All Casings' operation added [@n1073645] | [#1065]
|
|
18
21
|
|
|
@@ -278,6 +281,7 @@ All major and minor version changes will be documented in this file. Details of
|
|
|
278
281
|
|
|
279
282
|
|
|
280
283
|
|
|
284
|
+
[9.35.0]: https://github.com/gchq/CyberChef/releases/tag/v9.35.0
|
|
281
285
|
[9.34.0]: https://github.com/gchq/CyberChef/releases/tag/v9.34.0
|
|
282
286
|
[9.33.0]: https://github.com/gchq/CyberChef/releases/tag/v9.33.0
|
|
283
287
|
[9.32.0]: https://github.com/gchq/CyberChef/releases/tag/v9.32.0
|
|
@@ -482,6 +486,7 @@ All major and minor version changes will be documented in this file. Details of
|
|
|
482
486
|
[#1049]: https://github.com/gchq/CyberChef/pull/1049
|
|
483
487
|
[#1065]: https://github.com/gchq/CyberChef/pull/1065
|
|
484
488
|
[#1083]: https://github.com/gchq/CyberChef/pull/1083
|
|
489
|
+
[#1242]: https://github.com/gchq/CyberChef/pull/1242
|
|
485
490
|
[#1244]: https://github.com/gchq/CyberChef/pull/1244
|
|
486
491
|
[#1313]: https://github.com/gchq/CyberChef/pull/1313
|
|
487
492
|
[#1326]: https://github.com/gchq/CyberChef/pull/1326
|
package/Gruntfile.js
CHANGED
|
@@ -200,50 +200,35 @@ module.exports = function (grunt) {
|
|
|
200
200
|
web: webpackProdConf(),
|
|
201
201
|
},
|
|
202
202
|
"webpack-dev-server": {
|
|
203
|
-
options:
|
|
204
|
-
webpack: webpackConfig,
|
|
205
|
-
host: "0.0.0.0",
|
|
206
|
-
port: grunt.option("port") || 8080,
|
|
207
|
-
disableHostCheck: true,
|
|
208
|
-
overlay: true,
|
|
209
|
-
inline: false,
|
|
210
|
-
clientLogLevel: "error",
|
|
211
|
-
stats: {
|
|
212
|
-
children: false,
|
|
213
|
-
chunks: false,
|
|
214
|
-
modules: false,
|
|
215
|
-
entrypoints: false,
|
|
216
|
-
warningsFilter: [
|
|
217
|
-
/source-map/,
|
|
218
|
-
/dependency is an expression/,
|
|
219
|
-
/export 'default'/,
|
|
220
|
-
/Can't resolve 'sodium'/
|
|
221
|
-
],
|
|
222
|
-
}
|
|
223
|
-
},
|
|
203
|
+
options: webpackConfig,
|
|
224
204
|
start: {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
205
|
+
mode: "development",
|
|
206
|
+
target: "web",
|
|
207
|
+
entry: Object.assign({
|
|
208
|
+
main: "./src/web/index.js"
|
|
209
|
+
}, moduleEntryPoints),
|
|
210
|
+
resolve: {
|
|
211
|
+
alias: {
|
|
212
|
+
"./config/modules/OpModules.mjs": "./config/modules/Default.mjs"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
devServer: {
|
|
216
|
+
port: grunt.option("port") || 8080,
|
|
217
|
+
client: {
|
|
218
|
+
logging: "error",
|
|
219
|
+
overlay: true
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
plugins: [
|
|
223
|
+
new webpack.DefinePlugin(BUILD_CONSTANTS),
|
|
224
|
+
new HtmlWebpackPlugin({
|
|
225
|
+
filename: "index.html",
|
|
226
|
+
template: "./src/web/html/index.html",
|
|
227
|
+
chunks: ["main"],
|
|
228
|
+
compileTime: compileTime,
|
|
229
|
+
version: pkg.version,
|
|
230
|
+
})
|
|
231
|
+
]
|
|
247
232
|
}
|
|
248
233
|
},
|
|
249
234
|
zip: {
|
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/gchq/CyberChef/actions?query=workflow%3A%22Master+Build%2C+Test+%26+Deploy%22)
|
|
4
4
|
[](https://lgtm.com/projects/g/gchq/CyberChef/context:javascript)
|
|
5
|
-
[](https://david-dm.org/gchq/CyberChef)
|
|
6
5
|
[](https://www.npmjs.com/package/cyberchef)
|
|
7
6
|
[](https://github.com/gchq/CyberChef/blob/master/LICENSE)
|
|
8
7
|
[](https://gitter.im/gchq/CyberChef?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyberchef",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.35.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",
|
|
@@ -45,18 +45,16 @@
|
|
|
45
45
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
46
46
|
"@babel/preset-env": "^7.16.11",
|
|
47
47
|
"@babel/runtime": "^7.17.8",
|
|
48
|
-
"autoprefixer": "^10.
|
|
48
|
+
"autoprefixer": "^10.4.4",
|
|
49
49
|
"babel-loader": "^8.2.4",
|
|
50
50
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
51
51
|
"chromedriver": "^99.0.0",
|
|
52
|
-
"cli-progress": "^3.
|
|
52
|
+
"cli-progress": "^3.10.0",
|
|
53
53
|
"colors": "^1.4.0",
|
|
54
|
-
"copy-webpack-plugin": "^
|
|
54
|
+
"copy-webpack-plugin": "^10.2.4",
|
|
55
55
|
"core-js": "^3.21.1",
|
|
56
|
-
"css-loader": "
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"exports-loader": "^3.0.0",
|
|
59
|
-
"file-loader": "^6.2.0",
|
|
56
|
+
"css-loader": "6.7.1",
|
|
57
|
+
"eslint": "^8.12.0",
|
|
60
58
|
"grunt": "^1.4.1",
|
|
61
59
|
"grunt-chmod": "~1.1.1",
|
|
62
60
|
"grunt-concurrent": "^3.0.0",
|
|
@@ -66,25 +64,23 @@
|
|
|
66
64
|
"grunt-contrib-watch": "^1.1.0",
|
|
67
65
|
"grunt-eslint": "^24.0.0",
|
|
68
66
|
"grunt-exec": "~3.0.0",
|
|
69
|
-
"grunt-webpack": "^
|
|
67
|
+
"grunt-webpack": "^5.0.0",
|
|
70
68
|
"grunt-zip": "^0.18.2",
|
|
71
|
-
"html-webpack-plugin": "^5.
|
|
72
|
-
"imports-loader": "^3.
|
|
73
|
-
"mini-css-extract-plugin": "
|
|
74
|
-
"nightwatch": "^
|
|
75
|
-
"postcss": "^8.
|
|
69
|
+
"html-webpack-plugin": "^5.5.0",
|
|
70
|
+
"imports-loader": "^3.1.1",
|
|
71
|
+
"mini-css-extract-plugin": "2.6.0",
|
|
72
|
+
"nightwatch": "^2.0.10",
|
|
73
|
+
"postcss": "^8.4.12",
|
|
76
74
|
"postcss-css-variables": "^0.18.0",
|
|
77
|
-
"postcss-import": "^14.0
|
|
78
|
-
"postcss-loader": "^6.
|
|
79
|
-
"prompt": "^1.
|
|
80
|
-
"sass-loader": "^12.
|
|
81
|
-
"sitemap": "^7.
|
|
82
|
-
"
|
|
83
|
-
"svg-url-loader": "^7.1.1",
|
|
84
|
-
"url-loader": "^4.1.1",
|
|
75
|
+
"postcss-import": "^14.1.0",
|
|
76
|
+
"postcss-loader": "^6.2.1",
|
|
77
|
+
"prompt": "^1.2.2",
|
|
78
|
+
"sass-loader": "^12.6.0",
|
|
79
|
+
"sitemap": "^7.1.1",
|
|
80
|
+
"terser": "^5.12.1",
|
|
85
81
|
"webpack": "^5.70.0",
|
|
86
|
-
"webpack-bundle-analyzer": "^4.
|
|
87
|
-
"webpack-dev-server": "
|
|
82
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
83
|
+
"webpack-dev-server": "4.7.4",
|
|
88
84
|
"webpack-node-externals": "^3.0.0",
|
|
89
85
|
"worker-loader": "^3.0.8"
|
|
90
86
|
},
|
|
@@ -94,22 +90,22 @@
|
|
|
94
90
|
"avsc": "^5.7.3",
|
|
95
91
|
"babel-plugin-transform-builtin-extend": "1.1.2",
|
|
96
92
|
"bcryptjs": "^2.4.3",
|
|
97
|
-
"bignumber.js": "^9.0.
|
|
98
|
-
"blakejs": "^1.
|
|
99
|
-
"bootstrap": "4.6.
|
|
93
|
+
"bignumber.js": "^9.0.2",
|
|
94
|
+
"blakejs": "^1.2.1",
|
|
95
|
+
"bootstrap": "4.6.1",
|
|
100
96
|
"bootstrap-colorpicker": "^3.4.0",
|
|
101
97
|
"bootstrap-material-design": "^4.1.3",
|
|
102
98
|
"browserify-zlib": "^0.2.0",
|
|
103
|
-
"bson": "^4.
|
|
99
|
+
"bson": "^4.6.2",
|
|
104
100
|
"buffer": "^6.0.3",
|
|
105
|
-
"cbor": "
|
|
101
|
+
"cbor": "8.1.0",
|
|
106
102
|
"chi-squared": "^1.1.0",
|
|
107
103
|
"codepage": "^1.15.0",
|
|
108
104
|
"crypto-api": "^0.8.5",
|
|
109
105
|
"crypto-browserify": "^3.12.0",
|
|
110
106
|
"crypto-js": "^4.1.1",
|
|
111
107
|
"ctph.js": "0.0.5",
|
|
112
|
-
"d3": "
|
|
108
|
+
"d3": "7.3.0",
|
|
113
109
|
"d3-hexbin": "^0.2.2",
|
|
114
110
|
"diff": "^5.0.0",
|
|
115
111
|
"es6-promisify": "^7.0.0",
|
|
@@ -119,7 +115,7 @@
|
|
|
119
115
|
"file-saver": "^2.0.5",
|
|
120
116
|
"flat": "^5.0.2",
|
|
121
117
|
"geodesy": "1.1.3",
|
|
122
|
-
"highlight.js": "^11.
|
|
118
|
+
"highlight.js": "^11.5.0",
|
|
123
119
|
"jimp": "^0.16.1",
|
|
124
120
|
"jquery": "3.6.0",
|
|
125
121
|
"js-crc": "^0.2.0",
|
|
@@ -128,18 +124,18 @@
|
|
|
128
124
|
"jsonpath": "^1.1.1",
|
|
129
125
|
"jsonwebtoken": "^8.5.1",
|
|
130
126
|
"jsqr": "^1.4.0",
|
|
131
|
-
"jsrsasign": "^10.
|
|
127
|
+
"jsrsasign": "^10.5.14",
|
|
132
128
|
"kbpgp": "2.1.15",
|
|
133
129
|
"libbzip2-wasm": "0.0.4",
|
|
134
130
|
"libyara-wasm": "^1.1.0",
|
|
135
131
|
"lodash": "^4.17.21",
|
|
136
|
-
"loglevel": "^1.
|
|
132
|
+
"loglevel": "^1.8.0",
|
|
137
133
|
"loglevel-message-prefix": "^3.0.0",
|
|
138
134
|
"markdown-it": "^12.3.2",
|
|
139
135
|
"moment": "^2.29.1",
|
|
140
|
-
"moment-timezone": "^0.5.
|
|
136
|
+
"moment-timezone": "^0.5.34",
|
|
141
137
|
"ngeohash": "^0.6.3",
|
|
142
|
-
"node-forge": "^
|
|
138
|
+
"node-forge": "^1.3.0",
|
|
143
139
|
"node-md6": "^0.1.0",
|
|
144
140
|
"node-sass": "^7.0.1",
|
|
145
141
|
"nodom": "^2.4.0",
|
|
@@ -153,13 +149,12 @@
|
|
|
153
149
|
"qr-image": "^3.2.0",
|
|
154
150
|
"scryptsy": "^2.1.0",
|
|
155
151
|
"snackbarjs": "^1.1.0",
|
|
156
|
-
"sortablejs": "^1.
|
|
157
|
-
"split.js": "^1.6.
|
|
152
|
+
"sortablejs": "^1.15.0",
|
|
153
|
+
"split.js": "^1.6.5",
|
|
158
154
|
"ssdeep.js": "0.0.3",
|
|
159
155
|
"stream-browserify": "^3.0.0",
|
|
160
|
-
"terser": "^5.7.1",
|
|
161
156
|
"tesseract.js": "2.1.5",
|
|
162
|
-
"ua-parser-js": "^0.
|
|
157
|
+
"ua-parser-js": "^1.0.2",
|
|
163
158
|
"unorm": "^1.6.0",
|
|
164
159
|
"utf8": "^3.0.0",
|
|
165
160
|
"vkbeautify": "^0.99.3",
|
|
@@ -173,7 +168,7 @@
|
|
|
173
168
|
"build": "npx grunt prod",
|
|
174
169
|
"repl": "node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-warnings src/node/repl.mjs",
|
|
175
170
|
"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",
|
|
176
|
-
"
|
|
171
|
+
"testnodeconsumer": "npx grunt testnodeconsumer",
|
|
177
172
|
"testui": "npx grunt testui",
|
|
178
173
|
"testuidev": "npx nightwatch --env=dev",
|
|
179
174
|
"lint": "npx grunt lint",
|
package/src/core/Utils.mjs
CHANGED
|
@@ -723,7 +723,8 @@ class Utils {
|
|
|
723
723
|
}
|
|
724
724
|
|
|
725
725
|
if (removeScriptAndStyle) {
|
|
726
|
-
htmlStr = recursiveRemove(/<
|
|
726
|
+
htmlStr = recursiveRemove(/<script[^>]*>.*?<\/script>/gi, htmlStr);
|
|
727
|
+
htmlStr = recursiveRemove(/<style[^>]*>.*?<\/style>/gi, htmlStr);
|
|
727
728
|
}
|
|
728
729
|
return htmlStr.replace(/<[^>]+>/g, "");
|
|
729
730
|
}
|
|
@@ -1206,6 +1207,30 @@ class Utils {
|
|
|
1206
1207
|
}[token];
|
|
1207
1208
|
}
|
|
1208
1209
|
|
|
1210
|
+
/**
|
|
1211
|
+
* Iterate object in chunks of given size.
|
|
1212
|
+
*
|
|
1213
|
+
* @param {Iterable} iterable
|
|
1214
|
+
* @param {number} chunksize
|
|
1215
|
+
*/
|
|
1216
|
+
static* chunked(iterable, chunksize) {
|
|
1217
|
+
const iterator = iterable[Symbol.iterator]();
|
|
1218
|
+
while (true) {
|
|
1219
|
+
const res = [];
|
|
1220
|
+
for (let i = 0; i < chunksize; i++) {
|
|
1221
|
+
const next = iterator.next();
|
|
1222
|
+
if (next.done) {
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
res.push(next.value);
|
|
1226
|
+
}
|
|
1227
|
+
if (res.length) {
|
|
1228
|
+
yield res;
|
|
1229
|
+
} else {
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1209
1234
|
}
|
|
1210
1235
|
|
|
1211
1236
|
/**
|
|
@@ -5548,6 +5548,22 @@
|
|
|
5548
5548
|
}
|
|
5549
5549
|
]
|
|
5550
5550
|
},
|
|
5551
|
+
"From Base45": {
|
|
5552
|
+
"module": "Default",
|
|
5553
|
+
"description": "Base45 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system. Base45 is optimized for usage with QR codes.",
|
|
5554
|
+
"infoURL": "https://wikipedia.org/wiki/List_of_numeral_systems",
|
|
5555
|
+
"inputType": "string",
|
|
5556
|
+
"outputType": "byteArray",
|
|
5557
|
+
"flowControl": false,
|
|
5558
|
+
"manualBake": false,
|
|
5559
|
+
"args": [
|
|
5560
|
+
{
|
|
5561
|
+
"name": "Alphabet",
|
|
5562
|
+
"type": "string",
|
|
5563
|
+
"value": "0-9A-Z $%*+\\-./:"
|
|
5564
|
+
}
|
|
5565
|
+
]
|
|
5566
|
+
},
|
|
5551
5567
|
"From Base58": {
|
|
5552
5568
|
"module": "Default",
|
|
5553
5569
|
"description": "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.<br><br>This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included) back into its raw form.<br><br>e.g. <code>StV1DL6CwTryKyV</code> becomes <code>hello world</code><br><br>Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).",
|
|
@@ -9251,6 +9267,7 @@
|
|
|
9251
9267
|
"Pacific/Guam",
|
|
9252
9268
|
"Pacific/Honolulu",
|
|
9253
9269
|
"Pacific/Johnston",
|
|
9270
|
+
"Pacific/Kanton",
|
|
9254
9271
|
"Pacific/Kiritimati",
|
|
9255
9272
|
"Pacific/Kosrae",
|
|
9256
9273
|
"Pacific/Kwajalein",
|
|
@@ -11784,6 +11801,7 @@
|
|
|
11784
11801
|
"go",
|
|
11785
11802
|
"golo",
|
|
11786
11803
|
"gradle",
|
|
11804
|
+
"graphql",
|
|
11787
11805
|
"groovy",
|
|
11788
11806
|
"haml",
|
|
11789
11807
|
"handlebars",
|
|
@@ -12081,6 +12099,22 @@
|
|
|
12081
12099
|
}
|
|
12082
12100
|
]
|
|
12083
12101
|
},
|
|
12102
|
+
"To Base45": {
|
|
12103
|
+
"module": "Default",
|
|
12104
|
+
"description": "Base45 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system. Base45 is optimized for usage with QR codes.",
|
|
12105
|
+
"infoURL": "https://wikipedia.org/wiki/List_of_numeral_systems",
|
|
12106
|
+
"inputType": "ArrayBuffer",
|
|
12107
|
+
"outputType": "string",
|
|
12108
|
+
"flowControl": false,
|
|
12109
|
+
"manualBake": false,
|
|
12110
|
+
"args": [
|
|
12111
|
+
{
|
|
12112
|
+
"name": "Alphabet",
|
|
12113
|
+
"type": "string",
|
|
12114
|
+
"value": "0-9A-Z $%*+\\-./:"
|
|
12115
|
+
}
|
|
12116
|
+
]
|
|
12117
|
+
},
|
|
12084
12118
|
"To Base58": {
|
|
12085
12119
|
"module": "Default",
|
|
12086
12120
|
"description": "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.<br><br>This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).<br><br>e.g. <code>hello world</code> becomes <code>StV1DL6CwTryKyV</code><br><br>Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).",
|
|
@@ -13310,6 +13344,7 @@
|
|
|
13310
13344
|
"Pacific/Guam",
|
|
13311
13345
|
"Pacific/Honolulu",
|
|
13312
13346
|
"Pacific/Johnston",
|
|
13347
|
+
"Pacific/Kanton",
|
|
13313
13348
|
"Pacific/Kiritimati",
|
|
13314
13349
|
"Pacific/Kosrae",
|
|
13315
13350
|
"Pacific/Kwajalein",
|
|
@@ -13915,6 +13950,7 @@
|
|
|
13915
13950
|
"Pacific/Guam",
|
|
13916
13951
|
"Pacific/Honolulu",
|
|
13917
13952
|
"Pacific/Johnston",
|
|
13953
|
+
"Pacific/Kanton",
|
|
13918
13954
|
"Pacific/Kiritimati",
|
|
13919
13955
|
"Pacific/Kosrae",
|
|
13920
13956
|
"Pacific/Kwajalein",
|
|
@@ -45,6 +45,7 @@ import FrequencyDistribution from "../../operations/FrequencyDistribution.mjs";
|
|
|
45
45
|
import FromBCD from "../../operations/FromBCD.mjs";
|
|
46
46
|
import FromBase from "../../operations/FromBase.mjs";
|
|
47
47
|
import FromBase32 from "../../operations/FromBase32.mjs";
|
|
48
|
+
import FromBase45 from "../../operations/FromBase45.mjs";
|
|
48
49
|
import FromBase58 from "../../operations/FromBase58.mjs";
|
|
49
50
|
import FromBase62 from "../../operations/FromBase62.mjs";
|
|
50
51
|
import FromBase64 from "../../operations/FromBase64.mjs";
|
|
@@ -134,6 +135,7 @@ import TakeBytes from "../../operations/TakeBytes.mjs";
|
|
|
134
135
|
import ToBCD from "../../operations/ToBCD.mjs";
|
|
135
136
|
import ToBase from "../../operations/ToBase.mjs";
|
|
136
137
|
import ToBase32 from "../../operations/ToBase32.mjs";
|
|
138
|
+
import ToBase45 from "../../operations/ToBase45.mjs";
|
|
137
139
|
import ToBase58 from "../../operations/ToBase58.mjs";
|
|
138
140
|
import ToBase62 from "../../operations/ToBase62.mjs";
|
|
139
141
|
import ToBase64 from "../../operations/ToBase64.mjs";
|
|
@@ -209,6 +211,7 @@ OpModules.Default = {
|
|
|
209
211
|
"From BCD": FromBCD,
|
|
210
212
|
"From Base": FromBase,
|
|
211
213
|
"From Base32": FromBase32,
|
|
214
|
+
"From Base45": FromBase45,
|
|
212
215
|
"From Base58": FromBase58,
|
|
213
216
|
"From Base62": FromBase62,
|
|
214
217
|
"From Base64": FromBase64,
|
|
@@ -298,6 +301,7 @@ OpModules.Default = {
|
|
|
298
301
|
"To BCD": ToBCD,
|
|
299
302
|
"To Base": ToBase,
|
|
300
303
|
"To Base32": ToBase32,
|
|
304
|
+
"To Base45": ToBase45,
|
|
301
305
|
"To Base58": ToBase58,
|
|
302
306
|
"To Base62": ToBase62,
|
|
303
307
|
"To Base64": ToBase64,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base45 resources.
|
|
3
|
+
*
|
|
4
|
+
* @author Thomas Weißschuh [thomas@t-8ch.de]
|
|
5
|
+
* @copyright Crown Copyright 2021
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Highlight to Base45
|
|
11
|
+
*/
|
|
12
|
+
export function highlightToBase45(pos, args) {
|
|
13
|
+
pos[0].start = Math.floor(pos[0].start / 2) * 3;
|
|
14
|
+
pos[0].end = Math.ceil(pos[0].end / 2) * 3;
|
|
15
|
+
return pos;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Highlight from Base45
|
|
20
|
+
*/
|
|
21
|
+
export function highlightFromBase45(pos, args) {
|
|
22
|
+
pos[0].start = Math.floor(pos[0].start / 3) * 2;
|
|
23
|
+
pos[0].end = Math.ceil(pos[0].end / 3) * 2;
|
|
24
|
+
return pos;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ALPHABET = "0-9A-Z $%*+\\-./:";
|
|
@@ -67,7 +67,7 @@ class DeriveEVPKey extends Operation {
|
|
|
67
67
|
iterations = args[2],
|
|
68
68
|
hasher = args[3],
|
|
69
69
|
salt = Utils.convertToByteString(args[4].string, args[4].option),
|
|
70
|
-
key = CryptoJS.EvpKDF(passphrase, salt, {
|
|
70
|
+
key = CryptoJS.EvpKDF(passphrase, salt, { // lgtm [js/insufficient-password-hash]
|
|
71
71
|
keySize: keySize,
|
|
72
72
|
hasher: CryptoJS.algo[hasher],
|
|
73
73
|
iterations: iterations,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Thomas Weißschuh [thomas@t-8ch.de]
|
|
3
|
+
* @copyright Crown Copyright 2021
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ALPHABET, highlightToBase45, highlightFromBase45} from "../lib/Base45.mjs";
|
|
8
|
+
import Operation from "../Operation.mjs";
|
|
9
|
+
import OperationError from "../errors/OperationError.mjs";
|
|
10
|
+
import Utils from "../Utils.mjs";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* From Base45 operation
|
|
15
|
+
*/
|
|
16
|
+
class FromBase45 extends Operation {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* FromBase45 constructor
|
|
20
|
+
*/
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
|
|
24
|
+
this.name = "From Base45";
|
|
25
|
+
this.module = "Default";
|
|
26
|
+
this.description = "Base45 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system. Base45 is optimized for usage with QR codes.";
|
|
27
|
+
this.infoURL = "https://wikipedia.org/wiki/List_of_numeral_systems";
|
|
28
|
+
this.inputType = "string";
|
|
29
|
+
this.outputType = "byteArray";
|
|
30
|
+
this.args = [
|
|
31
|
+
{
|
|
32
|
+
name: "Alphabet",
|
|
33
|
+
type: "string",
|
|
34
|
+
value: ALPHABET
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
this.highlight = highlightFromBase45;
|
|
39
|
+
this.highlightReverse = highlightToBase45;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @param {string} input
|
|
44
|
+
* @param {Object[]} args
|
|
45
|
+
* @returns {byteArray}
|
|
46
|
+
*/
|
|
47
|
+
run(input, args) {
|
|
48
|
+
if (!input) return [];
|
|
49
|
+
const alphabet = Utils.expandAlphRange(args[0]);
|
|
50
|
+
|
|
51
|
+
const res = [];
|
|
52
|
+
|
|
53
|
+
for (const triple of Utils.chunked(input, 3)) {
|
|
54
|
+
triple.reverse();
|
|
55
|
+
let b = 0;
|
|
56
|
+
for (const c of triple) {
|
|
57
|
+
const idx = alphabet.indexOf(c);
|
|
58
|
+
if (idx === -1) {
|
|
59
|
+
throw new OperationError(`Character not in alphabet: '${c}'`);
|
|
60
|
+
}
|
|
61
|
+
b *= 45;
|
|
62
|
+
b += idx;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (b > 65535) {
|
|
66
|
+
throw new OperationError(`Triplet too large: '${triple.join("")}'`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (triple.length > 2) {
|
|
70
|
+
/**
|
|
71
|
+
* The last triple may only have 2 bytes so we push the MSB when we got 3 bytes
|
|
72
|
+
* Pushing MSB
|
|
73
|
+
*/
|
|
74
|
+
res.push(b >> 8);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Pushing LSB
|
|
79
|
+
*/
|
|
80
|
+
res.push(b & 0xff);
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default FromBase45;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Thomas Weißschuh [thomas@t-8ch.de]
|
|
3
|
+
* @copyright Crown Copyright 2021
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ALPHABET, highlightToBase45, highlightFromBase45} from "../lib/Base45.mjs";
|
|
8
|
+
import Operation from "../Operation.mjs";
|
|
9
|
+
import Utils from "../Utils.mjs";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* To Base45 operation
|
|
13
|
+
*/
|
|
14
|
+
class ToBase45 extends Operation {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ToBase45 constructor
|
|
18
|
+
*/
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
|
|
22
|
+
this.name = "To Base45";
|
|
23
|
+
this.module = "Default";
|
|
24
|
+
this.description = "Base45 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system. Base45 is optimized for usage with QR codes.";
|
|
25
|
+
this.infoURL = "https://wikipedia.org/wiki/List_of_numeral_systems";
|
|
26
|
+
this.inputType = "ArrayBuffer";
|
|
27
|
+
this.outputType = "string";
|
|
28
|
+
this.args = [
|
|
29
|
+
{
|
|
30
|
+
name: "Alphabet",
|
|
31
|
+
type: "string",
|
|
32
|
+
value: ALPHABET
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
this.highlight = highlightToBase45;
|
|
37
|
+
this.highlightReverse = highlightFromBase45;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {ArrayBuffer} input
|
|
42
|
+
* @param {Object[]} args
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
run(input, args) {
|
|
46
|
+
input = new Uint8Array(input);
|
|
47
|
+
const alphabet = Utils.expandAlphRange(args[0]);
|
|
48
|
+
if (!input) return "";
|
|
49
|
+
|
|
50
|
+
const res = [];
|
|
51
|
+
|
|
52
|
+
for (const pair of Utils.chunked(input, 2)) {
|
|
53
|
+
let b = 0;
|
|
54
|
+
for (const e of pair) {
|
|
55
|
+
b *= 256;
|
|
56
|
+
b += e;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let chars = 0;
|
|
60
|
+
do {
|
|
61
|
+
res.push(alphabet[b % 45]);
|
|
62
|
+
chars++;
|
|
63
|
+
b = Math.floor(b / 45);
|
|
64
|
+
} while (b > 0);
|
|
65
|
+
|
|
66
|
+
if (chars < 2) {
|
|
67
|
+
res.push("0");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
return res.join("");
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default ToBase45;
|
|
@@ -120,6 +120,7 @@ import FrequencyDistribution from "./FrequencyDistribution.mjs";
|
|
|
120
120
|
import FromBCD from "./FromBCD.mjs";
|
|
121
121
|
import FromBase from "./FromBase.mjs";
|
|
122
122
|
import FromBase32 from "./FromBase32.mjs";
|
|
123
|
+
import FromBase45 from "./FromBase45.mjs";
|
|
123
124
|
import FromBase58 from "./FromBase58.mjs";
|
|
124
125
|
import FromBase62 from "./FromBase62.mjs";
|
|
125
126
|
import FromBase64 from "./FromBase64.mjs";
|
|
@@ -315,6 +316,7 @@ import TextEncodingBruteForce from "./TextEncodingBruteForce.mjs";
|
|
|
315
316
|
import ToBCD from "./ToBCD.mjs";
|
|
316
317
|
import ToBase from "./ToBase.mjs";
|
|
317
318
|
import ToBase32 from "./ToBase32.mjs";
|
|
319
|
+
import ToBase45 from "./ToBase45.mjs";
|
|
318
320
|
import ToBase58 from "./ToBase58.mjs";
|
|
319
321
|
import ToBase62 from "./ToBase62.mjs";
|
|
320
322
|
import ToBase64 from "./ToBase64.mjs";
|
|
@@ -487,6 +489,7 @@ export {
|
|
|
487
489
|
FromBCD,
|
|
488
490
|
FromBase,
|
|
489
491
|
FromBase32,
|
|
492
|
+
FromBase45,
|
|
490
493
|
FromBase58,
|
|
491
494
|
FromBase62,
|
|
492
495
|
FromBase64,
|
|
@@ -682,6 +685,7 @@ export {
|
|
|
682
685
|
ToBCD,
|
|
683
686
|
ToBase,
|
|
684
687
|
ToBase32,
|
|
688
|
+
ToBase45,
|
|
685
689
|
ToBase58,
|
|
686
690
|
ToBase62,
|
|
687
691
|
ToBase64,
|
package/src/node/index.mjs
CHANGED
|
@@ -127,6 +127,7 @@ import {
|
|
|
127
127
|
FromBCD as core_FromBCD,
|
|
128
128
|
FromBase as core_FromBase,
|
|
129
129
|
FromBase32 as core_FromBase32,
|
|
130
|
+
FromBase45 as core_FromBase45,
|
|
130
131
|
FromBase58 as core_FromBase58,
|
|
131
132
|
FromBase62 as core_FromBase62,
|
|
132
133
|
FromBase64 as core_FromBase64,
|
|
@@ -315,6 +316,7 @@ import {
|
|
|
315
316
|
ToBCD as core_ToBCD,
|
|
316
317
|
ToBase as core_ToBase,
|
|
317
318
|
ToBase32 as core_ToBase32,
|
|
319
|
+
ToBase45 as core_ToBase45,
|
|
318
320
|
ToBase58 as core_ToBase58,
|
|
319
321
|
ToBase62 as core_ToBase62,
|
|
320
322
|
ToBase64 as core_ToBase64,
|
|
@@ -494,6 +496,7 @@ function generateChef() {
|
|
|
494
496
|
"fromBCD": _wrap(core_FromBCD),
|
|
495
497
|
"fromBase": _wrap(core_FromBase),
|
|
496
498
|
"fromBase32": _wrap(core_FromBase32),
|
|
499
|
+
"fromBase45": _wrap(core_FromBase45),
|
|
497
500
|
"fromBase58": _wrap(core_FromBase58),
|
|
498
501
|
"fromBase62": _wrap(core_FromBase62),
|
|
499
502
|
"fromBase64": _wrap(core_FromBase64),
|
|
@@ -682,6 +685,7 @@ function generateChef() {
|
|
|
682
685
|
"toBCD": _wrap(core_ToBCD),
|
|
683
686
|
"toBase": _wrap(core_ToBase),
|
|
684
687
|
"toBase32": _wrap(core_ToBase32),
|
|
688
|
+
"toBase45": _wrap(core_ToBase45),
|
|
685
689
|
"toBase58": _wrap(core_ToBase58),
|
|
686
690
|
"toBase62": _wrap(core_ToBase62),
|
|
687
691
|
"toBase64": _wrap(core_ToBase64),
|
|
@@ -872,6 +876,7 @@ const frequencyDistribution = chef.frequencyDistribution;
|
|
|
872
876
|
const fromBCD = chef.fromBCD;
|
|
873
877
|
const fromBase = chef.fromBase;
|
|
874
878
|
const fromBase32 = chef.fromBase32;
|
|
879
|
+
const fromBase45 = chef.fromBase45;
|
|
875
880
|
const fromBase58 = chef.fromBase58;
|
|
876
881
|
const fromBase62 = chef.fromBase62;
|
|
877
882
|
const fromBase64 = chef.fromBase64;
|
|
@@ -1067,6 +1072,7 @@ const textEncodingBruteForce = chef.textEncodingBruteForce;
|
|
|
1067
1072
|
const toBCD = chef.toBCD;
|
|
1068
1073
|
const toBase = chef.toBase;
|
|
1069
1074
|
const toBase32 = chef.toBase32;
|
|
1075
|
+
const toBase45 = chef.toBase45;
|
|
1070
1076
|
const toBase58 = chef.toBase58;
|
|
1071
1077
|
const toBase62 = chef.toBase62;
|
|
1072
1078
|
const toBase64 = chef.toBase64;
|
|
@@ -1241,6 +1247,7 @@ const operations = [
|
|
|
1241
1247
|
fromBCD,
|
|
1242
1248
|
fromBase,
|
|
1243
1249
|
fromBase32,
|
|
1250
|
+
fromBase45,
|
|
1244
1251
|
fromBase58,
|
|
1245
1252
|
fromBase62,
|
|
1246
1253
|
fromBase64,
|
|
@@ -1436,6 +1443,7 @@ const operations = [
|
|
|
1436
1443
|
toBCD,
|
|
1437
1444
|
toBase,
|
|
1438
1445
|
toBase32,
|
|
1446
|
+
toBase45,
|
|
1439
1447
|
toBase58,
|
|
1440
1448
|
toBase62,
|
|
1441
1449
|
toBase64,
|
|
@@ -1614,6 +1622,7 @@ export {
|
|
|
1614
1622
|
fromBCD,
|
|
1615
1623
|
fromBase,
|
|
1616
1624
|
fromBase32,
|
|
1625
|
+
fromBase45,
|
|
1617
1626
|
fromBase58,
|
|
1618
1627
|
fromBase62,
|
|
1619
1628
|
fromBase64,
|
|
@@ -1809,6 +1818,7 @@ export {
|
|
|
1809
1818
|
toBCD,
|
|
1810
1819
|
toBase,
|
|
1811
1820
|
toBase32,
|
|
1821
|
+
toBase45,
|
|
1812
1822
|
toBase58,
|
|
1813
1823
|
toBase62,
|
|
1814
1824
|
toBase64,
|
package/src/web/html/index.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<meta name="description" content="The Cyber Swiss Army Knife - a web app for encryption, encoding, compression and data analysis" />
|
|
30
30
|
<meta name="keywords" content="base64, hex, decode, encode, encrypt, decrypt, compress, decompress, regex, regular expressions, hash, crypt, hexadecimal, user agent, url, certificate, x.509, parser, JSON, gzip, md5, sha1, aes, des, blowfish, xor" />
|
|
31
31
|
|
|
32
|
-
<link rel="icon" type="image/ico" href="<%- require('../static/images/favicon.ico')
|
|
32
|
+
<link rel="icon" type="image/ico" href="<%- require('../static/images/favicon.ico') %>" />
|
|
33
33
|
|
|
34
34
|
<script type="application/javascript">
|
|
35
35
|
"use strict";
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
</button>
|
|
198
198
|
|
|
199
199
|
<button type="button" class="mx-2 btn btn-lg btn-success btn-raised btn-block" id="bake">
|
|
200
|
-
<img aria-hidden="true" src="<%- require('../static/images/cook_male-32x32.png')
|
|
200
|
+
<img aria-hidden="true" src="<%- require('../static/images/cook_male-32x32.png') %>" alt="Chef Icon"/>
|
|
201
201
|
<span>Bake!</span>
|
|
202
202
|
</button>
|
|
203
203
|
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
<div class="file-overlay" id="file-overlay"></div>
|
|
272
272
|
<div style="position: relative; height: 100%;">
|
|
273
273
|
<div class="io-card card">
|
|
274
|
-
<img aria-hidden="true" src="<%- require('../static/images/file-128x128.png')
|
|
274
|
+
<img aria-hidden="true" src="<%- require('../static/images/file-128x128.png') %>" alt="File icon" id="input-file-thumbnail"/>
|
|
275
275
|
<div class="card-body">
|
|
276
276
|
<button type="button" class="close" id="input-file-close">×</button>
|
|
277
277
|
Name: <span id="input-file-name"></span><br>
|
|
@@ -346,12 +346,12 @@
|
|
|
346
346
|
<div id="output-highlighter" class="no-select"></div>
|
|
347
347
|
<div id="output-html"></div>
|
|
348
348
|
<textarea id="output-text" readonly="readonly" spellcheck="false"></textarea>
|
|
349
|
-
<img id="show-file-overlay" aria-hidden="true" src="<%- require('../static/images/file-32x32.png')
|
|
349
|
+
<img id="show-file-overlay" aria-hidden="true" src="<%- require('../static/images/file-32x32.png') %>" alt="Show file overlay" title="Show file overlay"/>
|
|
350
350
|
<div id="output-file">
|
|
351
351
|
<div class="file-overlay"></div>
|
|
352
352
|
<div style="position: relative; height: 100%;">
|
|
353
353
|
<div class="io-card card">
|
|
354
|
-
<img aria-hidden="true" src="<%- require('../static/images/file-128x128.png')
|
|
354
|
+
<img aria-hidden="true" src="<%- require('../static/images/file-128x128.png') %>" alt="File icon"/>
|
|
355
355
|
<div class="card-body">
|
|
356
356
|
Size: <span id="output-file-size"></span><br>
|
|
357
357
|
<button id="output-file-download" type="button" class="btn btn-primary btn-outline">Download</button>
|
|
@@ -626,7 +626,7 @@
|
|
|
626
626
|
<h5 class="modal-title">CyberChef - The Cyber Swiss Army Knife</h5>
|
|
627
627
|
</div>
|
|
628
628
|
<div class="modal-body">
|
|
629
|
-
<img aria-hidden="true" class="about-img-left" src="<%- require('../static/images/cyberchef-128x128.png')
|
|
629
|
+
<img aria-hidden="true" class="about-img-left" src="<%- require('../static/images/cyberchef-128x128.png') %>" alt="CyberChef Logo"/>
|
|
630
630
|
<p class="subtext">
|
|
631
631
|
Version <%= htmlWebpackPlugin.options.version %><br>
|
|
632
632
|
Compile time: <%= htmlWebpackPlugin.options.compileTime %>
|
|
@@ -749,7 +749,7 @@
|
|
|
749
749
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
750
750
|
</div>
|
|
751
751
|
<a href="https://github.com/gchq/CyberChef">
|
|
752
|
-
<img aria-hidden="true" style="position: absolute; top: 0; right: 0; border: 0;" src="<%- require('../static/images/fork_me.png')
|
|
752
|
+
<img aria-hidden="true" style="position: absolute; top: 0; right: 0; border: 0;" src="<%- require('../static/images/fork_me.png') %>" alt="Fork me on GitHub">
|
|
753
753
|
</a>
|
|
754
754
|
</div>
|
|
755
755
|
</div>
|
|
@@ -71,7 +71,7 @@ module.exports = {
|
|
|
71
71
|
.moveToElement(toHex, 10, 10)
|
|
72
72
|
.useCss()
|
|
73
73
|
.waitForElementVisible(".popover-body", 1000)
|
|
74
|
-
.doubleClick();
|
|
74
|
+
.doubleClick("xpath", toHex);
|
|
75
75
|
|
|
76
76
|
// Confirm that it has been added to the recipe
|
|
77
77
|
browser
|
|
@@ -90,7 +90,7 @@ module.exports = {
|
|
|
90
90
|
browser
|
|
91
91
|
.useCss()
|
|
92
92
|
.waitForElementNotVisible("#stale-indicator", 1000)
|
|
93
|
-
.expect.element("#output-text").to.have.value.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
|
93
|
+
.expect.element("#output-text").to.have.property("value").that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
|
94
94
|
|
|
95
95
|
// Clear recipe
|
|
96
96
|
browser
|
|
@@ -202,11 +202,11 @@ module.exports = {
|
|
|
202
202
|
browser
|
|
203
203
|
.getLocationInView(genUUID)
|
|
204
204
|
.moveToElement(genUUID, 10, 10)
|
|
205
|
-
.doubleClick()
|
|
205
|
+
.doubleClick("xpath", genUUID)
|
|
206
206
|
.useCss()
|
|
207
207
|
.waitForElementVisible(".operation .op-title", 1000)
|
|
208
208
|
.waitForElementNotVisible("#stale-indicator", 1000)
|
|
209
|
-
.expect.element("#output-text").to.have.value.which.matches(/[\da-f-]{36}/);
|
|
209
|
+
.expect.element("#output-text").to.have.property("value").which.matches(/[\da-f-]{36}/);
|
|
210
210
|
|
|
211
211
|
browser.click("#clr-recipe");
|
|
212
212
|
},
|
package/tests/browser/ops.js
CHANGED
|
@@ -393,13 +393,13 @@ function testOp(browser, opName, input, output, args=[]) {
|
|
|
393
393
|
.click("#clr-recipe")
|
|
394
394
|
.click("#clr-io")
|
|
395
395
|
.waitForElementNotPresent("#rec-list li.operation")
|
|
396
|
-
.expect.element("#input-text").to.have.value.that.equals("");
|
|
396
|
+
.expect.element("#input-text").to.have.property("value").that.equals("");
|
|
397
397
|
|
|
398
398
|
browser
|
|
399
399
|
.urlHash("recipe=" + recipeConfig)
|
|
400
400
|
.setValue("#input-text", input)
|
|
401
401
|
.waitForElementPresent("#rec-list li.operation")
|
|
402
|
-
.expect.element("#input-text").to.have.value.that.equals(input);
|
|
402
|
+
.expect.element("#input-text").to.have.property("value").that.equals(input);
|
|
403
403
|
|
|
404
404
|
browser
|
|
405
405
|
.waitForElementVisible("#stale-indicator", 5000)
|
|
@@ -410,8 +410,8 @@ function testOp(browser, opName, input, output, args=[]) {
|
|
|
410
410
|
.waitForElementNotVisible("#output-loader", 5000);
|
|
411
411
|
|
|
412
412
|
if (typeof output === "string") {
|
|
413
|
-
browser.expect.element("#output-text").to.have.value.that.equals(output);
|
|
413
|
+
browser.expect.element("#output-text").to.have.property("value").that.equals(output);
|
|
414
414
|
} else if (output instanceof RegExp) {
|
|
415
|
-
browser.expect.element("#output-text").to.have.value.that.matches(output);
|
|
415
|
+
browser.expect.element("#output-text").to.have.property("value").that.matches(output);
|
|
416
416
|
}
|
|
417
417
|
}
|
|
@@ -685,8 +685,8 @@ Arguments:
|
|
|
685
685
|
it("Parse user agent", () => {
|
|
686
686
|
const result = chef.parseUserAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 ");
|
|
687
687
|
const expected = `Browser
|
|
688
|
-
Name:
|
|
689
|
-
Version:
|
|
688
|
+
Name: Firefox
|
|
689
|
+
Version: 47.0
|
|
690
690
|
Device
|
|
691
691
|
Model: unknown
|
|
692
692
|
Type: unknown
|
|
@@ -20,6 +20,7 @@ import TestRegister from "../lib/TestRegister.mjs";
|
|
|
20
20
|
import "./tests/BCD.mjs";
|
|
21
21
|
import "./tests/BSON.mjs";
|
|
22
22
|
import "./tests/BaconCipher.mjs";
|
|
23
|
+
import "./tests/Base45.mjs";
|
|
23
24
|
import "./tests/Base58.mjs";
|
|
24
25
|
import "./tests/Base64.mjs";
|
|
25
26
|
import "./tests/Base62.mjs";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base45 tests.
|
|
3
|
+
*
|
|
4
|
+
* @author Thomas Weißschuh [thomas@t-8ch.de]
|
|
5
|
+
*
|
|
6
|
+
* @copyright Crown Copyright 2021
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
11
|
+
|
|
12
|
+
const defaultB45Alph = "0-9A-Z $%*+\\-./:";
|
|
13
|
+
|
|
14
|
+
TestRegister.addTests([
|
|
15
|
+
{
|
|
16
|
+
name: "To Base45: nothing",
|
|
17
|
+
input: "",
|
|
18
|
+
expectedOutput: "",
|
|
19
|
+
recipeConfig: [
|
|
20
|
+
{
|
|
21
|
+
op: "To Base45",
|
|
22
|
+
args: [defaultB45Alph],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "To Base45: Spec encoding example 1",
|
|
28
|
+
input: "AB",
|
|
29
|
+
expectedOutput: "BB8",
|
|
30
|
+
recipeConfig: [
|
|
31
|
+
{
|
|
32
|
+
op: "To Base45",
|
|
33
|
+
args: [defaultB45Alph],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "To Base45: Spec encoding example 2",
|
|
39
|
+
input: "Hello!!",
|
|
40
|
+
expectedOutput: "%69 VD92EX0",
|
|
41
|
+
recipeConfig: [
|
|
42
|
+
{
|
|
43
|
+
op: "To Base45",
|
|
44
|
+
args: [defaultB45Alph],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "To Base45: Spec encoding example 3",
|
|
50
|
+
input: "base-45",
|
|
51
|
+
expectedOutput: "UJCLQE7W581",
|
|
52
|
+
recipeConfig: [
|
|
53
|
+
{
|
|
54
|
+
op: "To Base45",
|
|
55
|
+
args: [defaultB45Alph],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "From Base45: nothing",
|
|
61
|
+
input: "",
|
|
62
|
+
expectedOutput: "",
|
|
63
|
+
recipeConfig: [
|
|
64
|
+
{
|
|
65
|
+
op: "From Base45",
|
|
66
|
+
args: [defaultB45Alph],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "From Base45: Spec decoding example 1",
|
|
72
|
+
input: "QED8WEX0",
|
|
73
|
+
expectedOutput: "ietf!",
|
|
74
|
+
recipeConfig: [
|
|
75
|
+
{
|
|
76
|
+
op: "From Base45",
|
|
77
|
+
args: [defaultB45Alph],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "From Base45: Invalid character",
|
|
83
|
+
input: "!",
|
|
84
|
+
expectedOutput: "Character not in alphabet: '!'",
|
|
85
|
+
recipeConfig: [
|
|
86
|
+
{
|
|
87
|
+
op: "From Base45",
|
|
88
|
+
args: [defaultB45Alph],
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "From Base45: Invalid triplet value",
|
|
94
|
+
input: "ZZZ",
|
|
95
|
+
expectedOutput: "Triplet too large: 'ZZZ'",
|
|
96
|
+
recipeConfig: [
|
|
97
|
+
{
|
|
98
|
+
op: "From Base45",
|
|
99
|
+
args: [defaultB45Alph],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
]);
|
package/webpack.config.js
CHANGED
|
@@ -36,7 +36,8 @@ const banner = `/**
|
|
|
36
36
|
module.exports = {
|
|
37
37
|
output: {
|
|
38
38
|
publicPath: "",
|
|
39
|
-
globalObject: "this"
|
|
39
|
+
globalObject: "this",
|
|
40
|
+
assetModuleFilename: "assets/[hash][ext][query]"
|
|
40
41
|
},
|
|
41
42
|
plugins: [
|
|
42
43
|
new webpack.ProvidePlugin({
|
|
@@ -122,7 +123,7 @@ module.exports = {
|
|
|
122
123
|
},
|
|
123
124
|
{
|
|
124
125
|
test: /prime.worker.min.js$/,
|
|
125
|
-
|
|
126
|
+
type: "asset/source"
|
|
126
127
|
},
|
|
127
128
|
{
|
|
128
129
|
test: /bootstrap-material-design/,
|
|
@@ -165,53 +166,33 @@ module.exports = {
|
|
|
165
166
|
"sass-loader",
|
|
166
167
|
]
|
|
167
168
|
},
|
|
168
|
-
/**
|
|
169
|
-
* The limit for these files has been increased to 60,000 (60KB)
|
|
170
|
-
* to ensure the material icons font is inlined.
|
|
171
|
-
*
|
|
172
|
-
* See: https://github.com/gchq/CyberChef/issues/612
|
|
173
|
-
*/
|
|
174
169
|
{
|
|
175
170
|
test: /\.(ico|eot|ttf|woff|woff2)$/,
|
|
176
|
-
|
|
177
|
-
options: {
|
|
178
|
-
limit: 60000,
|
|
179
|
-
name: "[hash].[ext]",
|
|
180
|
-
outputPath: "assets"
|
|
181
|
-
}
|
|
171
|
+
type: "asset/resource",
|
|
182
172
|
},
|
|
183
173
|
{
|
|
184
174
|
test: /\.svg$/,
|
|
185
|
-
|
|
186
|
-
options: {
|
|
187
|
-
encoding: "base64"
|
|
188
|
-
}
|
|
175
|
+
type: "asset/inline",
|
|
189
176
|
},
|
|
190
177
|
{ // Store font .fnt and .png files in a separate fonts folder
|
|
191
178
|
test: /(\.fnt$|bmfonts\/.+\.png$)/,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
outputPath: "assets/fonts"
|
|
179
|
+
type: "asset/resource",
|
|
180
|
+
generator: {
|
|
181
|
+
filename: "assets/fonts/[name][ext]"
|
|
196
182
|
}
|
|
197
183
|
},
|
|
198
184
|
{ // First party images are saved as files to be cached
|
|
199
185
|
test: /\.(png|jpg|gif)$/,
|
|
200
186
|
exclude: /(node_modules|bmfonts)/,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
187
|
+
type: "asset/resource",
|
|
188
|
+
generator: {
|
|
189
|
+
filename: "images/[name][ext]"
|
|
204
190
|
}
|
|
205
191
|
},
|
|
206
192
|
{ // Third party images are inlined
|
|
207
193
|
test: /\.(png|jpg|gif)$/,
|
|
208
194
|
exclude: /web\/static/,
|
|
209
|
-
|
|
210
|
-
options: {
|
|
211
|
-
limit: 10000,
|
|
212
|
-
name: "[hash].[ext]",
|
|
213
|
-
outputPath: "assets"
|
|
214
|
-
}
|
|
195
|
+
type: "asset/inline",
|
|
215
196
|
},
|
|
216
197
|
]
|
|
217
198
|
},
|
|
@@ -219,14 +200,15 @@ module.exports = {
|
|
|
219
200
|
children: false,
|
|
220
201
|
chunks: false,
|
|
221
202
|
modules: false,
|
|
222
|
-
entrypoints: false
|
|
223
|
-
warningsFilter: [
|
|
224
|
-
/source-map/,
|
|
225
|
-
/dependency is an expression/,
|
|
226
|
-
/export 'default'/,
|
|
227
|
-
/Can't resolve 'sodium'/
|
|
228
|
-
],
|
|
203
|
+
entrypoints: false
|
|
229
204
|
},
|
|
205
|
+
ignoreWarnings: [
|
|
206
|
+
/source-map/,
|
|
207
|
+
/source map/,
|
|
208
|
+
/dependency is an expression/,
|
|
209
|
+
/export 'default'/,
|
|
210
|
+
/Can't resolve 'sodium'/
|
|
211
|
+
],
|
|
230
212
|
performance: {
|
|
231
213
|
hints: false
|
|
232
214
|
}
|