Merge branch 'esm' of github.com:gchq/CyberChef into esm

This commit is contained in:
n1474335 2018-06-03 17:33:39 +01:00
commit 40a1da10e3

View File

@ -231,8 +231,10 @@ class Magic {
const conf = { const conf = {
op: op, op: op,
args: [encodings[i]] args: [encodings[i]]
}, };
data = await this._runRecipe([conf], sample.buffer);
try {
const data = await this._runRecipe([conf], sample.buffer);
// Only add to the results if it changed the data // Only add to the results if it changed the data
if (!_buffersEqual(data, sample.buffer)) { if (!_buffersEqual(data, sample.buffer)) {
@ -241,6 +243,9 @@ class Magic {
conf: conf conf: conf
}); });
} }
} catch (err) {
continue;
}
} }
}; };
@ -361,8 +366,9 @@ class Magic {
* @returns {ArrayBuffer} * @returns {ArrayBuffer}
*/ */
async _runRecipe(recipeConfig, input=this.inputBuffer) { async _runRecipe(recipeConfig, input=this.inputBuffer) {
input = input instanceof ArrayBuffer ? input : input.buffer;
const dish = new Dish(); const dish = new Dish();
dish.set(input.buffer, Dish.ARRAY_BUFFER); dish.set(input, Dish.ARRAY_BUFFER);
if (ENVIRONMENT_IS_WORKER()) self.loadRequiredModules(recipeConfig); if (ENVIRONMENT_IS_WORKER()) self.loadRequiredModules(recipeConfig);