mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-11 00:31:31 -04:00
Made sure we do not operation loop
This commit is contained in:
parent
b61fd59b60
commit
c42aad7c82
2 changed files with 15 additions and 4 deletions
|
@ -271,7 +271,7 @@ class Magic {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If the recipe is repeating and returning the same data, do not continue
|
// If the recipe is repeating and returning the same data, do not continue
|
||||||
if (prevOp && op.op === prevOp.op && _buffersEqual(output, this.inputBuffer)) {
|
if (prevOp && op.op === prevOp.op && _buffersEqual(output, this.inputBuffer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,9 @@ class Magic {
|
||||||
const outputRegexes = OperationConfig[op.op].outputRegexes;
|
const outputRegexes = OperationConfig[op.op].outputRegexes;
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case "Input":
|
case "Input":
|
||||||
if (outputRegexes)
|
if (outputRegexes) {
|
||||||
|
if (_buffersEqual(output, this.inputBuffer))
|
||||||
|
return;
|
||||||
for (const pattern of outputRegexes)
|
for (const pattern of outputRegexes)
|
||||||
if (new RegExp(pattern.match, pattern.flags).test(Utils.arrayBufferToStr(output))) {
|
if (new RegExp(pattern.match, pattern.flags).test(Utils.arrayBufferToStr(output))) {
|
||||||
if (!pattern.shouldMatch)
|
if (!pattern.shouldMatch)
|
||||||
|
@ -293,6 +295,7 @@ class Magic {
|
||||||
if (pattern.shouldMatch)
|
if (pattern.shouldMatch)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Output":
|
case "Output":
|
||||||
if (new RegExp(op.match, op.flags).test(Utils.arrayBufferToStr(output))) {
|
if (new RegExp(op.match, op.flags).test(Utils.arrayBufferToStr(output))) {
|
||||||
|
@ -302,9 +305,9 @@ class Magic {
|
||||||
if (op.shouldMatch)
|
if (op.shouldMatch)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(output);
|
||||||
|
console.log(this.inputBuffer);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
console.log("This is borked");
|
|
||||||
}
|
}
|
||||||
const magic = new Magic(output, this.opPatterns),
|
const magic = new Magic(output, this.opPatterns),
|
||||||
speculativeResults = await magic.speculativeExecution(
|
speculativeResults = await magic.speculativeExecution(
|
||||||
|
|
|
@ -89,6 +89,14 @@ class DefangURL extends Operation {
|
||||||
flags: "i",
|
flags: "i",
|
||||||
args: [true, true, true, "Everything"],
|
args: [true, true, true, "Everything"],
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
match: "^\\s*(h(tt|xx)ps?|ftp)(://|\\[://\\])(-(\\.|\\[\\.\\]))?([^\\s/?\\.\\[\\]#-]+(\\.|\\[\\.\\])?)+(/\\S*)?\\s*$",
|
||||||
|
flags: "i",
|
||||||
|
shouldMatch: true,
|
||||||
|
args: [true, true, true, "Everything"],
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue