mirror of
https://github.com/gchq/CyberChef
synced 2024-11-14 00:27:07 +00:00
Fixed operational tests and updated some dependencies
This commit is contained in:
parent
9e679f411c
commit
bf949c0320
30 changed files with 972 additions and 776 deletions
1617
package-lock.json
generated
1617
package-lock.json
generated
File diff suppressed because it is too large
Load diff
40
package.json
40
package.json
|
@ -39,29 +39,29 @@
|
|||
"node >= 16"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/core": "^7.21.0",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/plugin-transform-runtime": "^7.21.0",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@codemirror/commands": "^6.1.3",
|
||||
"@codemirror/language": "^6.4.0",
|
||||
"@babel/runtime": "^7.21.0",
|
||||
"@codemirror/commands": "^6.2.1",
|
||||
"@codemirror/language": "^6.6.0",
|
||||
"@codemirror/search": "^6.2.3",
|
||||
"@codemirror/state": "^6.2.0",
|
||||
"@codemirror/view": "^6.7.3",
|
||||
"@codemirror/view": "^6.9.1",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"babel-loader": "^9.1.2",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"babel-plugin-transform-builtin-extend": "1.1.2",
|
||||
"chromedriver": "^109.0.0",
|
||||
"cli-progress": "^3.11.2",
|
||||
"chromedriver": "^110.0.0",
|
||||
"cli-progress": "^3.12.0",
|
||||
"colors": "^1.4.0",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"core-js": "^3.27.1",
|
||||
"core-js": "^3.29.0",
|
||||
"css-loader": "6.7.3",
|
||||
"eslint": "^8.31.0",
|
||||
"grunt": "^1.5.3",
|
||||
"eslint": "^8.35.0",
|
||||
"grunt": "^1.6.1",
|
||||
"grunt-chmod": "~1.1.1",
|
||||
"grunt-concurrent": "^3.0.0",
|
||||
"grunt-contrib-clean": "~2.0.1",
|
||||
|
@ -76,16 +76,16 @@
|
|||
"imports-loader": "^4.0.1",
|
||||
"mini-css-extract-plugin": "2.7.2",
|
||||
"modify-source-webpack-plugin": "^3.0.0",
|
||||
"nightwatch": "^2.6.10",
|
||||
"nightwatch": "^2.6.15",
|
||||
"postcss": "^8.4.21",
|
||||
"postcss-css-variables": "^0.18.0",
|
||||
"postcss-import": "^15.1.0",
|
||||
"postcss-loader": "^7.0.2",
|
||||
"prompt": "^1.3.0",
|
||||
"sitemap": "^7.1.1",
|
||||
"terser": "^5.16.1",
|
||||
"terser": "^5.16.5",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-bundle-analyzer": "^4.7.0",
|
||||
"webpack-bundle-analyzer": "^4.8.0",
|
||||
"webpack-dev-server": "4.11.1",
|
||||
"webpack-node-externals": "^3.0.0",
|
||||
"worker-loader": "^3.0.8"
|
||||
|
@ -112,7 +112,7 @@
|
|||
"crypto-browserify": "^3.12.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"ctph.js": "0.0.5",
|
||||
"d3": "7.4.4",
|
||||
"d3": "7.8.2",
|
||||
"d3-hexbin": "^0.2.2",
|
||||
"diff": "^5.1.0",
|
||||
"es6-promisify": "^7.0.0",
|
||||
|
@ -123,14 +123,14 @@
|
|||
"flat": "^5.0.2",
|
||||
"geodesy": "1.1.3",
|
||||
"highlight.js": "^11.7.0",
|
||||
"jimp": "^0.16.2",
|
||||
"jimp": "^0.16.13",
|
||||
"jquery": "3.6.3",
|
||||
"js-crc": "^0.2.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"jsesc": "^3.0.2",
|
||||
"json5": "^2.2.3",
|
||||
"jsonpath-plus": "^7.2.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"jsonwebtoken": "8.5.1",
|
||||
"jsqr": "^1.4.0",
|
||||
"jsrsasign": "^10.6.1",
|
||||
"kbpgp": "2.1.15",
|
||||
|
@ -143,7 +143,7 @@
|
|||
"lz4js": "^0.2.0",
|
||||
"markdown-it": "^13.0.1",
|
||||
"moment": "^2.29.4",
|
||||
"moment-timezone": "^0.5.40",
|
||||
"moment-timezone": "^0.5.41",
|
||||
"ngeohash": "^0.6.3",
|
||||
"node-forge": "^1.3.1",
|
||||
"node-md6": "^0.1.0",
|
||||
|
@ -155,7 +155,7 @@
|
|||
"path": "^0.12.7",
|
||||
"popper.js": "^1.16.1",
|
||||
"process": "^0.11.10",
|
||||
"protobufjs": "^7.1.2",
|
||||
"protobufjs": "^7.2.2",
|
||||
"qr-image": "^3.2.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"scryptsy": "^2.1.0",
|
||||
|
@ -165,7 +165,7 @@
|
|||
"ssdeep.js": "0.0.3",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"tesseract.js": "3.0.3",
|
||||
"ua-parser-js": "^1.0.32",
|
||||
"ua-parser-js": "^1.0.33",
|
||||
"unorm": "^1.6.0",
|
||||
"utf8": "^3.0.0",
|
||||
"vkbeautify": "^0.99.3",
|
||||
|
|
|
@ -27,8 +27,8 @@ class Chef {
|
|||
*
|
||||
* @param {string|ArrayBuffer} input - The input data as a string or ArrayBuffer
|
||||
* @param {Object[]} recipeConfig - The recipe configuration object
|
||||
* @param {Object} options - The options object storing various user choices
|
||||
* @param {boolean} options.attempHighlight - Whether or not to attempt highlighting
|
||||
* @param {Object} [options={}] - The options object storing various user choices
|
||||
* @param {string} [options.returnType] - What type to return the result as
|
||||
*
|
||||
* @returns {Object} response
|
||||
* @returns {string} response.result - The output of the recipe
|
||||
|
@ -37,7 +37,7 @@ class Chef {
|
|||
* @returns {number} response.duration - The number of ms it took to execute the recipe
|
||||
* @returns {number} response.error - The error object thrown by a failed operation (false if no error)
|
||||
*/
|
||||
async bake(input, recipeConfig, options) {
|
||||
async bake(input, recipeConfig, options={}) {
|
||||
log.debug("Chef baking");
|
||||
const startTime = Date.now(),
|
||||
recipe = new Recipe(recipeConfig),
|
||||
|
@ -68,9 +68,8 @@ class Chef {
|
|||
await recipe.present(this.dish);
|
||||
|
||||
const returnType =
|
||||
this.dish.type === Dish.HTML ?
|
||||
Dish.HTML :
|
||||
Dish.ARRAY_BUFFER;
|
||||
this.dish.type === Dish.HTML ? Dish.HTML :
|
||||
options?.returnType ? options.returnType : Dish.ARRAY_BUFFER;
|
||||
|
||||
return {
|
||||
dish: rawDish,
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
// loglevel import required for Node API
|
||||
import log from "loglevel";
|
||||
import utf8 from "utf8";
|
||||
import {fromBase64, toBase64} from "./lib/Base64.mjs";
|
||||
import {fromHex} from "./lib/Hex.mjs";
|
||||
|
|
|
@ -10,8 +10,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import jsQR from "jsqr";
|
||||
import qr from "qr-image";
|
||||
import Utils from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Parses a QR code image from an image
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Add Text To Image operation
|
||||
|
|
|
@ -10,8 +10,7 @@ import { isWorkerEnvironment } from "../Utils.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { gaussianBlur } from "../lib/ImageManipulation.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Blur Image operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Contain Image operation
|
||||
|
|
|
@ -8,8 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Convert Image Format operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Cover Image operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Crop Image operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Image Dither operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import Utils from "../Utils.mjs";
|
||||
import { fromBinary } from "../lib/Binary.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Extract LSB operation
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Flip Image operation
|
||||
|
|
|
@ -59,7 +59,7 @@ class FromCharcode extends Operation {
|
|||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
return [];
|
||||
return new ArrayBuffer;
|
||||
}
|
||||
|
||||
if (base !== 16 && isWorkerEnvironment()) self.setOption("attemptHighlight", false);
|
||||
|
|
|
@ -10,8 +10,7 @@ import Utils from "../Utils.mjs";
|
|||
import {isImage} from "../lib/FileType.mjs";
|
||||
import {toBase64} from "../lib/Base64.mjs";
|
||||
import {isWorkerEnvironment} from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Generate Image operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Image Brightness / Contrast operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Image Filter operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Image Hue/Saturation/Lightness operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Image Opacity operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Invert Image operation
|
||||
|
|
|
@ -8,8 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Normalise Image operation
|
||||
|
|
|
@ -10,8 +10,7 @@ import Utils from "../Utils.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { runHash } from "../lib/Hash.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Randomize Colour Palette operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Resize Image operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Rotate Image operation
|
||||
|
|
|
@ -10,8 +10,7 @@ import { isImage } from "../lib/FileType.mjs";
|
|||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { gaussianBlur } from "../lib/ImageManipulation.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Sharpen Image operation
|
||||
|
|
|
@ -8,8 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import {isImage} from "../lib/FileType.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* Split Colour Channels operation
|
||||
|
|
|
@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import Utils from "../Utils.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimplib from "jimp/es/index.js";
|
||||
const jimp = jimplib.default ? jimplib.default : jimplib;
|
||||
import jimp from "jimp";
|
||||
|
||||
/**
|
||||
* View Bit Plane operation
|
||||
|
|
|
@ -74,9 +74,7 @@ class TestRegister {
|
|||
const result = await chef.bake(
|
||||
test.input,
|
||||
test.recipeConfig,
|
||||
{},
|
||||
0,
|
||||
false
|
||||
{ returnType: "string" }
|
||||
);
|
||||
|
||||
const ret = {
|
||||
|
|
Loading…
Reference in a new issue