mirror of
https://github.com/gchq/CyberChef
synced 2026-01-08 19:43:18 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b28a891a40 | ||
|
|
834ff95702 | ||
|
|
3472484601 | ||
|
|
826a8c8a74 | ||
|
|
c66703f0ca | ||
|
|
874e7d8d54 | ||
|
|
4e2b85b8c8 | ||
|
|
5314a456cb | ||
|
|
ba2a5b195c | ||
|
|
f8115671ee | ||
|
|
494279edd8 | ||
|
|
bd6673afed | ||
|
|
210daf7324 | ||
|
|
06708949a1 | ||
|
|
da901e20d9 | ||
|
|
6810f38808 | ||
|
|
087cc6b8fd | ||
|
|
10c8101476 | ||
|
|
22028b074a | ||
|
|
3d086beed2 | ||
|
|
777d814e70 | ||
|
|
15c26a95c5 | ||
|
|
014e70a7b1 | ||
|
|
5148b16246 | ||
|
|
111546ad1a | ||
|
|
a8fbd5164e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,7 +4,6 @@ travis.log
|
|||||||
build
|
build
|
||||||
.vscode
|
.vscode
|
||||||
.*.swp
|
.*.swp
|
||||||
.DS_Store
|
|
||||||
src/core/config/modules/*
|
src/core/config/modules/*
|
||||||
src/core/config/OperationConfig.json
|
src/core/config/OperationConfig.json
|
||||||
src/core/operations/index.mjs
|
src/core/operations/index.mjs
|
||||||
|
|||||||
43
package-lock.json
generated
43
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cyberchef",
|
"name": "cyberchef",
|
||||||
"version": "9.7.3",
|
"version": "9.7.10",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -6026,8 +6026,7 @@
|
|||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
@@ -6048,14 +6047,12 @@
|
|||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@@ -6070,20 +6067,17 @@
|
|||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -6200,8 +6194,7 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
@@ -6213,7 +6206,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
@@ -6228,7 +6220,6 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@@ -6236,14 +6227,12 @@
|
|||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.3.5",
|
"version": "2.3.5",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.2",
|
"safe-buffer": "^5.1.2",
|
||||||
"yallist": "^3.0.0"
|
"yallist": "^3.0.0"
|
||||||
@@ -6262,7 +6251,6 @@
|
|||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
@@ -6343,8 +6331,7 @@
|
|||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
@@ -6356,7 +6343,6 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -6442,8 +6428,7 @@
|
|||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
@@ -6479,7 +6464,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
@@ -6499,7 +6483,6 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
@@ -6543,14 +6526,12 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cyberchef",
|
"name": "cyberchef",
|
||||||
"version": "9.7.3",
|
"version": "9.7.10",
|
||||||
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
||||||
"author": "n1474335 <n1474335@gmail.com>",
|
"author": "n1474335 <n1474335@gmail.com>",
|
||||||
"homepage": "https://gchq.github.io/CyberChef",
|
"homepage": "https://gchq.github.io/CyberChef",
|
||||||
|
|||||||
9
src/core/errors/index.mjs
Normal file
9
src/core/errors/index.mjs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import OperationError from "./OperationError.mjs";
|
||||||
|
import DishError from "./DishError.mjs";
|
||||||
|
import ExcludedOperationError from "./ExcludedOperationError";
|
||||||
|
|
||||||
|
export {
|
||||||
|
OperationError,
|
||||||
|
DishError,
|
||||||
|
ExcludedOperationError,
|
||||||
|
};
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Utils from "../Utils.mjs";
|
import Utils from "../Utils.mjs";
|
||||||
|
import OperationError from "../errors/OperationError.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base64's the input byte array using the given alphabet, returning a string.
|
* Base64's the input byte array using the given alphabet, returning a string.
|
||||||
@@ -33,6 +33,9 @@ export function toBase64(data, alphabet="A-Za-z0-9+/=") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alphabet = Utils.expandAlphRange(alphabet).join("");
|
alphabet = Utils.expandAlphRange(alphabet).join("");
|
||||||
|
if (alphabet.length !== 64 && alphabet.length !== 65) { // Allow for padding
|
||||||
|
throw new OperationError(`Invalid Base64 alphabet length (${alphabet.length}): ${alphabet}`);
|
||||||
|
}
|
||||||
|
|
||||||
let output = "",
|
let output = "",
|
||||||
chr1, chr2, chr3,
|
chr1, chr2, chr3,
|
||||||
@@ -86,6 +89,9 @@ export function fromBase64(data, alphabet="A-Za-z0-9+/=", returnType="string", r
|
|||||||
|
|
||||||
alphabet = alphabet || "A-Za-z0-9+/=";
|
alphabet = alphabet || "A-Za-z0-9+/=";
|
||||||
alphabet = Utils.expandAlphRange(alphabet).join("");
|
alphabet = Utils.expandAlphRange(alphabet).join("");
|
||||||
|
if (alphabet.length !== 64 && alphabet.length !== 65) { // Allow for padding
|
||||||
|
throw new OperationError(`Invalid Base64 alphabet length (${alphabet.length}): ${alphabet}`);
|
||||||
|
}
|
||||||
|
|
||||||
const output = [];
|
const output = [];
|
||||||
let chr1, chr2, chr3,
|
let chr1, chr2, chr3,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -97,6 +97,7 @@ class Magic {
|
|||||||
|
|
||||||
if (!fileType.length) return null;
|
if (!fileType.length) return null;
|
||||||
return {
|
return {
|
||||||
|
name: fileType[0].name,
|
||||||
ext: fileType[0].extension,
|
ext: fileType[0].extension,
|
||||||
mime: fileType[0].mime,
|
mime: fileType[0].mime,
|
||||||
desc: fileType[0].description
|
desc: fileType[0].description
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Bzip2Decompress extends Operation {
|
|||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
async run(input, args) {
|
||||||
const [small] = args;
|
const [small] = args;
|
||||||
if (input.byteLength <= 0) {
|
if (input.byteLength <= 0) {
|
||||||
throw new OperationError("Please provide an input.");
|
throw new OperationError("Please provide an input.");
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ import Operation from "../Operation.mjs";
|
|||||||
import {detectFileType} from "../lib/FileType.mjs";
|
import {detectFileType} from "../lib/FileType.mjs";
|
||||||
import {FILE_SIGNATURES} from "../lib/FileSignatures.mjs";
|
import {FILE_SIGNATURES} from "../lib/FileSignatures.mjs";
|
||||||
|
|
||||||
|
// Concat all supported extensions into a single flat list
|
||||||
|
const exts = [].concat.apply([], Object.keys(FILE_SIGNATURES).map(cat =>
|
||||||
|
[].concat.apply([], FILE_SIGNATURES[cat].map(sig =>
|
||||||
|
sig.extension.split(",")
|
||||||
|
))
|
||||||
|
)).unique().sort().join(", ");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect File Type operation
|
* Detect File Type operation
|
||||||
*/
|
*/
|
||||||
@@ -22,11 +29,7 @@ class DetectFileType extends Operation {
|
|||||||
this.name = "Detect File Type";
|
this.name = "Detect File Type";
|
||||||
this.module = "Default";
|
this.module = "Default";
|
||||||
this.description = "Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.<br><br>Currently supports the following file types: " +
|
this.description = "Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.<br><br>Currently supports the following file types: " +
|
||||||
Object.keys(FILE_SIGNATURES).map(cat =>
|
exts + ".";
|
||||||
FILE_SIGNATURES[cat].map(sig =>
|
|
||||||
sig.extension.split(",")[0]
|
|
||||||
).join(", ")
|
|
||||||
).join(", ") + ".";
|
|
||||||
this.infoURL = "https://wikipedia.org/wiki/List_of_file_signatures";
|
this.infoURL = "https://wikipedia.org/wiki/List_of_file_signatures";
|
||||||
this.inputType = "ArrayBuffer";
|
this.inputType = "ArrayBuffer";
|
||||||
this.outputType = "string";
|
this.outputType = "string";
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class GeneratePGPKeyPair extends Operation {
|
|||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
async run(input, args) {
|
||||||
const [keyType, keySize] = args[0].split("-"),
|
const [keyType, keySize] = args[0].split("-"),
|
||||||
password = args[1],
|
password = args[1],
|
||||||
name = args[2],
|
name = args[2],
|
||||||
|
|||||||
@@ -43,11 +43,13 @@ class NodeRecipe {
|
|||||||
} else {
|
} else {
|
||||||
throw new TypeError("Inputted function not a Chef operation.");
|
throw new TypeError("Inputted function not a Chef operation.");
|
||||||
}
|
}
|
||||||
// CASE: op with configuration
|
// CASE: op, maybe with configuration
|
||||||
} else if (ing.op && ing.args) {
|
} else if (ing.op) {
|
||||||
// Return op and args pair for opList item.
|
|
||||||
const sanitisedOp = this._validateIngredient(ing.op);
|
const sanitisedOp = this._validateIngredient(ing.op);
|
||||||
return {op: sanitisedOp, args: ing.args};
|
if (ing.args) {
|
||||||
|
return {op: sanitisedOp, args: ing.args};
|
||||||
|
}
|
||||||
|
return sanitisedOp;
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError("Recipe can only contain function names or functions");
|
throw new TypeError("Recipe can only contain function names or functions");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ let code = `/**
|
|||||||
import NodeDish from "./NodeDish.mjs";
|
import NodeDish from "./NodeDish.mjs";
|
||||||
import { _wrap, help, bake, _explainExludedFunction } from "./api.mjs";
|
import { _wrap, help, bake, _explainExludedFunction } from "./api.mjs";
|
||||||
import File from "./File.mjs";
|
import File from "./File.mjs";
|
||||||
|
import { OperationError, DishError, ExcludedOperationError } from "../core/errors/index";
|
||||||
import {
|
import {
|
||||||
// import as core_ to avoid name clashes after wrap.
|
// import as core_ to avoid name clashes after wrap.
|
||||||
`;
|
`;
|
||||||
@@ -115,6 +116,9 @@ Object.keys(operations).forEach((op) => {
|
|||||||
code += " NodeDish as Dish,\n";
|
code += " NodeDish as Dish,\n";
|
||||||
code += " prebaked as bake,\n";
|
code += " prebaked as bake,\n";
|
||||||
code += " help,\n";
|
code += " help,\n";
|
||||||
|
code += " OperationError,\n";
|
||||||
|
code += " ExcludedOperationError,\n";
|
||||||
|
code += " DishError,\n";
|
||||||
code += "};\n";
|
code += "};\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1046,15 +1046,25 @@ class OutputWaiter {
|
|||||||
* @param {Object[]} options
|
* @param {Object[]} options
|
||||||
*/
|
*/
|
||||||
backgroundMagicResult(options) {
|
backgroundMagicResult(options) {
|
||||||
if (!options.length ||
|
if (!options.length) return;
|
||||||
!options[0].recipe.length)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const currentRecipeConfig = this.app.getRecipeConfig();
|
const currentRecipeConfig = this.app.getRecipeConfig();
|
||||||
const newRecipeConfig = currentRecipeConfig.concat(options[0].recipe);
|
let msg = "",
|
||||||
const opSequence = options[0].recipe.map(o => o.op).join(", ");
|
newRecipeConfig;
|
||||||
|
|
||||||
this.showMagicButton(opSequence, options[0].data, newRecipeConfig);
|
if (options[0].recipe.length) {
|
||||||
|
const opSequence = options[0].recipe.map(o => o.op).join(", ");
|
||||||
|
newRecipeConfig = currentRecipeConfig.concat(options[0].recipe);
|
||||||
|
msg = `<i>${opSequence}</i> will produce <span class="data-text">"${Utils.escapeHtml(Utils.truncate(options[0].data), 30)}"</span>`;
|
||||||
|
} else if (options[0].fileType && options[0].fileType.name) {
|
||||||
|
const ft = options[0].fileType;
|
||||||
|
newRecipeConfig = currentRecipeConfig.concat([{op: "Detect File Type", args: []}]);
|
||||||
|
msg = `<i>${ft.name}</i> file detected`;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showMagicButton(msg, newRecipeConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1072,15 +1082,14 @@ class OutputWaiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Magic button with a title and adds a link to a complete recipe.
|
* Displays the Magic button with a title and adds a link to a recipe.
|
||||||
*
|
*
|
||||||
* @param {string} opSequence
|
* @param {string} msg
|
||||||
* @param {string} result
|
|
||||||
* @param {Object[]} recipeConfig
|
* @param {Object[]} recipeConfig
|
||||||
*/
|
*/
|
||||||
showMagicButton(opSequence, result, recipeConfig) {
|
showMagicButton(msg, recipeConfig) {
|
||||||
const magicButton = document.getElementById("magic");
|
const magicButton = document.getElementById("magic");
|
||||||
magicButton.setAttribute("data-original-title", `<i>${opSequence}</i> will produce <span class="data-text">"${Utils.escapeHtml(Utils.truncate(result), 30)}"</span>`);
|
magicButton.setAttribute("data-original-title", msg);
|
||||||
magicButton.setAttribute("data-recipe", JSON.stringify(recipeConfig), null, "");
|
magicButton.setAttribute("data-recipe", JSON.stringify(recipeConfig), null, "");
|
||||||
magicButton.classList.remove("hidden");
|
magicButton.classList.remove("hidden");
|
||||||
magicButton.classList.add("pulse");
|
magicButton.classList.add("pulse");
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ class TestRegister {
|
|||||||
* Run all api related tests and wrap results in report format
|
* Run all api related tests and wrap results in report format
|
||||||
*/
|
*/
|
||||||
runApiTests() {
|
runApiTests() {
|
||||||
console.log("Running tests...");
|
|
||||||
|
|
||||||
return Promise.all(this.apiTests.map(async function(test, i) {
|
return Promise.all(this.apiTests.map(async function(test, i) {
|
||||||
const result = {
|
const result = {
|
||||||
test: test,
|
test: test,
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
/**
|
/**
|
||||||
* Print useful stack on error
|
* Print useful stack on error
|
||||||
*/
|
*/
|
||||||
const wrapRun = (run) => () => {
|
const wrapRun = (run) => async () => {
|
||||||
try {
|
try {
|
||||||
run();
|
await run();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.dir(e);
|
console.dir(e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -259,6 +259,13 @@ TestRegister.addApiTests([
|
|||||||
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
|
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
it("chef.bake: should take single JSON object desribing op with optional args", () => {
|
||||||
|
const result = chef.bake("some input", {
|
||||||
|
op: chef.toHex,
|
||||||
|
});
|
||||||
|
assert.strictEqual(result.toString(), "73 6f 6d 65 20 69 6e 70 75 74");
|
||||||
|
}),
|
||||||
|
|
||||||
it("chef.bake: should take single JSON object describing op and args ARRAY", () => {
|
it("chef.bake: should take single JSON object describing op and args ARRAY", () => {
|
||||||
const result = chef.bake("some input", {
|
const result = chef.bake("some input", {
|
||||||
op: chef.toHex,
|
op: chef.toHex,
|
||||||
@@ -295,6 +302,21 @@ TestRegister.addApiTests([
|
|||||||
assert.strictEqual(result.toString(), "67;63;72;66;146;72;66;144;72;66;65;72;62;60;72;66;71;72;66;145;72;67;60;72;67;65;72;67;64");
|
assert.strictEqual(result.toString(), "67;63;72;66;146;72;66;144;72;66;65;72;62;60;72;66;71;72;66;145;72;67;60;72;67;65;72;67;64");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
it("chef.bake: should take multiple ops in JSON object form, some without args", () => {
|
||||||
|
const result = chef.bake("some input", [
|
||||||
|
{
|
||||||
|
op: chef.toHex,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
op: "to octal",
|
||||||
|
args: {
|
||||||
|
delimiter: "Semi-colon",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
assert.strictEqual(result.toString(), "67;63;40;66;146;40;66;144;40;66;65;40;62;60;40;66;71;40;66;145;40;67;60;40;67;65;40;67;64");
|
||||||
|
}),
|
||||||
|
|
||||||
it("chef.bake: should handle op with multiple args", () => {
|
it("chef.bake: should handle op with multiple args", () => {
|
||||||
const result = chef.bake("some input", {
|
const result = chef.bake("some input", {
|
||||||
op: "to morse code",
|
op: "to morse code",
|
||||||
@@ -324,6 +346,17 @@ TestRegister.addApiTests([
|
|||||||
assert.strictEqual(result.toString(), "begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something");
|
assert.strictEqual(result.toString(), "begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
it("chef.bake: should accept Clean JSON format from Chef website - args optional", () => {
|
||||||
|
const result = chef.bake("some input", [
|
||||||
|
{ "op": "To Morse Code" },
|
||||||
|
{ "op": "Hex to PEM",
|
||||||
|
"args": ["SOMETHING"] },
|
||||||
|
{ "op": "To Snake case",
|
||||||
|
"args": [false] }
|
||||||
|
]);
|
||||||
|
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
|
||||||
|
}),
|
||||||
|
|
||||||
it("Excluded operations: throw a sensible error when you try and call one", () => {
|
it("Excluded operations: throw a sensible error when you try and call one", () => {
|
||||||
try {
|
try {
|
||||||
chef.fork();
|
chef.fork();
|
||||||
|
|||||||
@@ -130,11 +130,14 @@ Tiger-128`;
|
|||||||
it("atBash Cipher", () => {
|
it("atBash Cipher", () => {
|
||||||
const result = chef.atbashCipher("Happy as a Clam");
|
const result = chef.atbashCipher("Happy as a Clam");
|
||||||
assert.strictEqual(result.toString(), "Szkkb zh z Xozn");
|
assert.strictEqual(result.toString(), "Szkkb zh z Xozn");
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("Bcrypt", async () => {
|
it("Bcrypt", async () => {
|
||||||
const result = await chef.bcrypt("Put a Sock In It");
|
const result = await chef.bcrypt("Put a Sock In It");
|
||||||
assert.strictEqual(result.toString(), "$2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6");
|
const strResult = result.toString();
|
||||||
|
assert.equal(strResult.length, 60);
|
||||||
|
assert.equal(strResult.slice(0, 7), "$2a$10$");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("bcryptCompare", async() => {
|
it("bcryptCompare", async() => {
|
||||||
@@ -583,47 +586,7 @@ Password: 034148`;
|
|||||||
const result = await chef.generatePGPKeyPair("Back To the Drawing Board", {
|
const result = await chef.generatePGPKeyPair("Back To the Drawing Board", {
|
||||||
keyType: "ECC-256",
|
keyType: "ECC-256",
|
||||||
});
|
});
|
||||||
const expected = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
assert.strictEqual(result.toString().length, 2005);
|
||||||
Version: Keybase OpenPGP v2.0.77
|
|
||||||
Comment: https://keybase.io/crypto
|
|
||||||
|
|
||||||
xYgEW3KciQEBAK96Lx9G0WZiw1yhC35IogdumoxEJXsLdAVIjmskXeAfABEBAAEA
|
|
||||||
AP4wK+OZu3AqojwtRoyIK1pHKU93OAuam1iaLCOGCwCckQCA5PjU0aLNZqy/eKyX
|
|
||||||
T3rpKQCAxDDT5hHGAUfFPUu73KWABwB/WKpeUp7KwurMSbYVhgr1TijszQDCVAQT
|
|
||||||
AQoAHgUCW3KciQIbLwMLCQcDFQoIAh4BAheAAxYCAQIZAQAKCRD0VeyUMgmpz3OE
|
|
||||||
AP9qsnhhoK85Tnu6VKwKm1iMiJAssDQnFztDaMmmVdrN/MeIBFtynIkBAQDDhjIw
|
|
||||||
fxOprqVMYLk6aC45JyPAA2POzu0Zb/rx0tKeBwARAQABAAD/XAr66oiP9ZORHiT0
|
|
||||||
XZH4m7vwZt7AHuq4pYtVlMQXk60AgPw2Mno/wStvE/SBa9R7AtsAgMZ2BkJjvNPZ
|
|
||||||
9YA6cl4lW0UAgI1+kJVLZ5VR9fPENfJR80EtncKDBBgBCgAPBQJbcpyJBQkPCZwA
|
|
||||||
AhsuAEgJEPRV7JQyCanPPSAEGQEKAAYFAltynIkACgkQrewgWMQZ/b2blwD/dbwh
|
|
||||||
/3F9xv+YGAwq8i1mzzswg4qBct6LoSIjGglULT9RIQD/cYd31YfKrEnbSBWD5PLi
|
|
||||||
zcSsxtBGKphwXiPAlQJ1Q5DHiARbcpyJAQEAs8V418lf1T74PpAwdBTiViEUX9jB
|
|
||||||
e+ZrAEVaq5nu1C8AEQEAAQAA/iPWhS23hnRTllealR4/H5OofZRwxvIQrxAJp6z1
|
|
||||||
ICRxAIDayRpCAbK5EC3DzRU2z4VpAIDSWYSs9inI1VTfamJPMWHXAIC3aaukzCP4
|
|
||||||
GEGeFobX/thnKhnCgwQYAQoADwUCW3KciQUJA8JnAAIbLgBICRD0VeyUMgmpzz0g
|
|
||||||
BBkBCgAGBQJbcpyJAAoJEB4jzL1hmQIXamUA/0c1M6BSqVtxNowPcOAXKYIxMca1
|
|
||||||
VFcRWolHnZqdZQ7k/J8A/3HvNLRS3p1HvjQEfXl/qKoRRn843Py09ptDHh+xpGKh
|
|
||||||
=d+Vp
|
|
||||||
-----END PGP PRIVATE KEY BLOCK-----
|
|
||||||
|
|
||||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
||||||
Version: Keybase OpenPGP v2.0.77
|
|
||||||
Comment: https://keybase.io/crypto
|
|
||||||
|
|
||||||
xi0EW3KciQEBAK96Lx9G0WZiw1yhC35IogdumoxEJXsLdAVIjmskXeAfABEBAAHN
|
|
||||||
AMJUBBMBCgAeBQJbcpyJAhsvAwsJBwMVCggCHgECF4ADFgIBAhkBAAoJEPRV7JQy
|
|
||||||
CanPc4QA/2qyeGGgrzlOe7pUrAqbWIyIkCywNCcXO0NoyaZV2s38zi0EW3KciQEB
|
|
||||||
AMOGMjB/E6mupUxguTpoLjknI8ADY87O7Rlv+vHS0p4HABEBAAHCgwQYAQoADwUC
|
|
||||||
W3KciQUJDwmcAAIbLgBICRD0VeyUMgmpzz0gBBkBCgAGBQJbcpyJAAoJEK3sIFjE
|
|
||||||
Gf29m5cA/3W8If9xfcb/mBgMKvItZs87MIOKgXLei6EiIxoJVC0/USEA/3GHd9WH
|
|
||||||
yqxJ20gVg+Ty4s3ErMbQRiqYcF4jwJUCdUOQzi0EW3KciQEBALPFeNfJX9U++D6Q
|
|
||||||
MHQU4lYhFF/YwXvmawBFWquZ7tQvABEBAAHCgwQYAQoADwUCW3KciQUJA8JnAAIb
|
|
||||||
LgBICRD0VeyUMgmpzz0gBBkBCgAGBQJbcpyJAAoJEB4jzL1hmQIXamUA/0c1M6BS
|
|
||||||
qVtxNowPcOAXKYIxMca1VFcRWolHnZqdZQ7k/J8A/3HvNLRS3p1HvjQEfXl/qKoR
|
|
||||||
Rn843Py09ptDHh+xpGKh
|
|
||||||
=ySwG
|
|
||||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
|
||||||
assert.strictEqual(result.toString(), expected);
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("Generate UUID", () => {
|
it("Generate UUID", () => {
|
||||||
@@ -737,43 +700,105 @@ CPU
|
|||||||
assert.strictEqual(result.toString(), expected);
|
assert.strictEqual(result.toString(), expected);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("PGP Encrypt", async () => {
|
it("PGP Encrypt and decrypt", async () => {
|
||||||
const pbkey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
const pbkey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
Version: GnuPG v1
|
Version: Keybase OpenPGP v2.1.3
|
||||||
|
|
||||||
mI0EVWOihAEEALzwFAVWTrD0KiWCH5tX6q6QsGjlRn4IP2uj/xWsJZDNbCKm+JAe
|
|
||||||
1RvIootpW1+PNNMJlIInwUgtCjtJ9gZbGBpXeqwdSn0oYuj9X86ekXOUnZsRoPCj
|
|
||||||
RwS8kpbrvRVfhWN8hYuXFcXK2J2Ld0ZpVyJzkncpFdpAgzTPMfrO1HS5ABEBAAG0
|
|
||||||
GmdwZyBuYW1lIChjb21tZW50KSA8ZW1AaWw+iLgEEwECACIFAlVjooQCGwMGCwkI
|
|
||||||
BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEBg8dTRwi4g5I40D/2+uUuQxa3uMrAeI
|
|
||||||
dXLaJWz3V0cl1rotfBP47apDUGbkm1HVgULJUo8Bo15Ii83ST8TUsyja3XcLutHb
|
|
||||||
IwYSWo41gEV48+NKoN6Oy3HwqBoHfH06bu0If75vdSjnZpB2dO/Ph7L9kz78gc4y
|
|
||||||
tZx4bE64MTlL2AYghZxyYpFyydjXuI0EVWOihAEEANE4UU+4iB2hMAXq93hiBzIh
|
|
||||||
AMtn/DlWbJkpdUgrjKOG6tILs28mrw9rI4PivmT7grkyNW8sa3ATsmWC1xChxGTN
|
|
||||||
T1guyh0Hhbc3Otfng2BFSWcBkPwUoNaOdrVFpP9J51IYrsQHsjbZlY45ghDBzM6t
|
|
||||||
sISfkmmFCsp0l7w/XAcvABEBAAGInwQYAQIACQUCVWOihAIbDAAKCRAYPHU0cIuI
|
|
||||||
OQ2BA/9KWqOhXZW75ac7CuJMfileZR7vRy9CkKyNG21cZtAlqftAX+m8FGdG0duU
|
|
||||||
jKHiPvjXhSfP3lmrQ7brja9LgSzkiBqQzvPW55G67nGQdUC+mqZNJNlRh+8atf9I
|
|
||||||
5nxg2i8zn6F5cLaNWz7cl27m1/mXKcH3gult1PLR4PiYLiC9aw==
|
|
||||||
=xw3e
|
|
||||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
|
||||||
|
|
||||||
const result = await chef.PGPEncrypt("A Fool and His Money are Soon Parted", {
|
|
||||||
publicKeyOfRecipient: pbkey,
|
|
||||||
});
|
|
||||||
const expected = `-----BEGIN PGP MESSAGE-----
|
|
||||||
Version: Keybase OpenPGP v2.0.77
|
|
||||||
Comment: https://keybase.io/crypto
|
Comment: https://keybase.io/crypto
|
||||||
|
|
||||||
wYwDv1kIXPPNwmABA/4syW+oO+S/mfpjdp83/MZJiKh6XNQoPr/N5/1Is/QXYu9V
|
xo0EXZtlowEEAKUqTFownTmqgXWu2KDrtyNYtFck7a16WM5QD95bFoAFFdnlwZ45
|
||||||
/v8/b+eReOpUVC6cVrJ8U5cB19y1Az3NQWHXLEC0jND2wL3cUM4sv87hlvv2PLhc
|
6Vw8G8LCzHdyRXYp/JF1GknDrAd7nIRE+SuSz2yVK5nlOCfO1HFcg2Ov7e7/pBwd
|
||||||
okv8OHNCitRiweo7NZHVygHGdFvY082G47e1PkyPAuVynvzdD450ta/s/KOxZdJg
|
qawx9GUIsCKd/6NxwDuT4YqarLFsuwljRC/eQiibO+ejnhoiKcU69sTNABEBAAHN
|
||||||
ARbZIrC6WmjYNLwhbpRYawKD+3N4I5qliRpU2POKRi9UROAW9dth6egy60TTCvyO
|
AMK0BBMBCgAeBQJdm2WjAhsvAwsJBwMVCggCHgECF4ADFgIBAhkBAAoJEGS79V2S
|
||||||
jmPGsv1elXxVzqs58UZLD2c3vBhGkU2BV6kRKh+lj/EcVrzsFhGCz/7DKxPoDHLS
|
7D0owtMD/RT+o4BQJ8NSQBDgkYf42uOOu1Ud6GuN89nX6n20yAZbmqQ8CHnHY+Qc
|
||||||
=IBYt
|
l6ft4HnbIaNrI3arp/C2C+cwFypmt1BKyFEJUXO7ft3i/IxnjpCorDyAMCDckDvq
|
||||||
-----END PGP MESSAGE-----
|
uma1LWtUHLb5s/ZuGMSHnhuji74IRWuIofNPdf7bCZW1GMbW9jNUzo0EXZtlowEE
|
||||||
`;
|
AL38zaNkPmUVQaowP696fayBo18Nxs0yOzC4+0TYv1B/k5aUb0Air2h+o/Xw4E42
|
||||||
assert.strictEqual(result.toString(), expected);
|
Jh9gVdPSvhOAEqdV0UDe71wxa4cfAVMDY9v8ta81MWunChj3ISUk1oIQylTJNsY/
|
||||||
|
b4KWOrLaOtBD9dyFGCzss5vLVdqdMjVIW2Cz0hb6IYG7ABEBAAHCwIMEGAEKAA8F
|
||||||
|
Al2bZaMFCQ8JnAACGy4AqAkQZLv1XZLsPSidIAQZAQoABgUCXZtlowAKCRA16MU2
|
||||||
|
u2hFTX+JBACZ27xk0Afny2jjSoRzqLMrhzE7DBGcg2QqecMdNre12hVompAWcS4l
|
||||||
|
NFmPShKRi6UT8Zb38nD43vwfqwZImn60dOPqqAep3YF/Axm1u5HJb0aMEsb8O9jV
|
||||||
|
sVmNJv9jVTzPdlTGFQjuaeJfk5lwxB+5/O9NcgDhPgRAk9xb4FrT+xzmA/4tD11C
|
||||||
|
AdcITUkTZT4ZOo2418DGeaiaEqWcIkZeQG4Vh5TMj4QtZDwsYQhXPl5Zj1zKIN/1
|
||||||
|
gRrKC+ztaQoDG8pJXTTtc9inRU++dhMqnRGrPcz0VfVXFaiH7PUCy+4WpP6r5Bs5
|
||||||
|
YQ9ESHo+FsmIvDzU3e/PD0SfXfO4vqBrFYN8986NBF2bZaMBBADJafe0w9diaCNx
|
||||||
|
3A7e8MqjbNrhrLkD2cPxXspCATX3SuI19d2+hMiHZfKTyadBTIa+ICxvqoxwxyZD
|
||||||
|
raHSY3CWVZd1V4KB5mqf+3Zj5riLeGU0dtXwi/5c0bdUhBUgHiAMhi75p05jYih5
|
||||||
|
KsNxPcK9hEwPu7B+QeHURMiIgojTGQARAQABwsCDBBgBCgAPBQJdm2WjBQkDwmcA
|
||||||
|
AhsuAKgJEGS79V2S7D0onSAEGQEKAAYFAl2bZaMACgkQzdkMJSM5Bqg2rwP/Ue28
|
||||||
|
m3Fdfgh5JxouZ3Dm2KUDhZL95B+vdMk72acdoU7SRjlyDT8cApRqYx+MIXb8WrPN
|
||||||
|
1xCZnOM4zXeWIM0CAPQ1e/sCrK58L+P+eVngNmrW9epKtZ4L6hx+dqqja9vPZGQK
|
||||||
|
CsFAhA6A1gWB++OLk9Y6H23tWIdKEXMeAX7492zDYgP+OSPS79EWAqXL8SvmDrbl
|
||||||
|
WI5eiM6X5hAMrOjQqzXhatD7eP41N/FC3SfhyhX7hFbagO7MJG2AS5bmSvcuCdcN
|
||||||
|
wDwXd94B+7bfYgJIRKbr272yDwkyzGn+zmxzvMUt6ak5PNzfmadvhMZvIfDftswp
|
||||||
|
GYpXIUU0GObOgP2tpCGTErs=
|
||||||
|
=m++F
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||||
|
const privateKey = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||||
|
Version: Keybase OpenPGP v2.1.3
|
||||||
|
Comment: https://keybase.io/crypto
|
||||||
|
|
||||||
|
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
|
||||||
|
pCGTErs=
|
||||||
|
=Ya+/
|
||||||
|
-----END PGP PRIVATE KEY BLOCK-----`;
|
||||||
|
|
||||||
|
const message = "A Fool and His Money are Soon Parted";
|
||||||
|
|
||||||
|
const encrypted = await chef.PGPEncrypt(message, {
|
||||||
|
publicKeyOfRecipient: pbkey,
|
||||||
|
});
|
||||||
|
const result = await chef.PGPDecrypt(encrypted, {
|
||||||
|
privateKeyOfRecipient: privateKey,
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(result.toString(), message);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("Raw deflate", () => {
|
it("Raw deflate", () => {
|
||||||
@@ -860,17 +885,17 @@ smothering ampersand abreast
|
|||||||
it("toBase64: editableOption", () => {
|
it("toBase64: editableOption", () => {
|
||||||
const result = toBase64("some input", {
|
const result = toBase64("some input", {
|
||||||
alphabet: {
|
alphabet: {
|
||||||
value: "0-9A-W"
|
value: "0-9A-W+/a-zXYZ="
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
assert.strictEqual(result.toString(), "SPI1R1T0");
|
assert.strictEqual(result.toString(), "StXkPI1gRe1sT0==");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("toBase64: editableOptions key is value", () => {
|
it("toBase64: editableOptions key is value", () => {
|
||||||
const result = toBase64("some input", {
|
const result = toBase64("some input", {
|
||||||
alphabet: "0-9A-W",
|
alphabet: "0-9A-W+/a-zXYZ=",
|
||||||
});
|
});
|
||||||
assert.strictEqual(result.toString(), "SPI1R1T0");
|
assert.strictEqual(result.toString(), "StXkPI1gRe1sT0==");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("toBase64: editableOptions default", () => {
|
it("toBase64: editableOptions default", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user