Made the input regexes more robust

This commit is contained in:
n1073645 2019-11-27 10:24:31 +00:00
parent aa206d7b37
commit a2eadee06a
9 changed files with 42 additions and 17 deletions

View file

@ -46,22 +46,42 @@ class BaconCipherDecode extends Operation {
];
this.patterns = [
{
match: "^([01]{5}\\s?)+$",
match: "^\\s*([01]{5}\\s?)+$",
flags: "",
args: ["Standard (I=J and U=V)", "0/1", false]
},
{
match: "^\\s*([01]{5}\\s?)+$",
flags: "",
args: ["Standard (I=J and U=V)", "0/1", true]
},
{
match: "^\\s*([AB]{5}\\s?)+$",
flags: "",
args: ["Standard (I=J and U=V)", "A/B", false]
},
{
match: "^\\s*([AB]{5}\\s?)+$",
flags: "",
args: ["Standard (I=J and U=V)", "A/B", true]
},
{
match: "^\\s*([01]{5}\\s?)+$",
flags: "",
args: ["Complete", "0/1", false]
},
{
match: "^([01]{5}\\s?)+$",
match: "^\\s*([01]{5}\\s?)+$",
flags: "",
args: ["Complete", "0/1", true]
},
{
match: "^([AB]{5}\\s?)+$",
match: "^\\s*([AB]{5}\\s?)+$",
flags: "",
args: ["Complete", "A/B", false]
},
{
match: "^([AB]{5}\\s?)+$",
match: "^\\s*([AB]{5}\\s?)+$",
flags: "",
args: ["Complete", "A/B", true]
}

View file

@ -44,9 +44,14 @@ class CSVToJSON extends Operation {
];
this.patterns = [
{
match: "([A-Z\s]*,){5}",
match: "^\\s*([A-Z\\s]*,){5}",
flags: "i",
args: [",", "\r\n", "Array of dictionaries"]
},
{
match: "^\\s*([A-Z\\s]*,){5}",
flags: "i",
args: [",", "\r\n", "Array of arrays"]
}
];
}

View file

@ -39,19 +39,19 @@ class ChangeIPFormat extends Operation {
];
this.patterns = [
{
match: "([0-9]{1,3}\\.){3}[0-9]{1,3}",
match: "^\\s*([0-9]{1,3}\\.){3}[0-9]{1,3}$",
flags: "",
args: ["Dotted Decimal","Decimal"]
args: ["Dotted Decimal", "Decimal"]
},
{
match: "([0-9]{1,3}\\.){3}[0-9]{1,3}",
match: "^\\s*([0-9]{1,3}\\.){3}[0-9]{1,3}$",
flags: "",
args: ["Dotted Decimal","Octal"]
args: ["Dotted Decimal", "Octal"]
},
{
match: "([0-9]{1,3}\\.){3}[0-9]{1,3}",
match: "^\\s*([0-9]{1,3}\\.){3}[0-9]{1,3}$",
flags: "",
args: ["Dotted Decimal","Hex"]
args: ["Dotted Decimal", "Hex"]
}
];
}

View file

@ -26,7 +26,7 @@ class DechunkHTTPResponse extends Operation {
this.args = [];
this.patterns = [
{
match: "^[0-9A-F]+\r\n",
match: "^\\s*[0-9A-F]+\r\n",
flags: "i",
args: []
}

View file

@ -32,7 +32,7 @@ class DecodeNetBIOSName extends Operation {
];
this.patterns = [
{
match: "^\\S{16}$",
match: "^\\s*\\S{32}$",
flags: "",
args: [65]
}

View file

@ -57,7 +57,7 @@ class FormatMACAddresses extends Operation {
];
this.patterns = [
{
match: "^([0-9a-f]{2}:){5}[0-9a-f]{2}$",
match: "^\\s*([0-9a-f]{2}:){5}[0-9a-f]{2}$",
flags: "i",
args: ["Both", true, true, true, true, true]
}

View file

@ -28,7 +28,7 @@ class FromHexContent extends Operation {
this.args = [];
this.patterns = [
{
match: "^.+?\\|[0-9a-f]{2}\\|.+$",
match: "^\\s*.*?\\|([0-9a-f]{2})+\\|.*$",
flags: "i",
args: []
}

View file

@ -25,7 +25,7 @@ class RemoveLineNumbers extends Operation {
this.args = [];
this.patterns = [
{
match: "^([0-9]+ .*?(\\n))+[0-9] .+$",
match: "^\\s*([0-9]+ .*?(\\n))+[0-9] .+$",
flags: "",
args: []
}

View file

@ -26,7 +26,7 @@ class StripHTTPHeaders extends Operation {
this.args = [];
this.patterns = [
{
match: "^HTTP(.|\\s)+?(\\r?\\n){2}",
match: "^\\s*HTTP(.|\\s)+?(\\r?\\n){2}",
flags: "",
args: []
}