From a35e3348d8ac98663e9baec2754096201745cfc2 Mon Sep 17 00:00:00 2001 From: n1073645 Date: Tue, 3 Dec 2019 09:19:28 +0000 Subject: [PATCH] Input & Output then just Output --- src/core/lib/Magic.mjs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/core/lib/Magic.mjs b/src/core/lib/Magic.mjs index 050772e3..e8e19137 100644 --- a/src/core/lib/Magic.mjs +++ b/src/core/lib/Magic.mjs @@ -279,6 +279,11 @@ class Magic { }); const prevOp = recipeConfig[recipeConfig.length - 1]; + /** + * + * @param flag + * @param sensible + */ async function regexesTests(flag, sensible) { // Execute each of the matching operations, then recursively call the speculativeExecution() @@ -299,14 +304,14 @@ class Magic { if (_buffersEqual(output, new ArrayBuffer())) { return; } - if(flag) { + if (flag) { const outputRegexes = OperationConfig[op.op].outputRegexes; if (outputRegexes) for (const pattern of outputRegexes) if (!(new RegExp(pattern.match, pattern.flags).test(Utils.arrayBufferToStr(output)))) return; } else { - if (!(op.match.test(output))){ + if (!(op.match.test(output))) { return; } } @@ -317,11 +322,11 @@ class Magic { results = results.concat(speculativeResults); })); } - + regexesTests(1, matchingOps); - regexesTests(0, this.opPatterns.getOutputRegexes()); - //console.log("haha",this.opPatterns.getOutputRegexes()); - + // regexesTests(0, this.opPatterns.getOutputRegexes()); + // console.log("haha", results); + if (intensive) { // Run brute forcing of various types on the data and create a new branch for each option const bfEncodings = await this.bruteForce(); @@ -348,7 +353,7 @@ class Magic { ) ); - // console.log(prunedResults); + console.log("important", prunedResults); // Return a sorted list of possible recipes along with their properties return prunedResults.sort((a, b) => {