Added detection patterns for Octal, Binary, Decimal, Hexdumps, HTML Entities, URL encoding, escaped Unicode, and Quoted Printable encoding.

This commit is contained in:
n1474335 2018-01-14 18:26:06 +00:00
parent a1624a9215
commit 48f8ca693d
1 changed files with 138 additions and 55 deletions

View File

@ -797,12 +797,37 @@ const OperationConfig = {
value: ByteRepr.DELIM_OPTIONS value: ByteRepr.DELIM_OPTIONS
} }
], ],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?: (?:[0-7]{1,2}|[123][0-7]{2}))*$",
// flags: "", flags: "",
// args: [] args: ["Space"]
//}, },
{
match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?:,(?:[0-7]{1,2}|[123][0-7]{2}))*$",
flags: "",
args: ["Comma"]
},
{
match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?:;(?:[0-7]{1,2}|[123][0-7]{2}))*$",
flags: "",
args: ["Semi-colon"]
},
{
match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?::(?:[0-7]{1,2}|[123][0-7]{2}))*$",
flags: "",
args: ["Colon"]
},
{
match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?:\\n(?:[0-7]{1,2}|[123][0-7]{2}))*$",
flags: "",
args: ["Line feed"]
},
{
match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?:\\r\\n(?:[0-7]{1,2}|[123][0-7]{2}))*$",
flags: "",
args: ["CRLF"]
},
] ]
}, },
"To Octal": { "To Octal": {
@ -874,12 +899,42 @@ const OperationConfig = {
value: ByteRepr.BIN_DELIM_OPTIONS value: ByteRepr.BIN_DELIM_OPTIONS
} }
], ],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "^(?:[01]{8})+$",
// flags: "", flags: "",
// args: [] args: ["None"]
//}, },
{
match: "^(?:[01]{8})(?: [01]{8})*$",
flags: "",
args: ["Space"]
},
{
match: "^(?:[01]{8})(?:,[01]{8})*$",
flags: "",
args: ["Comma"]
},
{
match: "^(?:[01]{8})(?:;[01]{8})*$",
flags: "",
args: ["Semi-colon"]
},
{
match: "^(?:[01]{8})(?::[01]{8})*$",
flags: "",
args: ["Colon"]
},
{
match: "^(?:[01]{8})(?:\\n[01]{8})*$",
flags: "",
args: ["Line feed"]
},
{
match: "^(?:[01]{8})(?:\\r\\n[01]{8})*$",
flags: "",
args: ["CRLF"]
},
] ]
}, },
"To Binary": { "To Binary": {
@ -909,12 +964,37 @@ const OperationConfig = {
value: ByteRepr.DELIM_OPTIONS value: ByteRepr.DELIM_OPTIONS
} }
], ],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "^(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5])(?: (?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5]))*$",
// flags: "", flags: "",
// args: [] args: ["Space"]
//}, },
{
match: "^(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5])(?:,(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5]))*$",
flags: "",
args: ["Comma"]
},
{
match: "^(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5])(?:;(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5]))*$",
flags: "",
args: ["Semi-colon"]
},
{
match: "^(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5])(?::(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5]))*$",
flags: "",
args: ["Colon"]
},
{
match: "^(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5])(?:\\n(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5]))*$",
flags: "",
args: ["Line feed"]
},
{
match: "^(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5])(?:\\r\\n(?:\\d{1,2}|1\\d{2}|2[0-4]\\d|25[0-5]))*$",
flags: "",
args: ["CRLF"]
},
] ]
}, },
"To Decimal": { "To Decimal": {
@ -938,12 +1018,12 @@ const OperationConfig = {
inputType: "string", inputType: "string",
outputType: "byteArray", outputType: "byteArray",
args: [], args: [],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "^(?:(?:[\\dA-F]{4,16}:?)?\\s*((?:[\\dA-F]{2}\\s){1,8}(?:\\s|[\\dA-F]{2}-)(?:[\\dA-F]{2}\\s){1,8}|(?:[\\dA-F]{2}\\s|[\\dA-F]{4}\\s)+)[^\\n]*\\n?)+$",
// flags: "", flags: "i",
// args: [] args: []
//}, },
] ]
}, },
"To Hexdump": { "To Hexdump": {
@ -1003,12 +1083,12 @@ const OperationConfig = {
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
args: [], args: [],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "&(?:#\\d{2,3}|#x[\\da-f]{2}|[a-z]{2,6});",
// flags: "", flags: "i",
// args: [] args: []
//}, },
] ]
}, },
"To HTML Entity": { "To HTML Entity": {
@ -1053,12 +1133,12 @@ const OperationConfig = {
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
args: [], args: [],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "%[\\da-f]{2}",
// flags: "", flags: "i",
// args: [] args: []
//}, },
] ]
}, },
"URL Encode": { "URL Encode": {
@ -1093,12 +1173,22 @@ const OperationConfig = {
value: Unicode.PREFIXES value: Unicode.PREFIXES
} }
], ],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "\\\\u(?:[\\da-f]{4,6})",
// flags: "", flags: "i",
// args: [] args: ["\\u"]
//}, },
{
match: "%u(?:[\\da-f]{4,6})",
flags: "i",
args: ["%u"]
},
{
match: "U\\+(?:[\\da-f]{4,6})",
flags: "i",
args: ["U+"]
},
] ]
}, },
"From Quoted Printable": { "From Quoted Printable": {
@ -1107,12 +1197,12 @@ const OperationConfig = {
inputType: "string", inputType: "string",
outputType: "byteArray", outputType: "byteArray",
args: [], args: [],
patterns: [ // TODO patterns: [
//{ {
// match: "^$", match: "(?:=[\\da-f]{2}|=\\n)(?:[\\x21-\\x3d\\x3f-\\x7e \\t]|=[\\da-f]{2}|=\\n)*$",
// flags: "", flags: "i",
// args: [] args: []
//}, },
] ]
}, },
"To Quoted Printable": { "To Quoted Printable": {
@ -1133,13 +1223,6 @@ const OperationConfig = {
type: "boolean", type: "boolean",
value: Punycode.IDN value: Punycode.IDN
} }
],
patterns: [ // TODO
//{
// match: "^$",
// flags: "",
// args: []
//},
] ]
}, },
"To Punycode": { "To Punycode": {