mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Added 'Comment' operation for annotating the recipe
This commit is contained in:
parent
d6895537ac
commit
addd45ae8e
4 changed files with 59 additions and 0 deletions
|
@ -193,6 +193,20 @@ const FlowControl = {
|
||||||
return state;
|
return state;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment operation.
|
||||||
|
*
|
||||||
|
* @param {Object} state - The current state of the recipe.
|
||||||
|
* @param {number} state.progress - The current position in the recipe.
|
||||||
|
* @param {Dish} state.dish - The Dish being operated on.
|
||||||
|
* @param {Operation[]} state.opList - The list of operations in the recipe.
|
||||||
|
* @returns {Object} The updated state of the recipe.
|
||||||
|
*/
|
||||||
|
runComment: function(state) {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FlowControl;
|
export default FlowControl;
|
||||||
|
|
|
@ -292,6 +292,7 @@ const Categories = [
|
||||||
"Jump",
|
"Jump",
|
||||||
"Conditional Jump",
|
"Conditional Jump",
|
||||||
"Return",
|
"Return",
|
||||||
|
"Comment"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -162,6 +162,20 @@ const OperationConfig = {
|
||||||
flowControl: true,
|
flowControl: true,
|
||||||
args: []
|
args: []
|
||||||
},
|
},
|
||||||
|
"Comment": {
|
||||||
|
description: "Provides a place to write comments within the flow of the recipe. This operation has no computational effect.",
|
||||||
|
run: FlowControl.runComment,
|
||||||
|
inputType: "string",
|
||||||
|
outputType: "string",
|
||||||
|
flowControl: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
name: "",
|
||||||
|
type: "text",
|
||||||
|
value: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"From Base64": {
|
"From Base64": {
|
||||||
description: "Base64 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.<br><br>This operation decodes data from an ASCII Base64 string back into its raw format.<br><br>e.g. <code>aGVsbG8=</code> becomes <code>hello</code>",
|
description: "Base64 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.<br><br>This operation decodes data from an ASCII Base64 string back into its raw format.<br><br>e.g. <code>aGVsbG8=</code> becomes <code>hello</code>",
|
||||||
run: Base64.runFrom,
|
run: Base64.runFrom,
|
||||||
|
|
|
@ -111,4 +111,34 @@ TestRegister.addTests([
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Comment: nothing",
|
||||||
|
input: "",
|
||||||
|
expectedOutput: "",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Comment",
|
||||||
|
"args": [""]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Fork, Comment, Base64",
|
||||||
|
input: "cat\nsat\nmat",
|
||||||
|
expectedOutput: "Y2F0\nc2F0\nbWF0\n",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Fork",
|
||||||
|
"args": ["\\n","\\n",false]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "Comment",
|
||||||
|
"args": ["Testing 123"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "To Base64",
|
||||||
|
"args": ["A-Za-z0-9+/="]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue