mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 16:25:01 -04:00
Made the input regexes more robust
This commit is contained in:
parent
aa206d7b37
commit
a2eadee06a
9 changed files with 42 additions and 17 deletions
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -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: []
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class DecodeNetBIOSName extends Operation {
|
|||
];
|
||||
this.patterns = [
|
||||
{
|
||||
match: "^\\S{16}$",
|
||||
match: "^\\s*\\S{32}$",
|
||||
flags: "",
|
||||
args: [65]
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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: []
|
||||
}
|
||||
|
|
|
@ -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: []
|
||||
}
|
||||
|
|
|
@ -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: []
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue