Converted MagicObject to just dictionaries

This commit is contained in:
n1073645 2019-12-18 10:55:16 +00:00
parent c8b474eef4
commit 1bbcc8d542
44 changed files with 879 additions and 890 deletions

View file

@ -1,17 +0,0 @@
/**
* A class to make the input/output validation checks easier to define.
*/
class magicObject {
/**
* @param inRegexes
* @param outRegexes
* @param mimeCheck
*/
constructor (inRegexes = null, outRegexes = null, mimeCheck = null, entropyTests=null) {
this.inRegexes = inRegexes;
this.outRegexes = outRegexes;
this.mimeCheck = mimeCheck;
this.entropyTests = entropyTests;
}
} export default magicObject;

View file

@ -8,7 +8,6 @@ import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {DELIM_OPTIONS} from "../lib/Delim.mjs"; import {DELIM_OPTIONS} from "../lib/Delim.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* A1Z26 Cipher Decode operation * A1Z26 Cipher Decode operation
@ -34,7 +33,9 @@ class A1Z26CipherDecode extends Operation {
value: DELIM_OPTIONS value: DELIM_OPTIONS
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([12]?[0-9] )+[12]?[0-9]\\s*$", match: "^\\s*([12]?[0-9] )+[12]?[0-9]\\s*$",
flags: "", flags: "",
@ -70,8 +71,8 @@ class A1Z26CipherDecode extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["CRLF"] args: ["CRLF"]
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
import { import {
BACON_ALPHABETS, BACON_ALPHABETS,
BACON_TRANSLATION_CASE, BACON_TRANSLATION_AMNZ, BACON_TRANSLATIONS, BACON_CLEARER_MAP, BACON_NORMALIZE_MAP, BACON_TRANSLATION_CASE, BACON_TRANSLATION_AMNZ, BACON_TRANSLATIONS, BACON_CLEARER_MAP, BACON_NORMALIZE_MAP,
@ -45,7 +44,9 @@ class BaconCipherDecode extends Operation {
"value": false "value": false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([01]{5}\\s?)+$", match: "^\\s*([01]{5}\\s?)+$",
flags: "", flags: "",
@ -93,8 +94,8 @@ class BaconCipherDecode extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["Complete", "A/B", true] args: ["Complete", "A/B", true]
} }]
]); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import magicObject from "../lib/MagicObject.mjs";
import Bzip2 from "libbzip2-wasm"; import Bzip2 from "libbzip2-wasm";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
@ -35,18 +34,17 @@ class Bzip2Decompress extends Operation {
value: false value: false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\x42\\x5a\\x68", match: "^\\x42\\x5a\\x68",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
} }],
], entropyTests: criteria.compressedToDecompressed
null, };
null,
criteria.compressedToDecompressed
);
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import magicObject from "../lib/MagicObject.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
/** /**
@ -43,7 +42,9 @@ class CSVToJSON extends Operation {
value: ["Array of dictionaries", "Array of arrays"] value: ["Array of dictionaries", "Array of arrays"]
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([A-Z\\s]*,){5}", match: "^\\s*([A-Z\\s]*,){5}",
flags: "i", flags: "i",
@ -55,8 +56,8 @@ class CSVToJSON extends Operation {
flags: "i", flags: "i",
magic: true, magic: true,
args: [",", "\r\n", "Array of arrays"] args: [",", "\r\n", "Array of arrays"]
} }]
]); };
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
import {fromHex} from "../lib/Hex.mjs"; import {fromHex} from "../lib/Hex.mjs";
/** /**
@ -38,7 +37,9 @@ class ChangeIPFormat extends Operation {
"value": ["Dotted Decimal", "Decimal", "Octal", "Hex"] "value": ["Dotted Decimal", "Decimal", "Octal", "Hex"]
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([0-9]{1,3}\\.){3}[0-9]{1,3}$", match: "^\\s*([0-9]{1,3}\\.){3}[0-9]{1,3}$",
flags: "", flags: "",
@ -56,8 +57,8 @@ class ChangeIPFormat extends Operation {
flags: "", flags: "",
magic: false, magic: false,
args: ["Dotted Decimal", "Hex"] args: ["Dotted Decimal", "Hex"]
} }]
]); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import magicObject from "../lib/MagicObject.mjs";
import cptable from "codepage"; import cptable from "codepage";
/** /**
@ -27,14 +26,16 @@ class CitrixCTX1Decode extends Operation {
this.inputType = "ArrayBuffer"; this.inputType = "ArrayBuffer";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "([A-Z]{4}){10,}", match: "([A-Z]{4}){10,}",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Dechunk HTTP response operation * Dechunk HTTP response operation
@ -25,14 +24,16 @@ class DechunkHTTPResponse extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*[0-9A-F]+\r\n", match: "^\\s*[0-9A-F]+\r\n",
flags: "i", flags: "i",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Decode NetBIOS Name operation * Decode NetBIOS Name operation
@ -31,14 +30,16 @@ class DecodeNetBIOSName extends Operation {
"value": 65 "value": 65
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*\\S{32}$", match: "^\\s*\\S{32}$",
flags: "", flags: "",
magic: true, magic: true,
args: [65] args: [65]
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
@ -26,7 +25,9 @@ class DefangIPAddresses extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-f]{4}:){7}[0-9a-f]{4})\\s*$", match: "^\\s*(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-f]{4}:){7}[0-9a-f]{4})\\s*$",
flags: "i", flags: "i",
@ -34,16 +35,15 @@ class DefangIPAddresses extends Operation {
args: [], args: [],
} }
], ],
[ outRegexes: [
{ {
match: "^\\s*(([0-9]{1,3}\\[\\.\\]){3}[0-9]{1,3}|([0-9a-f]{4}\\[\\:\\]){7}[0-9a-f]{4})\\s*$", match: "^\\s*(([0-9]{1,3}\\[\\.\\]){3}[0-9]{1,3}|([0-9a-f]{4}\\[\\:\\]){7}[0-9a-f]{4})\\s*$",
flags: "i", flags: "i",
magic: true, magic: true,
shouldMatch: true, shouldMatch: true,
args: [] args: []
} }]
] };
);
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import {URL_REGEX, DOMAIN_REGEX} from "../lib/Extract.mjs"; import {URL_REGEX, DOMAIN_REGEX} from "../lib/Extract.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* DefangURL operation * DefangURL operation
@ -48,7 +47,9 @@ class DefangURL extends Operation {
value: ["Valid domains and full URLs", "Only full URLs", "Everything"] value: ["Valid domains and full URLs", "Only full URLs", "Everything"]
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*(https?|ftp)://(-\\.)?([^\\s/?\\.#-]+\\.?)+(/\\S*)?\\s*$", match: "^\\s*(https?|ftp)://(-\\.)?([^\\s/?\\.#-]+\\.?)+(/\\S*)?\\s*$",
flags: "i", flags: "i",
@ -98,15 +99,15 @@ class DefangURL extends Operation {
args: [true, true, true, "Everything"], args: [true, true, true, "Everything"],
} }
], ],
[ outRegexes: [
{ {
match: "^\\s*(h(tt|xx)ps?|ftp)(://|\\[://\\])(-(\\.|\\[\\.\\]))?([^\\s/?\\.\\[\\]#-]+(\\.|\\[\\.\\])?)+(/\\S*)?\\s*$", match: "^\\s*(h(tt|xx)ps?|ftp)(://|\\[://\\])(-(\\.|\\[\\.\\]))?([^\\s/?\\.\\[\\]#-]+(\\.|\\[\\.\\])?)+(/\\S*)?\\s*$",
flags: "i", flags: "i",
magic: false, magic: false,
shouldMatch: true, shouldMatch: true,
args: [true, true, true, "Everything"], args: [true, true, true, "Everything"],
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Escape Unicode Characters operation * Escape Unicode Characters operation
@ -45,7 +44,9 @@ class EscapeUnicodeCharacters extends Operation {
"value": true "value": true
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "\\\\u(?:[\\da-f]{4,6})", match: "\\\\u(?:[\\da-f]{4,6})",
flags: "i", flags: "i",
@ -63,8 +64,8 @@ class EscapeUnicodeCharacters extends Operation {
flags: "i", flags: "i",
magic: true, magic: true,
args: ["U+"] args: ["U+"]
}, }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Format MAC addresses operation * Format MAC addresses operation
@ -56,14 +55,16 @@ class FormatMACAddresses extends Operation {
"value": false "value": false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([0-9a-f]{2}:){5}[0-9a-f]{2}$", match: "^\\s*([0-9a-f]{2}:){5}[0-9a-f]{2}$",
flags: "i", flags: "i",
magic: false, magic: false,
args: ["Both", true, true, true, true, true] args: ["Both", true, true, true, true, true]
} }]
]); };
} }
/** /**

View file

@ -9,7 +9,6 @@ import Utils from "../Utils.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import {ENCODING_SCHEME, ENCODING_LOOKUP, FORMAT} from "../lib/BCD.mjs"; import {ENCODING_SCHEME, ENCODING_LOOKUP, FORMAT} from "../lib/BCD.mjs";
import BigNumber from "bignumber.js"; import BigNumber from "bignumber.js";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -51,18 +50,17 @@ class FromBCD extends Operation {
"value": FORMAT "value": FORMAT
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:\\d{4} ){3,}\\d{4}$", match: "^(?:\\d{4} ){3,}\\d{4}$",
flags: "", flags: "",
magic: true, magic: true,
args: ["8 4 2 1", true, false, "Nibbles"] args: ["8 4 2 1", true, false, "Nibbles"]
} }],
], entropyTests: criteria.binary
null, };
null,
criteria.binary
);
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -38,21 +37,20 @@ class FromBase32 extends Operation {
value: true value: true
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:[A-Z2-7]{8})+(?:[A-Z2-7]{2}={6}|[A-Z2-7]{4}={4}|[A-Z2-7]{5}={3}|[A-Z2-7]{7}={1})?$", match: "^(?:[A-Z2-7]{8})+(?:[A-Z2-7]{2}={6}|[A-Z2-7]{4}={4}|[A-Z2-7]{5}={3}|[A-Z2-7]{7}={1})?$",
flags: "", flags: "",
magic: true, magic: true,
args: ["A-Z2-7=", false] args: ["A-Z2-7=", false]
}, }],
], entropyTests: {
null,
null,
{
input: [4.2, 5], input: [4.2, 5],
output: criteria.entropyOfText output: criteria.entropyOfText
} }
); };
} }
/** /**

View file

@ -8,7 +8,6 @@ import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import {ALPHABET_OPTIONS} from "../lib/Base58.mjs"; import {ALPHABET_OPTIONS} from "../lib/Base58.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From Base58 operation * From Base58 operation
@ -39,7 +38,9 @@ class FromBase58 extends Operation {
"value": true "value": true
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^[1-9A-HJ-NP-Za-km-z]{20,}$", match: "^[1-9A-HJ-NP-Za-km-z]{20,}$",
flags: "", flags: "",
@ -51,8 +52,8 @@ class FromBase58 extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz", false] args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz", false]
}, }]
]); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import {fromBase64, ALPHABET_OPTIONS} from "../lib/Base64.mjs"; import {fromBase64, ALPHABET_OPTIONS} from "../lib/Base64.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -38,7 +37,9 @@ class FromBase64 extends Operation {
value: true value: true
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*(?:[A-Z\\d+/]{4})+(?:[A-Z\\d+/]{2}==|[A-Z\\d+/]{3}=)?\\s*$", match: "^\\s*(?:[A-Z\\d+/]{4})+(?:[A-Z\\d+/]{2}==|[A-Z\\d+/]{3}=)?\\s*$",
flags: "i", flags: "i",
@ -118,13 +119,11 @@ class FromBase64 extends Operation {
args: ["./0-9A-Za-z", true] args: ["./0-9A-Za-z", true]
}, },
], ],
null, entropyTests: {
null,
{
input: [4, 5], input: [4, 5],
output: criteria.entropyOfText output: criteria.entropyOfText
} }
); };
} }
/** /**

View file

@ -8,7 +8,6 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85.mjs"; import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From Base85 operation * From Base85 operation
@ -34,7 +33,9 @@ class FromBase85 extends Operation {
value: ALPHABET_OPTIONS value: ALPHABET_OPTIONS
}, },
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*(<~)?([!-u]{4})+([!-u]{1,3})??(~>)?\\s*$", match: "^\\s*(<~)?([!-u]{4})+([!-u]{1,3})??(~>)?\\s*$",
flags: "", flags: "",
@ -52,8 +53,8 @@ class FromBase85 extends Operation {
flags: "i", flags: "i",
magic: false, magic: false,
args: ["0-9A-Za-z!#$%&()*+-;<=>?@^_`{|~}", true] args: ["0-9A-Za-z!#$%&()*+-;<=>?@^_`{|~}", true]
} }]
]); };
} }
/** /**

View file

@ -8,7 +8,6 @@ import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {BIN_DELIM_OPTIONS} from "../lib/Delim.mjs"; import {BIN_DELIM_OPTIONS} from "../lib/Delim.mjs";
import {fromBinary} from "../lib/Binary.mjs"; import {fromBinary} from "../lib/Binary.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -35,7 +34,9 @@ class FromBinary extends Operation {
"value": BIN_DELIM_OPTIONS "value": BIN_DELIM_OPTIONS
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:[01]{8})+$", match: "^(?:[01]{8})+$",
flags: "", flags: "",
@ -77,12 +78,9 @@ class FromBinary extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["CRLF"] args: ["CRLF"]
}, }],
], entropyTests: criteria.binary
null, };
null,
criteria.binary
);
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import {DELIM_OPTIONS} from "../lib/Delim.mjs"; import {DELIM_OPTIONS} from "../lib/Delim.mjs";
import {fromDecimal} from "../lib/Decimal.mjs"; import {fromDecimal} from "../lib/Decimal.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -38,7 +37,9 @@ class FromDecimal extends Operation {
"value": false "value": false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
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]))*$", 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: "",
@ -74,15 +75,12 @@ class FromDecimal extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["CRLF", false] args: ["CRLF", false]
}, }],
], entropyTests: {
null,
null,
{
input: [2.5, 3], input: [2.5, 3],
output: criteria.entropyOfText output: criteria.entropyOfText
} }
); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From HTML Entity operation * From HTML Entity operation
@ -26,14 +25,16 @@ class FromHTMLEntity extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "&(?:#\\d{2,3}|#x[\\da-f]{2}|[a-z]{2,6});", match: "&(?:#\\d{2,3}|#x[\\da-f]{2}|[a-z]{2,6});",
flags: "i", flags: "i",
magic: true, magic: true,
args: [] args: []
}, }]
]); };
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import {fromHex, FROM_HEX_DELIM_OPTIONS} from "../lib/Hex.mjs"; import {fromHex, FROM_HEX_DELIM_OPTIONS} from "../lib/Hex.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -34,7 +33,9 @@ class FromHex extends Operation {
value: FROM_HEX_DELIM_OPTIONS value: FROM_HEX_DELIM_OPTIONS
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:[\\dA-F]{2})+$", match: "^(?:[\\dA-F]{2})+$",
flags: "i", flags: "i",
@ -88,15 +89,12 @@ class FromHex extends Operation {
flags: "i", flags: "i",
magic: true, magic: true,
args: ["\\x"] args: ["\\x"]
} }],
], entropyTests: {
null,
null,
{
input: [2, 3], input: [2, 3],
output: criteria.entropyOfText output: criteria.entropyOfText
} }
); };
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {fromHex} from "../lib/Hex.mjs"; import {fromHex} from "../lib/Hex.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -28,20 +27,20 @@ class FromHexContent extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "byteArray"; this.outputType = "byteArray";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*.*?\\|([0-9a-f]{2})+\\|.*$", match: "^\\s*.*?\\|([0-9a-f]{2})+\\|.*$",
flags: "i", flags: "i",
magic: true, magic: true,
args: [] args: []
} }],
], entropyTests: {
null,
null,
{
input: [3, 4], input: [3, 4],
output: criteria.entropyOfText output: criteria.entropyOfText
}); }
};
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import { fromHex } from "../lib/Hex.mjs"; import { fromHex } from "../lib/Hex.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
@ -29,20 +28,20 @@ class FromHexdump extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "byteArray"; this.outputType = "byteArray";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:(?:[\\dA-F]{4,16}h?:?)?[ \\t]*((?:[\\dA-F]{2} ){1,8}(?:[ \\t]|[\\dA-F]{2}-)(?:[\\dA-F]{2} ){1,8}|(?:[\\dA-F]{4} )*[\\dA-F]{4}|(?:[\\dA-F]{2} )*[\\dA-F]{2})[^\\n]*\\n?){2,}$", match: "^(?:(?:[\\dA-F]{4,16}h?:?)?[ \\t]*((?:[\\dA-F]{2} ){1,8}(?:[ \\t]|[\\dA-F]{2}-)(?:[\\dA-F]{2} ){1,8}|(?:[\\dA-F]{4} )*[\\dA-F]{4}|(?:[\\dA-F]{2} )*[\\dA-F]{2})[^\\n]*\\n?){2,}$",
flags: "i", flags: "i",
magic: true, magic: true,
args: [] args: []
}, }],
], entropyTests: {
null,
null,
{
input: [3, 4], input: [3, 4],
output: criteria.entropyOfText output: criteria.entropyOfText
}); }
};
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {LETTER_DELIM_OPTIONS, WORD_DELIM_OPTIONS} from "../lib/Delim.mjs"; import {LETTER_DELIM_OPTIONS, WORD_DELIM_OPTIONS} from "../lib/Delim.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From Morse Code operation * From Morse Code operation
@ -38,20 +37,20 @@ class FromMorseCode extends Operation {
"value": WORD_DELIM_OPTIONS "value": WORD_DELIM_OPTIONS
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "(?:^[-. \\n]{5,}$|^[_. \\n]{5,}$|^(?:dash|dot| |\\n){5,}$)", match: "(?:^[-. \\n]{5,}$|^[_. \\n]{5,}$|^(?:dash|dot| |\\n){5,}$)",
flags: "i", flags: "i",
magic: true, magic: true,
args: ["Space", "Line feed"] args: ["Space", "Line feed"]
}, }],
], entropyTests: {
null,
null,
{
input: [0, 2], input: [0, 2],
output: [3, 6] output: [3, 6]
}); }
};
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {DELIM_OPTIONS} from "../lib/Delim.mjs"; import {DELIM_OPTIONS} from "../lib/Delim.mjs";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
/** /**
@ -34,7 +33,9 @@ class FromOctal extends Operation {
"value": DELIM_OPTIONS "value": DELIM_OPTIONS
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?: (?:[0-7]{1,2}|[123][0-7]{2}))*$", match: "^(?:[0-7]{1,2}|[123][0-7]{2})(?: (?:[0-7]{1,2}|[123][0-7]{2}))*$",
flags: "", flags: "",
@ -70,14 +71,12 @@ class FromOctal extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["CRLF"] args: ["CRLF"]
}, }],
], entropyTests: {
null,
null,
{
input: [2.5, 3], input: [2.5, 3],
output: criteria.entropyOfText output: criteria.entropyOfText
}); }
};
} }
/** /**

View file

@ -9,7 +9,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From Quoted Printable operation * From Quoted Printable operation
@ -29,14 +28,16 @@ class FromQuotedPrintable extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "byteArray"; this.outputType = "byteArray";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^[\\x21-\\x3d\\x3f-\\x7e \\t]{0,76}(?:=[\\da-f]{2}|=\\r?\\n)(?:[\\x21-\\x3d\\x3f-\\x7e \\t]|=[\\da-f]{2}|=\\r?\\n)*$", match: "^[\\x21-\\x3d\\x3f-\\x7e \\t]{0,76}(?:=[\\da-f]{2}|=\\r?\\n)(?:[\\x21-\\x3d\\x3f-\\x7e \\t]|=[\\da-f]{2}|=\\r?\\n)*$",
flags: "i", flags: "i",
magic: true, magic: true,
args: [] args: []
}, }]
]); };
} }
/** /**

View file

@ -8,7 +8,6 @@ import Operation from "../Operation.mjs";
import moment from "moment-timezone"; import moment from "moment-timezone";
import {UNITS} from "../lib/DateTime.mjs"; import {UNITS} from "../lib/DateTime.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From UNIX Timestamp operation * From UNIX Timestamp operation
@ -34,7 +33,9 @@ class FromUNIXTimestamp extends Operation {
"value": UNITS "value": UNITS
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^1?\\d{9}$", match: "^1?\\d{9}$",
flags: "", flags: "",
@ -58,8 +59,8 @@ class FromUNIXTimestamp extends Operation {
flags: "", flags: "",
magic: true, magic: true,
args: ["Nanoseconds (ns)"] args: ["Nanoseconds (ns)"]
}, }]
]); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import zlibAndGzip from "zlibjs/bin/zlib_and_gzip.min.js"; import zlibAndGzip from "zlibjs/bin/zlib_and_gzip.min.js";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
const Zlib = zlibAndGzip.Zlib; const Zlib = zlibAndGzip.Zlib;
@ -29,18 +28,17 @@ class Gunzip extends Operation {
this.inputType = "ArrayBuffer"; this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer"; this.outputType = "ArrayBuffer";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\x1f\\x8b\\x08", match: "^\\x1f\\x8b\\x08",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
}, }],
], entropyTests: criteria.compressedToDecompressed
null, };
null,
criteria.compressedToDecompressed
);
} }
/** /**

View file

@ -6,7 +6,6 @@
import r from "jsrsasign"; import r from "jsrsasign";
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Object Identifier to Hex operation * Object Identifier to Hex operation
@ -26,14 +25,16 @@ class ObjectIdentifierToHex extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([0-9]{1,3}\\.)+[0-9]{1,3}\\s*$", match: "^\\s*([0-9]{1,3}\\.)+[0-9]{1,3}\\s*$",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -9,7 +9,6 @@ import Utils from "../Utils.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import {strToIpv6, ipv6ToStr, ipv4ToStr, IPV6_REGEX} from "../lib/IP.mjs"; import {strToIpv6, ipv6ToStr, ipv4ToStr, IPV6_REGEX} from "../lib/IP.mjs";
import BigNumber from "bignumber.js"; import BigNumber from "bignumber.js";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Parse IPv6 address operation * Parse IPv6 address operation
@ -29,14 +28,16 @@ class ParseIPv6Address extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([a-f\\d]{4}:?)+\\s*$", match: "^\\s*([a-f\\d]{4}:?)+\\s*$",
flags: "i", flags: "i",
magic: false, magic: false,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -8,7 +8,6 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { parseQrCode } from "../lib/QRCode.mjs"; import { parseQrCode } from "../lib/QRCode.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Parse QR Code operation * Parse QR Code operation
@ -34,15 +33,17 @@ class ParseQRCode extends Operation {
"value": false "value": false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)", match: "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)",
flags: "", flags: "",
args: [false], args: [false],
magic: true, magic: true,
useful: true useful: true
} }]
]); };
} }
/** /**

View file

@ -9,7 +9,6 @@ import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import { fromBase64 } from "../lib/Base64.mjs"; import { fromBase64 } from "../lib/Base64.mjs";
import { fromHex, toHexFast } from "../lib/Hex.mjs"; import { fromHex, toHexFast } from "../lib/Hex.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Parse SSH Host Key operation * Parse SSH Host Key operation
@ -39,14 +38,16 @@ class ParseSSHHostKey extends Operation {
] ]
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([A-F\\d]{2}[,;:]){15,}[A-F\\d]{2}\\s*$", match: "^\\s*([A-F\\d]{2}[,;:]){15,}[A-F\\d]{2}\\s*$",
flags: "i", flags: "i",
magic: true, magic: true,
args: ["Hex"] args: ["Hex"]
} }]
]); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Parse UNIX file permissions operation * Parse UNIX file permissions operation
@ -26,14 +25,16 @@ class ParseUNIXFilePermissions extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*d[rxw-]{9}\\s*$", match: "^\\s*d[rxw-]{9}\\s*$",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import UAParser from "ua-parser-js"; import UAParser from "ua-parser-js";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Parse User Agent operation * Parse User Agent operation
@ -26,14 +25,16 @@ class ParseUserAgent extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(User-Agent:|Mozilla\\/)[^\\n\\r]+\\s*$", match: "^(User-Agent:|Mozilla\\/)[^\\n\\r]+\\s*$",
flags: "i", flags: "i",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -10,7 +10,6 @@ import { toHex } from "../lib/Hex.mjs";
import { formatByteStr, formatDnStr } from "../lib/PublicKey.mjs"; import { formatByteStr, formatDnStr } from "../lib/PublicKey.mjs";
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Parse X.509 certificate operation * Parse X.509 certificate operation
@ -36,7 +35,9 @@ class ParseX509Certificate extends Operation {
value: ["PEM", "DER Hex", "Base64", "Raw"] value: ["PEM", "DER Hex", "Base64", "Raw"]
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^-+BEGIN CERTIFICATE-+\\r?\\n[\\da-z+/\\n\\r]+-+END CERTIFICATE-+\\r?\\n?$", match: "^-+BEGIN CERTIFICATE-+\\r?\\n[\\da-z+/\\n\\r]+-+END CERTIFICATE-+\\r?\\n?$",
flags: "i", flags: "i",
@ -44,8 +45,8 @@ class ParseX509Certificate extends Operation {
args: [ args: [
"PEM" "PEM"
] ]
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Remove line numbers operation * Remove line numbers operation
@ -24,14 +23,16 @@ class RemoveLineNumbers extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*([0-9]+ .*?(\\n))+[0-9] .+$", match: "^\\s*([0-9]+ .*?(\\n))+[0-9] .+$",
flags: "", flags: "",
magic: false, magic: false,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -10,7 +10,6 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {isImage} from "../lib/FileType.mjs"; import {isImage} from "../lib/FileType.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Render Image operation * Render Image operation
@ -36,20 +35,20 @@ class RenderImage extends Operation {
"value": ["Raw", "Base64", "Hex"] "value": ["Raw", "Base64", "Hex"]
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)", match: "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)",
flags: "", flags: "",
magic: true, magic: true,
args: ["Raw"], args: ["Raw"],
useful: true useful: true
} }],
], mimeCheck: {
null,
{
type: "image" type: "image"
} }
); };
} }
/** /**

View file

@ -6,7 +6,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Strip HTML tags operation * Strip HTML tags operation
@ -37,14 +36,16 @@ class StripHTMLTags extends Operation {
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^<html>(\\S|\\s)*</html>$", match: "^<html>(\\S|\\s)*</html>$",
flags: "i", flags: "i",
magic: true, magic: true,
args: [true, true] args: [true, true]
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Strip HTTP headers operation * Strip HTTP headers operation
@ -25,14 +24,16 @@ class StripHTTPHeaders extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\s*HTTP(.|\\s)+?(\\r?\\n){2}", match: "^\\s*HTTP(.|\\s)+?(\\r?\\n){2}",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* URL Decode operation * URL Decode operation
@ -25,14 +24,16 @@ class URLDecode extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: ".*(?:%[\\da-f]{2}.*){4}", match: ".*(?:%[\\da-f]{2}.*){4}",
flags: "i", flags: "i",
magic: true, magic: true,
args: [], args: [],
} }]
]); };
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import Stream from "../lib/Stream.mjs"; import Stream from "../lib/Stream.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* Untar operation * Untar operation
@ -28,14 +27,16 @@ class Untar extends Operation {
this.outputType = "List<File>"; this.outputType = "List<File>";
this.presentType = "html"; this.presentType = "html";
this.args = []; this.args = [];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^.{257}\\x75\\x73\\x74\\x61\\x72", match: "^.{257}\\x75\\x73\\x74\\x61\\x72",
flags: "", flags: "",
magic: true, magic: true,
args: [] args: []
} }]
]); };
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import unzip from "zlibjs/bin/unzip.min.js"; import unzip from "zlibjs/bin/unzip.min.js";
import magicObject from "../lib/MagicObject.mjs";
import * as criteria from "../lib/MagicCriteria.mjs"; import * as criteria from "../lib/MagicCriteria.mjs";
@ -43,18 +42,17 @@ class Unzip extends Operation {
value: false value: false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\x50\\x4b(?:\\x03|\\x05|\\x07)(?:\\x04|\\x06|\\x08)", match: "^\\x50\\x4b(?:\\x03|\\x05|\\x07)(?:\\x04|\\x06|\\x08)",
flags: "", flags: "",
magic: true, magic: true,
args: ["", false] args: ["", false]
}, }],
], entropyTests: criteria.compressedToDecompressed
null, };
null,
criteria.compressedToDecompressed
);
} }
/** /**

View file

@ -7,7 +7,6 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import {INFLATE_BUFFER_TYPE} from "../lib/Zlib.mjs"; import {INFLATE_BUFFER_TYPE} from "../lib/Zlib.mjs";
import zlibAndGzip from "zlibjs/bin/zlib_and_gzip.min.js"; import zlibAndGzip from "zlibjs/bin/zlib_and_gzip.min.js";
import magicObject from "../lib/MagicObject.mjs";
const Zlib = zlibAndGzip.Zlib; const Zlib = zlibAndGzip.Zlib;
@ -60,14 +59,16 @@ class ZlibInflate extends Operation {
value: false value: false
} }
]; ];
this.checks = new magicObject([ this.checks =
{
inRegexes: [
{ {
match: "^\\x78(\\x01|\\x9c|\\xda|\\x5e)", match: "^\\x78(\\x01|\\x9c|\\xda|\\x5e)",
flags: "", flags: "",
magic: true, magic: true,
args: [0, 0, "Adaptive", false, false] args: [0, 0, "Adaptive", false, false]
}, }]
]); };
} }
/** /**