mirror of
https://github.com/gchq/CyberChef
synced 2026-01-10 12:33:16 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d086beed2 | ||
|
|
777d814e70 | ||
|
|
15c26a95c5 | ||
|
|
111546ad1a | ||
|
|
a8fbd5164e |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cyberchef",
|
"name": "cyberchef",
|
||||||
"version": "9.7.3",
|
"version": "9.7.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cyberchef",
|
"name": "cyberchef",
|
||||||
"version": "9.7.3",
|
"version": "9.7.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user